apiVersion: batch/v1
kind: CronJob
metadata:
  name: etcd-defrag-defrag-2
  labels:
    app.kubernetes.io/controller: defrag-2
    app.kubernetes.io/instance: talos
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: talos
    helm.sh/chart: etcd-defrag-5.0.1
  namespace: talos
spec:
  suspend: false
  concurrencyPolicy: Forbid
  startingDeadlineSeconds: 30
  timeZone: America/Chicago
  schedule: "10 0 * * 0"
  successfulJobsHistoryLimit: 1
  failedJobsHistoryLimit: 1
  jobTemplate:
    spec:
      parallelism: 1
      backoffLimit: 3
      template:
        metadata:
          labels:
            app.kubernetes.io/controller: defrag-2
            app.kubernetes.io/instance: talos
            app.kubernetes.io/name: talos
        spec:
          enableServiceLinks: false
          serviceAccountName: etcd-defrag
          automountServiceAccountToken: true
          hostIPC: false
          hostNetwork: false
          hostPID: false
          dnsPolicy: ClusterFirst
          restartPolicy: Never
          nodeSelector:
            node-role.kubernetes.io/control-plane: ""
          tolerations:
            - effect: NoSchedule
              key: node-role.kubernetes.io/control-plane
              operator: Exists
          containers:
            - args:
                - etcd
                - defrag
                - -n
                - 10.232.1.12
              env:
                - name: TALOSCONFIG
                  value: /tmp/.talos/config
              image: ghcr.io/siderolabs/talosctl:v1.13.2@sha256:6382e6f6f8b08ab7c5cc9f77446cfd79975fe0055c0a6d73455a9dc6a6c4b98d
              name: main
              volumeMounts:
                - mountPath: /tmp/.talos/
                  name: config
                  readOnly: true
          volumes:
            - csi:
                driver: secrets-store.csi.k8s.io
                readOnly: true
                volumeAttributes:
                  secretProviderClass: talos-etcd-defrag-config
              name: config
