blob: 2f446adcb377ed1073823480ef531e3553e307da [file] [log] [blame]
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ .Release.Name }}-git-gc
labels:
app: git-gc
chart: {{ template "gerrit.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
schedule: {{ .Values.gitGC.schedule | quote }}
concurrencyPolicy: "Forbid"
jobTemplate:
spec:
template:
metadata:
labels:
app: git-gc
chart: {{ template "gerrit.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
{{- with .Values.gitGC.tolerations }}
tolerations:
{{- toYaml . | nindent 10 }}
{{- end }}
restartPolicy: OnFailure
securityContext:
runAsUser: 1000
fsGroup: 100
{{ if .Values.images.registry.ImagePullSecret.name -}}
imagePullSecrets:
- name: {{ .Values.images.registry.ImagePullSecret.name }}
{{- range .Values.images.additionalImagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
containers:
- name: git-gc
imagePullPolicy: {{ .Values.images.imagePullPolicy }}
image: {{ template "registry" . }}{{ .Values.gitGC.image }}:{{ .Values.images.version }}
resources:
{{ toYaml .Values.gitGC.resources | indent 14 }}
volumeMounts:
- name: git-repositories
mountPath: "/var/gerrit/git"
- name: git-gc-logs
mountPath: "/var/log/git"
volumes:
- name: git-repositories
persistentVolumeClaim:
{{- if .Values.gitRepositoryStorage.externalPVC.use }}
claimName: {{ .Values.gitRepositoryStorage.externalPVC.name }}
{{- else }}
claimName: {{ .Release.Name }}-git-repositories-pvc
{{- end }}
- name: git-gc-logs
{{ if .Values.gitGC.logging.persistence.enabled -}}
persistentVolumeClaim:
claimName: {{ .Release.Name }}-git-gc-logs-pvc
{{ else -}}
emptyDir: {}
{{- end }}