apiVersion: apps/v1
kind: Deployment
# create the namespace
metadata:
  name: sip-api
spec:
  replicas: 5
  selector:
    matchLabels:
      app: sip-api
  template:
    metadata:
      labels:
        app: sip-api
    spec:
      containers:
        - name: app
          image: gcr.io/sip-unlu-2022-353303/sip-api-image:latest
          imagePullPolicy: Always
          env:
            - name: SIP_API_PORT
              value: adminadmin

            - name: jwt-secret
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: jwt-secret

            - name: jwt-issuer
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: jwt-issuer

            - name: jwt-expiration-days
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: jwt-expiration-days

            - name: sip-db
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: sip-db

            - name: db-host
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: db-host

            - name: db-port
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: db-port

            - name: db-name
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: db-name


            - name: db-password
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: db-password

            - name: db-url
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: db-url

            - name: smtp-password
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: smtp-password

            - name: admin-email
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: admin-email

            - name: admin-password
              valueFrom:
                configMapKeyRef:
                  name: sip-api-configmap
                  key: admin-password
#          envFrom:
#            - configMapRef:
#                name: sip-api-configmap # Must match with API ConfigMap identifier


