apiVersion: batch/v1
kind: CronJob
metadata:
  name: ef-reporting-connector-cron
  namespace: ef-cti
spec:
  concurrencyPolicy: Forbid
  failedJobsHistoryLimit: 1
  schedule: "*/5 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          imagePullSecrets:
          - name: expertflow-reg-cred
          containers:
            - image: gitimages.expertflow.com/fnb/fnb_reporting_connector:4.7_f-FNB-2549
              name: ef-reporting-connector
              imagePullPolicy: IfNotPresent
              env:
                # - name: TZ
                #   valueFrom:
                #     configMapKeyRef:
                #       key: TZ
                #       name: variables-common-env-cm
                - name: MONGODB_ENABLE_SSL
                  valueFrom:
                    configMapKeyRef:
                      key: MONGODB_ENABLE_SSL
                      name: ef-connection-env-cm
                - name: MONGODB_CLIENT_CERT
                  valueFrom:
                    configMapKeyRef:
                      key: MONGODB_CLIENT_CERT
                      name: ef-connection-env-cm
                - name: MONGODB_CA_CERT
                  valueFrom:
                    configMapKeyRef:
                      key: MONGODB_CA_CERT
                      name: ef-connection-env-cm
                - name: TRUST_STORE_PASSWORD
                  valueFrom:
                    configMapKeyRef:
                      key: TRUST_STORE_PASSWORD
                      name: ef-connection-env-cm
                - name: KEY_STORE_PASSWORD
                  valueFrom:
                    configMapKeyRef:
                      key: KEY_STORE_PASSWORD
                      name: ef-connection-env-cm
          # resources:
          #   requests:
          #     memory: "64Mi"
          #     cpu: "50m"
          #   limits:
          #     memory: "256Mi"
          #     cpu: "100m"
              volumeMounts:
                - name: config-volume-conf
                  mountPath: /root/config/reporting-connector.conf
                  subPath: reporting-connector.conf
                - name: ef-reporting-connector-keystore
                  mountPath: /root/config/certs/mykeystore.jks
                  subPath: mykeystore.jks
                - name: mongo-mongodb-ca
                  mountPath: /mongo
          volumes:
             - name: ef-reporting-connector-keystore
               configMap:
                 name: ef-reporting-connector-keystore-cm
                 optional: true
             - name: config-volume-conf
               configMap:
                 name: ef-reporting-connector-conf
                 optional: true
             - name: mongo-mongodb-ca
               secret:
                 secretName: mongo-mongodb-ca
          restartPolicy: Never
      backoffLimit: 0
