mirror of
https://github.com/truenas/charts.git
synced 2026-06-18 01:26:53 +08:00
"plumb" the job "controller"
This commit is contained in:
@@ -3,3 +3,10 @@ service:
|
||||
ports:
|
||||
main:
|
||||
port: 65535
|
||||
|
||||
# controller:
|
||||
# type: Job
|
||||
|
||||
# cron:
|
||||
# enabled: true
|
||||
# schedule: "* * * * *"
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
{{- include "ix.v1.common.daemonset" . | nindent 0 -}}
|
||||
{{- else if eq .Values.controller.type "StatefulSet" -}}
|
||||
{{- include "ix.v1.common.statefulset" . | nindent 0 -}}
|
||||
{{- else if eq .Values.controller.type "Job" -}}
|
||||
{{/* Pass, it will render from the spawner.jobAndCronJob bellow */}}
|
||||
{{- else -}}
|
||||
{{- fail (printf "Not a valid controller.type (%s). Valid options are Deployment, DaemonSet, StatefulSet" .Values.controller.type) -}}
|
||||
{{- fail (printf "Not a valid controller.type (%s). Valid options are Deployment, DaemonSet, StatefulSet, Job" .Values.controller.type) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
{{- define "ix.v1.common.spawner.jobAndCronJob" -}}
|
||||
{{- range $jobName, $job := .Values.jobs -}}
|
||||
{{- $jobs := dict -}}
|
||||
|
||||
{{- if eq .Values.controller.type "Job" -}}
|
||||
{{- $jobValues := dict -}}
|
||||
|
||||
{{- $_ := set $jobValues "enabled" true -}}
|
||||
{{- $_ := set $jobValues "podSpec" dict -}}
|
||||
|
||||
{{- if hasKey .Values "cron" -}}
|
||||
{{- $_ := set $jobValues "cron" .Values.cron -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $_ := set $jobValues.podSpec "containers" dict -}}
|
||||
{{- $_ := set $jobValues.podSpec.containers "main" .Values -}}
|
||||
{{- $_ := set $jobValues.podSpec.containers.main "enabled" "true" -}}
|
||||
|
||||
{{- $_ := unset $jobValues.podSpec.containers.main "probes" -}}
|
||||
{{- $_ := unset $jobValues.podSpec.containers.main "lifecycle" -}}
|
||||
|
||||
{{- if not $jobValues.nameOverride -}}
|
||||
{{- $_ := set $jobValues "nameOverride" (include "ix.v1.common.names.fullname" $) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $_ := set $jobs "main" $jobValues -}}
|
||||
{{- else -}}
|
||||
{{- $jobs = .Values.jobs -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $jobName, $job := $jobs -}}
|
||||
{{- if $job.enabled -}}
|
||||
|
||||
{{- $jobValues := $job -}}
|
||||
|
||||
Reference in New Issue
Block a user