# License terms and conditions for Gluu Cloud Native Edition:
# https://www.apache.org/licenses/LICENSE-2.0
apiVersion: apps/v1
kind: Deployment
metadata:
  name: gg-kong-ui
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gg-kong-ui
  template:
    metadata:
      labels:
        app: gg-kong-ui
    spec:
      hostAliases:
      - ip: IP
        hostnames:
        - DOMAIN
      volumes:
        - name: tls-certificate
          secret:
            items:
              - key: tls.crt
                path: tls.crt
              - key: tls.key
                path: tls.key
            secretName: tls-certificate
        - name: update-lb-ip
          configMap:
            name: updatelbip
      containers:
        - name: gg-kong-ui
          image: gluufederation/gluu-gateway-ui:4.2.0_01
          command:
            - /bin/sh
            - -c
            - |
                /usr/bin/python3 /scripts/update-lb-ip.py &
                /app/scripts/entrypoint.sh
          resources:
            requests:
              memory: "2000Mi"
              cpu: "1000m"
            limits:
              memory: "2000Mi"
              cpu: "1000m"
          ports:
            - containerPort: 443
              name: gg-kong-ui
          env:
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: gg-ui-postgres-pass
                  key: DB_PASSWORD
          envFrom:
          - configMapRef:
              name: gg-ui-cm
          volumeMounts:
            - mountPath: /etc/certs
              name: tls-certificate
            - mountPath: /scripts
              name: update-lb-ip
          readinessProbe:
            tcpSocket:
              port: 443
            initialDelaySeconds: 25
            periodSeconds: 25
          livenessProbe:
            tcpSocket:
              port: 443
            initialDelaySeconds: 30
            periodSeconds: 30