{{- if and .Values.cronJob.enabled (not (empty .Values.repositories)) -}} apiVersion: batch/v1 kind: CronJob metadata: name: {{ printf "%s-autoupdate" (include "code-server.fullname" .) }} labels: {{- include "code-server.labels" . | nindent 4 }} {{- with .Values.cronJob.labels }} {{ toYaml . | indent 4 }} {{- end }} {{- with .Values.cronJob.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: schedule: {{ .Values.cronJob.schedule }} suspend: {{ .Values.cronJob.suspend }} concurrencyPolicy: Forbid successfulJobsHistoryLimit: {{ .Values.cronJob.successfulJobsHistoryLimit }} failedJobsHistoryLimit: {{ .Values.cronJob.failedJobsHistoryLimit }} jobTemplate: {{- with .Values.cronJob.annotations }} metadata: annotations: {{- toYaml . | nindent 8 }} {{- end }} spec: template: spec: restartPolicy: Never containers: - name: {{ printf "%s-repositories" (include "code-server.fullname" $) }} image: alpine/git:latest imagePullPolicy: IfNotPresent workingDir: {{ .Values.persistentVolumeClaim.projectsPath }} command: ['/bin/sh'] args: ['/scripts/repo-updater.sh'] volumeMounts: - name: script-volume mountPath: /scripts - name: {{ include "base.persistence.suffix" (include "code-server.fullname" . ) }} mountPath: {{ .Values.persistentVolumeClaim.mountPath }} volumes: {{- if not (empty .Values.repositories) }} - name: script-volume configMap: name: {{ printf "%s-scripts" (include "code-server.fullname" . ) }} defaultMode: 0777 {{- end }} {{- if eq (include "base.persistence.enabled" . ) "true" }} - name: {{ include "base.persistence.suffix" (include "code-server.fullname" . ) }} persistentVolumeClaim: {{- if eq (include "base.persistence.created" . ) "true" }} claimName: {{ include "base.persistence.suffix" (include "code-server.fullname" . ) }} {{- else }} claimName: {{ .Values.persistentVolumeClaim.existingPersistentVolumeClaim }} {{- end }} {{- end }} {{- if .Values.securityContext }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} {{- end }} {{- if .Values.dnsConfig }} dnsConfig: {{- toYaml .Values.dnsConfig | nindent 12 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 12 }} {{- end }} {{- end -}}