apiVersion: "apps/v1"
kind: Deployment
metadata:
  name: notifier-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: notifier
  template:
    metadata:
      labels:
        app: notifier
    spec:
      containers:
        - name: notifier
          image: "codingkapoor/notifier-impl:latest"
          imagePullPolicy: IfNotPresent
          env:
            - name: JAVA_OPTS
              valueFrom:
                configMapKeyRef:
                  name: common-config-map
                  key: java_opts
            - name: APPLICATION_SECRET
              valueFrom:
                secretKeyRef:
                  name: application-secret
                  key: secret
            - name: MYSQL_URL
              value: "jdbc:mysql://mysql/intimations_notifier_schema"
            - name: MAILER_SMTP_INTERFACE
              valueFrom:
                configMapKeyRef:
                  name: common-config-map
                  key: mailer_smtp_interface
            - name: MAILER_SMTP_PORT
              valueFrom:
                configMapKeyRef:
                  name: common-config-map
                  key: mailer_smtp_port
            - name: MAILER_RECEIVERS
              valueFrom:
                configMapKeyRef:
                  name: common-config-map
                  key: mailer_receivers
            - name: KAFKA_SERVICE_NAME
              value: "_broker._tcp.kafka.default.svc.cluster.local"
            - name: REQUIRED_CONTACT_POINT_NR
              value: "1"
          ports:
            - name: management
              containerPort: 8558
          readinessProbe:
            httpGet:
              path: "/ready"
              port: management
            periodSeconds: 10
            failureThreshold: 10
            initialDelaySeconds: 20
          livenessProbe:
            httpGet:
              path: "/alive"
              port: management
            periodSeconds: 10
            failureThreshold: 10
            initialDelaySeconds: 20
          volumeMounts:
            - name: signature-public-secret-conf
              mountPath: /opt/conf/signature-public-jwks.conf
              subPath: signature-public-jwks.conf
              readOnly: true
            - name: mysql-secret-conf
              mountPath: /opt/conf/mysql.conf
              subPath: mysql.conf
              readOnly: true
            - name: mailer-secret-conf
              mountPath: /opt/conf/mailer.conf
              subPath: mailer.conf
              readOnly: true
      volumes:
        - name: signature-public-secret-conf
          secret:
            secretName: signature-public-secret
        - name: mysql-secret-conf
          secret:
            secretName: mysql-secret
        - name: mailer-secret-conf
          secret:
            secretName: mailer-secret
