apiVersion: batch/v1
kind: CronJob
metadata:
  name: blog-kc-rebuild-job
  namespace: blog-kc-system
spec:
  # Run daily at 1AM
  schedule: "0 1 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: rebuild
            image: curlimages/curl
            imagePullPolicy: IfNotPresent
            command:
            - /bin/sh
            - -c
            - /curl-trigger.sh
            volumeMounts:
            - name: blog-kc-timezone-host
              mountPath: /etc/timezone
              readOnly: true
            - name: blog-kc-localtime-host
              mountPath: /etc/localtime
              readOnly: true
            - name: curl-trigger-volume
              mountPath: /curl-trigger.sh
              subPath: curl-trigger.sh
              readOnly: true
            envFrom:
            - secretRef:
                name: blog-kc-secrets
            - configMapRef:
                name: blog-kc-config
          restartPolicy: OnFailure
          volumes:
          - name: blog-kc-timezone-host
            hostPath:
              path: /etc/timezone
              type: File
          - name: blog-kc-localtime-host
            hostPath:
              path: /etc/localtime
              type: File
          - name: curl-trigger-volume
            configMap:
              name: blog-kc-curl-trigger-config
              defaultMode: 0777