apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: api-public
spec:
  schedule: '0 10 * * *' # 2am pst
  startingDeadlineSeconds: 60
  failedJobsHistoryLimit: 0
  successfulJobsHistoryLimit: 0
  concurrencyPolicy: Forbid
  jobTemplate:
    metadata:
      labels:
        role: api-public
    spec:
      template:
        metadata:
          labels:
            role: api-public
        spec:
          hostNetwork: true
          dnsPolicy: ClusterFirstWithHostNet
          restartPolicy: Never
          serviceAccountName: system
          containers:
            - name: kubectl
              image: lachlanevenson/k8s-kubectl:latest
              args:
                - patch
                - deployment
                - api-public
                - -p
                - "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"restart\":\"$(HOSTNAME)\"}}}}}"