apiVersion: apps/v1
kind: Deployment
metadata:
   name: keycloak-showcase-deployment
spec:
   replicas: 3
   selector:
      matchLabels:
         app: keycloak-showcase
   minReadySeconds: 10
   strategy:
      type: RollingUpdate
      rollingUpdate:
         maxUnavailable: 1
         maxSurge: 1
   template:
      metadata:
         labels:
            app: keycloak-showcase
      spec:
         containers:
         - name: keycloak-showcase
           image: gunnaraccso/camunda-showcase-keycloak:2.2.2
           ports:
           - containerPort: 8080
           env:
           - name: JDBC_URL
             value: jdbc:postgresql://postgres-service:5432/camunda
           - name: JDBC_USER
             value: camunda
           - name: JDBC_PASSWORD
             value: camunda1!
           - name: KEYCLOAK_URL_AUTH
             value: http://armstrong02
           - name: KEYCLOAK_URL_TOKEN
             value: http://keycloak-server-service:8080
           - name: KEYCLOAK_URL_PLUGIN
             value: https://keycloak-server-service:8443
           - name: KEYCLOAK_CLIENT_ID
             value: camunda-identity-service
           - name: KEYCLOAK_CLIENT_SECRET
             value: 7979d2a6-eacc-43b1-afe0-54cea181fadc
           livenessProbe:
             httpGet:
               path: /camunda/actuator/health/liveness
               port: 8080
             initialDelaySeconds: 60
             periodSeconds: 15
             failureThreshold: 4
           readinessProbe:
             httpGet:
               path: /camunda/actuator/health/readiness
               port: 8080
             initialDelaySeconds: 30
             periodSeconds: 5
             failureThreshold: 12
         initContainers:
         - name: init-keycloak
           image: busybox:1.28
           command: ['sh', '-c', "until nc -z -w 2 keycloak-server-service:8080; do echo waiting for keycloak; sleep 5; done"]
         - name: init-postgres
           image: busybox:1.28
           command: ['sh', '-c', "until nc -z -w 2 postgres-service:5432; do echo waiting for postgres; sleep 5; done"]
         hostAliases:
         - ip: 172.29.80.1
           hostnames:
           - armstrong02
