apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    prometheus.io/port: "8080"
    prometheus.io/scheme: http
    prometheus.io/scrape: "true"
    prometheus.io/path: /q/metrics
    app.openshift.io/vcs-url: https://github.com/ibm-cloud-architecture/refarch-eda-store-simulator.git
  labels:
    app.kubernetes.io/version: 0.0.1
    app.kubernetes.io/name: store-simulator
  name: store-simulator
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/version: 0.0.1
      app.kubernetes.io/name: store-simulator
  template:
    metadata:
      annotations:
        prometheus.io/port: "8080"
        prometheus.io/scheme: http
        prometheus.io/scrape: "true"
        prometheus.io/path: /q/metrics
        app.openshift.io/vcs-url: https://github.com/ibm-cloud-architecture/refarch-eda-store-simulator.git
      labels:
        app.kubernetes.io/version: 0.0.1
        app.kubernetes.io/name: store-simulator
    spec:
      containers:
      - args:
        - -Dquarkus.http.host=0.0.0.0
        - -Djava.util.logging.manager=org.jboss.logmanager.LogManager
        - -Djavax.net.ssl.trustStoreType=jks
        - -Djavax.net.ssl.trustStore=/deployments/certs/mq-tls/mq-tls.jks
        - -Djavax.net.ssl.trustStorePassword=my-mq-password
        - -jar
        - /deployments/quarkus-run.jar
        command:
        - java
        env:
        - name: KUBERNETES_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: KAFKA_SSL_TRUSTSTORE_FILE_LOCATION
          value: /deployments/certs/server/ca.p12
        - name: KAFKA_SSL_TRUSTSTORE_TYPE
          value: PKCS12
        - name: KAFKA_SSL_KEYSTORE_FILE_LOCATION
          value: /deployments/certs/user/user.p12
        - name: KAFKA_SSL_KEYSTORE_TYPE
          value: PKCS12
        - name: KAFKA_SECURITY_PROTOCOL
          value: SSL
        - name: KAFKA_USER
          value: tls-user
        - name: KAFKA_CERT_PWD
          valueFrom:
            secretKeyRef:
              key: ca.password
              name: kafka-cluster-ca-cert
        - name: USER_CERT_PWD
          valueFrom:
            secretKeyRef:
              key: user.password
              name: tls-user
        - name: MQ_CCDT_URL
          value: /deployments/certs/mq-ccdt/mq-ccdt.json
        - name: JAVA_APP_JAR
          value: /deployments/quarkus-run.jar
        envFrom:
        - configMapRef:
            name: store-simulator-cm
        - configMapRef:
            name: kafka-env-cm
        image: quay.io/ibmcase/eda-store-simulator
        imagePullPolicy: Always
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /q/health/live
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 0
          periodSeconds: 30
          successThreshold: 1
          timeoutSeconds: 10
        name: store-simulator
        ports:
        - containerPort: 8080
          name: http
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /q/health/ready
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 0
          periodSeconds: 30
          successThreshold: 1
          timeoutSeconds: 10
        volumeMounts:
        - mountPath: /deployments/certs/server
          name: kafka-cert
          readOnly: false
          subPath: ""
        - mountPath: /deployments/certs/user
          name: user-cert
          readOnly: false
          subPath: ""
      serviceAccount: inventory-solution-sa
      volumes:
      - name: kafka-cert
        secret:
          optional: true
          secretName: kafka-cluster-ca-cert
      - name: user-cert
        secret:
          optional: true
          secretName: tls-user
