apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: iam
  labels:
    app: iam
spec:
  serviceName: iam
  replicas: 1
  selector:
    matchLabels:
      app: iam
  template:
    metadata:
      labels:
        app: iam
    spec:
      imagePullSecrets:
        - name: dockerregcred

      initContainers:
        - name: iam-init
          image: docker.ergon.ch/airlock/airlockiam:7.4
          imagePullPolicy: IfNotPresent
          args: ["init"]
          volumeMounts:
            - name: data
              mountPath: /home/airlock/iam/
              subPath: iam
      containers:
        - name: iam
          image: docker.ergon.ch/airlock/airlockiam:7.4
          imagePullPolicy: IfNotPresent
          envFrom:
            - configMapRef:
                name: iam-env-config
          ports:
            - name: https
              containerPort: 8443
          volumeMounts:
            - name: data
              mountPath: /home/airlock/iam/
              subPath: iam
            - name: iam-config
              mountPath: /home/airlock/iam/instances/auth/medusa-configuration.xml
              subPath: medusa-configuration.xml
            - name: iam-loginapp-texts
              mountPath: /home/airlock/iam/instances/auth/loginapp-texts/strings_en.properties
              subPath: strings_en.properties
            - name: iam-libs
              mountPath: /home/airlock/iam/instances/auth/libs/mariadb-java-client.jar
              subPath: mariadb-java-client.jar
            - name: iam-license
              mountPath: /home/airlock/iam/license.txt
              subPath: license.txt
            - name: values-jwt
              mountPath: /home/airlock/iam/instances/auth/values/jwt/
            - name: values-mariadb
              mountPath: /home/airlock/iam/instances/auth/values/mariadb/
          livenessProbe:
            httpGet:
              path: /health
              port: https
              scheme: HTTPS
            initialDelaySeconds: 120
          readinessProbe:
            httpGet:
              path: /auth-login/rest/health
              port: https
              scheme: HTTPS
            initialDelaySeconds: 120
      volumes:
        - name: data
          emptyDir: {}
        - name: iam-config
          configMap:
            name: iam-config
        - name: iam-loginapp-texts
          configMap:
            name: iam-loginapp-texts
        - name: iam-libs
          configMap:
            name: iam-libs
        - name: iam-license
          secret:
            secretName: iam-license
        - name: values-jwt
          secret:
            secretName: jwt-secret
        - name: values-mariadb
          secret:
            secretName: mariadb-secret
