# License terms and conditions for Gluu Cloud Native Edition:
# https://www.apache.org/licenses/LICENSE-2.0
apiVersion: apps/v1
kind: Deployment
metadata:
  name: oxpassport
  annotations:
    sidecar.istio.io/rewriteAppHTTPProbers: "true"
spec:
  # serviceName: oxpassport
  replicas: 1
  selector:
    matchLabels:
      app: oxpassport
  template:
    metadata:
      labels:
        APP_NAME: oxpassport
      annotations:
        sidecar.istio.io/rewriteAppHTTPProbers: "true"
    spec:
      containers:
      - name: oxpassport
        imagePullPolicy: Always
        image: gluufederation/oxpassport:4.3.0_01
        resources:
          requests:
            memory: "900Mi"
            cpu: "700m"
          limits:
            memory: "900Mi"
            cpu: "700m"
        command:
          - /bin/sh
          - -c
          - |
              /usr/bin/python3 /scripts/update-lb-ip.py &
              /app/scripts/entrypoint.sh
        ports:
        - containerPort: 8090
        envFrom:
        - configMapRef:
            name: gluu-config-cm
        livenessProbe:
          httpGet:
            path: /passport/token
            port: 8090
          initialDelaySeconds: 30
          periodSeconds: 30
          timeoutSeconds: 5
        readinessProbe:
          httpGet:
            path: /passport/token
            port: 8090
          initialDelaySeconds: 25
          periodSeconds: 25
          timeoutSeconds: 5
        volumeMounts:
          - name: cb-pass
            mountPath: "/etc/gluu/conf/couchbase_password"
            subPath: couchbase_password
          - name: cb-crt
            mountPath: "/etc/certs/couchbase.crt"
            subPath: couchbase.crt
          - mountPath: /scripts
            name: update-lb-ip
      volumes:
      - name: cb-pass
        secret:
          secretName: cb-pass
      - name: cb-crt
        secret:
          secretName: cb-crt
      - name: update-lb-ip
        configMap:
          name: updatelbip
      hostAliases:
      - ip: NGINX_IP
        hostnames:
        - FQDN
