112 lines
4.1 KiB
YAML
112 lines
4.1 KiB
YAML
|
|
{{- if eq .Values.kind "CronJob" }}
|
||
|
|
apiVersion: {{ .Values.cronJobApiVersion | default "batch/v1" }}
|
||
|
|
kind: CronJob
|
||
|
|
metadata:
|
||
|
|
name: {{ template "descheduler.fullname" . }}
|
||
|
|
namespace: {{ include "descheduler.namespace" . }}
|
||
|
|
labels:
|
||
|
|
{{- include "descheduler.labels" . | nindent 4 }}
|
||
|
|
spec:
|
||
|
|
schedule: {{ .Values.schedule | quote }}
|
||
|
|
{{- if .Values.suspend }}
|
||
|
|
suspend: {{ .Values.suspend }}
|
||
|
|
{{- end }}
|
||
|
|
concurrencyPolicy: "Forbid"
|
||
|
|
{{- if .Values.startingDeadlineSeconds }}
|
||
|
|
startingDeadlineSeconds: {{ .Values.startingDeadlineSeconds }}
|
||
|
|
{{- end }}
|
||
|
|
{{- if ne .Values.successfulJobsHistoryLimit nil }}
|
||
|
|
successfulJobsHistoryLimit: {{ .Values.successfulJobsHistoryLimit }}
|
||
|
|
{{- end }}
|
||
|
|
{{- if ne .Values.failedJobsHistoryLimit nil }}
|
||
|
|
failedJobsHistoryLimit: {{ .Values.failedJobsHistoryLimit }}
|
||
|
|
{{- end }}
|
||
|
|
{{- if .Values.timeZone }}
|
||
|
|
timeZone: {{ .Values.timeZone }}
|
||
|
|
{{- end }}
|
||
|
|
jobTemplate:
|
||
|
|
spec:
|
||
|
|
{{- if .Values.ttlSecondsAfterFinished }}
|
||
|
|
ttlSecondsAfterFinished: {{ .Values.ttlSecondsAfterFinished }}
|
||
|
|
{{- end }}
|
||
|
|
template:
|
||
|
|
metadata:
|
||
|
|
name: {{ template "descheduler.fullname" . }}
|
||
|
|
annotations:
|
||
|
|
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||
|
|
{{- if .Values.podAnnotations }}
|
||
|
|
{{- .Values.podAnnotations | toYaml | nindent 12 }}
|
||
|
|
{{- end }}
|
||
|
|
labels:
|
||
|
|
{{- include "descheduler.selectorLabels" . | nindent 12 }}
|
||
|
|
{{- if .Values.podLabels }}
|
||
|
|
{{- .Values.podLabels | toYaml | nindent 12 }}
|
||
|
|
{{- end }}
|
||
|
|
spec:
|
||
|
|
{{- with .Values.nodeSelector }}
|
||
|
|
nodeSelector:
|
||
|
|
{{- toYaml . | nindent 12 }}
|
||
|
|
{{- end }}
|
||
|
|
{{- with .Values.affinity }}
|
||
|
|
affinity:
|
||
|
|
{{- toYaml . | nindent 12 }}
|
||
|
|
{{- end }}
|
||
|
|
{{- with .Values.topologySpreadConstraints }}
|
||
|
|
topologySpreadConstraints:
|
||
|
|
{{- toYaml . | nindent 12 }}
|
||
|
|
{{- end }}
|
||
|
|
{{- if .Values.dnsConfig }}
|
||
|
|
dnsConfig:
|
||
|
|
{{- .Values.dnsConfig | toYaml | nindent 12 }}
|
||
|
|
{{- end }}
|
||
|
|
{{- with .Values.tolerations }}
|
||
|
|
tolerations:
|
||
|
|
{{- toYaml . | nindent 12 }}
|
||
|
|
{{- end }}
|
||
|
|
{{- if .Values.priorityClassName }}
|
||
|
|
priorityClassName: {{ .Values.priorityClassName }}
|
||
|
|
{{- end }}
|
||
|
|
serviceAccountName: {{ template "descheduler.serviceAccountName" . }}
|
||
|
|
restartPolicy: "Never"
|
||
|
|
{{- with .Values.imagePullSecrets }}
|
||
|
|
imagePullSecrets:
|
||
|
|
{{- toYaml . | nindent 10 }}
|
||
|
|
{{- end }}
|
||
|
|
containers:
|
||
|
|
- name: {{ .Chart.Name }}
|
||
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "v%s" .Chart.AppVersion) }}"
|
||
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||
|
|
command:
|
||
|
|
{{- toYaml .Values.command | nindent 16 }}
|
||
|
|
args:
|
||
|
|
- --policy-config-file=/policy-dir/policy.yaml
|
||
|
|
{{- range $key, $value := .Values.cmdOptions }}
|
||
|
|
{{- if ne $value nil }}
|
||
|
|
- {{ printf "--%s=%s" $key (toString $value) }}
|
||
|
|
{{- else }}
|
||
|
|
- {{ printf "--%s" $key }}
|
||
|
|
{{- end }}
|
||
|
|
{{- end }}
|
||
|
|
livenessProbe:
|
||
|
|
{{- toYaml .Values.livenessProbe | nindent 16 }}
|
||
|
|
ports:
|
||
|
|
{{- toYaml .Values.ports | nindent 16 }}
|
||
|
|
resources:
|
||
|
|
{{- toYaml .Values.resources | nindent 16 }}
|
||
|
|
{{- if .Values.securityContext }}
|
||
|
|
securityContext:
|
||
|
|
{{- toYaml .Values.securityContext | nindent 16 }}
|
||
|
|
{{- end }}
|
||
|
|
volumeMounts:
|
||
|
|
- mountPath: /policy-dir
|
||
|
|
name: policy-volume
|
||
|
|
{{- if .Values.podSecurityContext }}
|
||
|
|
securityContext:
|
||
|
|
{{- toYaml .Values.podSecurityContext | nindent 12 }}
|
||
|
|
{{- end }}
|
||
|
|
volumes:
|
||
|
|
- name: policy-volume
|
||
|
|
configMap:
|
||
|
|
name: {{ template "descheduler.fullname" . }}
|
||
|
|
{{- end }}
|