apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: rancher-catalogs-cronjob
spec:
  schedule: "*/1 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: rancher-catalogs-refresh
            image: "{{ .Values.registry.url }}/{{ .Values.registry.hub }}/curlimages/curl"
            imagePullPolicy: IfNotPresent
            args: ['curl', '--insecure', '-v', '-u', '$(CATTLE_ACCESS_KEY):$(CATTLE_SECRET_KEY)', '-X', 'POST', '-H', 'Accept: application/json', '-H', 'Content-Type: application/json', 'https://{{ .Values.rancher.host }}/v3/catalogs/iii-dev-charts3?action=refresh']
            env:
            - name: CATTLE_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: rancher-api-secret
                  key: CATTLE_ACCESS_KEY
            - name: CATTLE_SECRET_KEY
              valueFrom:
                secretKeyRef:
                  name: rancher-api-secret
                  key: CATTLE_SECRET_KEY
          restartPolicy: OnFailure
