2022-02-13 12:08:40 +00:00
|
|
|
{{/* Define the cronjob */}}
|
|
|
|
{{- define "linkace.cronjob" -}}
|
|
|
|
{{- if .Values.secret.CRON_TOKEN }}
|
2023-12-15 21:41:48 +00:00
|
|
|
{{- $jobName := include "tc.v1.common.names.fullname" . }}
|
2022-02-13 12:08:40 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
apiVersion: batch/v1
|
|
|
|
kind: CronJob
|
|
|
|
metadata:
|
|
|
|
name: {{ printf "%s-cronjob" $jobName }}
|
|
|
|
labels:
|
2023-12-16 00:13:05 +00:00
|
|
|
|
2022-02-13 12:08:40 +00:00
|
|
|
spec:
|
|
|
|
schedule: "{{ .Values.cronjob.schedule }}"
|
|
|
|
concurrencyPolicy: Forbid
|
|
|
|
{{- with .Values.cronjob.failedJobsHistoryLimit }}
|
|
|
|
failedJobsHistoryLimit: {{ . }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.cronjob.successfulJobsHistoryLimit }}
|
|
|
|
successfulJobsHistoryLimit: {{ . }}
|
|
|
|
{{- end }}
|
|
|
|
jobTemplate:
|
|
|
|
metadata:
|
|
|
|
spec:
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
spec:
|
|
|
|
securityContext:
|
|
|
|
runAsUser: 568
|
|
|
|
runAsGroup: 568
|
|
|
|
restartPolicy: Never
|
|
|
|
containers:
|
|
|
|
- name: {{ .Chart.Name }}
|
|
|
|
securityContext:
|
|
|
|
privileged: false
|
|
|
|
readOnlyRootFilesystem: true
|
|
|
|
allowPrivilegeEscalation: false
|
|
|
|
runAsNonRoot: true
|
|
|
|
capabilities:
|
|
|
|
drop:
|
|
|
|
- ALL
|
|
|
|
env:
|
|
|
|
- name: CRON_TOKEN
|
|
|
|
value: {{ .Values.secret.CRON_TOKEN }}
|
2022-11-05 13:02:40 +00:00
|
|
|
image: "{{ .Values.ubuntuImage.repository }}:{{ .Values.ubuntuImage.tag }}"
|
2022-02-13 12:08:40 +00:00
|
|
|
args:
|
|
|
|
- curl
|
|
|
|
- "http://{{ $jobName }}.ix-{{ .Release.Name }}.svc.cluster.local:{{ .Values.service.main.ports.main.port }}/cron/$(CRON_TOKEN)"
|
|
|
|
resources:
|
|
|
|
{{ toYaml .Values.resources | indent 16 }}
|
|
|
|
|
|
|
|
{{- end -}}
|
|
|
|
{{- end }}
|