{{- if .Values.persistence.enabled }} apiVersion: batch/v1 kind: CronJob metadata: name: git-pages-retention labels: {{- include "git-pages.componentLabels" . | nindent 4 }} spec: schedule: {{ .Values.retention.schedule | quote }} concurrencyPolicy: Forbid successfulJobsHistoryLimit: 3 failedJobsHistoryLimit: 3 jobTemplate: spec: backoffLimit: 1 template: metadata: labels: app.kubernetes.io/name: git-pages-retention app.kubernetes.io/instance: {{ .Release.Name }} spec: serviceAccountName: git-pages-retention restartPolicy: OnFailure containers: - name: retention image: "{{ .Values.retention.image.repository }}:{{ .Values.retention.image.tag }}" imagePullPolicy: {{ .Values.retention.image.pullPolicy }} securityContext: runAsUser: 0 command: - bash - -c - | set -euo pipefail apt-get update -qq apt-get install -y --no-install-recommends curl jq >/dev/null chmod +x /scripts/retention-run.sh /scripts/retention-cleanup.sh /scripts/retention-run.sh env: - name: NAMESPACE value: {{ .Release.Namespace | quote }} - name: DEPLOYMENT value: {{ include "git-pages.fullname" . | quote }} - name: INSTANCE value: {{ .Release.Name | quote }} - name: DATA_ROOT value: /app/data - name: RETENTION_CONFIG value: /etc/retention/retention.json - name: GITEA_API_URL value: {{ required "retention.giteaApiUrl is required" .Values.retention.giteaApiUrl | quote }} - name: GITEA_TOKEN valueFrom: secretKeyRef: name: git-pages-retention-gitea key: token volumeMounts: - name: data mountPath: /app/data - name: scripts mountPath: /scripts - name: config mountPath: /etc/retention volumes: - name: data persistentVolumeClaim: claimName: {{ include "git-pages.fullname" . }}-data - name: scripts configMap: name: git-pages-retention defaultMode: 0755 - name: config configMap: name: git-pages-retention items: - key: retention.json path: retention.json {{- end }}