apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: aws-registry-credential-cron
spec:
  # Every 6 hours
  schedule: "* */6 * * *"
  successfulJobsHistoryLimit: 2
  failedJobsHistoryLimit: 2
  jobTemplate:
    spec:
      backoffLimit: 4
      template:
        spec:
          serviceAccountName: ecr-update-service-account
          terminationGracePeriodSeconds: 0
          restartPolicy: Never
          containers:
          - name: kubectl
            imagePullPolicy: Always
            image: frekele/aws-ecr-kubectl:stable
            command:
              - "/run.sh"
            env:
              - name: AWS_ACCOUNT
                value: "YOUR-AWS-ACCOUNT"
              - name: AWS_REGION
                value: "YOUR-AWS-REGION"
              - name: NAMESPACES
                value: "infrastructure default XXXXXXX"
              - name: AWS_ACCESS_KEY_ID
                valueFrom:
                  secretKeyRef:
                    name: aws-secrets
                    key: aws-access-key-id
              - name: AWS_SECRET_ACCESS_KEY
                valueFrom:
                  secretKeyRef:
                    name: aws-secrets
                    key: aws-secret-access-key
