apiVersion: apps/v1
kind: Deployment
metadata:
  name: iam
  namespace: oih-dev-ns
spec:
  replicas: 1
  selector:
    matchLabels:
      app: iam
  minReadySeconds: 10
  revisionHistoryLimit: 2
  template:
    metadata:
      labels:
        app: iam
    spec:
      containers:
      - name: iam
        image: openintegrationhub/iam:latest
        env:
        - name: IAM_MONGODB_CONNECTION
          valueFrom:
            secretKeyRef:
              name: iam
              key: mongourl
        - name: IAM_AUTH_TYPE
          value: basic
        - name: IAM_PORT
          value: '3099'
        - name: IAM_BASEURL
          value: "http://iam.oih-dev-ns.svc.cluster.local:3099"
        - name: IAM_ORIGINWHITELIST
          value: "localhost,localoih.com,127.0.0.1,.oih-dev-ns.svc.cluster.local"
        - name: NODE_ENV
          value: "production"
        - name: IAM_JWT_SECRET
          valueFrom:
            secretKeyRef:
              name: iam
              key: jwtsecret
        - name: IAM_SESSION_COOKIE_SECRET
          valueFrom:
            secretKeyRef:
              name: iam
              key: cookiesecret
        - name: IAM_JWT_AUDIENCE
          value: openintegrationhub.com
        - name: IAM_JWT_COOKIENAME
          value: oih-iam
        - name: IAM_ACC_ADMIN_USERNAME
          value: admin@openintegrationhub.com
        - name: IAM_ACC_ADMIN_PASSWORD
          valueFrom:
            secretKeyRef:
              name: iam
              key: admin_password
        - name: IAM_ACC_SERVICE_ACCOUNT_USERNAME
          value: service-oih-iam@openintegrationhub.com
        - name: IAM_ACC_SERVICE_ACCOUNT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: iam
              key: serviceacc_password
        - name: IAM_SERVICE_CLIENT_ID
          value: 8ce00058-5f75-435f-9026-ad952480e15a
        - name: IAM_SERVICE_CLIENT_SECRET
          valueFrom:
            secretKeyRef:
              name: iam
              key: oidc_client_secret
        ports:
        - containerPort: 3099
        livenessProbe:
          httpGet:
            path: /healthcheck
            port: 3099
          initialDelaySeconds: 120
          timeoutSeconds: 1
        readinessProbe:
          httpGet:
            path: /healthcheck
            port: 3099
          initialDelaySeconds: 10
          timeoutSeconds: 1
