apiVersion: apps/v1           # API version
kind: Deployment              # Type of kubernetes resource
metadata:
  name: chat-server    # Name of the kubernetes resource
  labels:                     # Labels that will be applied to this resource
    app: chat-server
spec:
  replicas: 1                 # No. of replicas/pods to run in this deployment
  selector:
    matchLabels:              # The deployment applies to any pods mayching the specified labels
      app: chat-server
  template:                   # Template for creating the pods in this deployment
    metadata:
      labels:                 # Labels that will be applied to each Pod in this deployment
        app: chat-server
    spec:                     # Spec for the containers that will be run in the Pods
      containers:
        - name: chat-server
          image: bendevet/chat-server:v12
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 5000 # The port that the container exposes
          resources:
            limits:
              cpu: 200m
            requests:
              cpu: 50m
          env:                  # Environment variables supplied to the Pod
            - name: PRAYERGUIDE_APP_DATA_URL
              value: http://192.168.1.107:9094/login
            - name: SPRING_DATA_MONGODB_PORT
              value: "27017"
            - name: SPRING_DATA_MONGODB_HOST
              value: mongodb
            - name: SPRING_DATA_MONGODB_DATABASE
              value: prayerguideapp
#            - name: googleKey
#              valueFrom:
#                configMapKeyRef:
#                  name: quicky-test-config
#                  key: googleKey
#            - name: estimationRate
#              valueFrom:
#                configMapKeyRef:
#                  name: quicky-test-config
#                  key: estimationRate

