{{ if .Values.pim_attr_link_generator.enabled }}
apiVersion: batch/v1
kind: CronJob
metadata:
  name: pim-attr-link-generator
spec:
  schedule: "{{ .Values.pim_attr_link_generator.schedule }}"
  jobTemplate:
    spec:
      ttlSecondsAfterFinished: 600
      backoffLimit: 1
      template:
        spec:
          imagePullSecrets:
          - name: regcred
          containers:
          - name: model
            image: goalprofit/pim-attr-link-generator:{{ .Values.pim_attr_link_generator.version }}
            imagePullPolicy: Always
            env:
              - name: SERVICE_LOGIN
                valueFrom:
                  secretKeyRef:
                    name: secret-admin
                    key: username
                    optional: false
              - name: SERVICE_PASSWORD
                valueFrom:
                  secretKeyRef:
                    name: secret-admin
                    key: password
                    optional: false
          restartPolicy: Never
          {{ include "app.affinity" . | nindent 10}}
{{ end }}