Fix restart policy for jobs/cronjobs
This commit is contained in:
parent
ac7af88e7f
commit
557d379c84
|
@ -63,11 +63,22 @@
|
||||||
label: "Restart Policy"
|
label: "Restart Policy"
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
|
show_if: [["workloadType", "=", "Deployment"]]
|
||||||
default: "Always"
|
default: "Always"
|
||||||
enum:
|
enum:
|
||||||
- "Always"
|
- "Always"
|
||||||
- "OnFailure"
|
- "OnFailure"
|
||||||
- "Never"
|
- "Never"
|
||||||
|
- variable: jobRestartPolicy
|
||||||
|
description: "Restart Policy for workload"
|
||||||
|
label: "Restart Policy"
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
default: "OnFailure"
|
||||||
|
show_if: [["workloadType", "!=", "Deployment"]]
|
||||||
|
enum:
|
||||||
|
- "OnFailure"
|
||||||
|
- "Never"
|
||||||
|
|
||||||
# Configurable CMD / Entrypoint / Environment Variables
|
# Configurable CMD / Entrypoint / Environment Variables
|
||||||
- variable: containerCommand
|
- variable: containerCommand
|
||||||
|
|
|
@ -96,3 +96,15 @@ Get API Version based on workload type
|
||||||
{{- printf "batch/v1" }}
|
{{- printf "batch/v1" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get Restart policy based on workload type
|
||||||
|
*/}}
|
||||||
|
{{- define "restartPolicy" -}}
|
||||||
|
{{- if eq (include "workloadIsDeployment" .) "true" }}
|
||||||
|
{{- printf "%s" .Values.restartPolicy }}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "%s" .Values.jobRestartPolicy }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
|
@ -5,13 +5,13 @@ metadata:
|
||||||
labels:
|
labels:
|
||||||
{{- include "ix-chart.labels" . | nindent 4 }}
|
{{- include "ix-chart.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
{{- if eq .Values.workloadType "Deployment" }}
|
{{- if eq (include "workloadIsDeployment" .) "true" }}
|
||||||
strategy:
|
strategy:
|
||||||
type: {{ .Values.updateStrategy }}
|
type: {{ .Values.updateStrategy }}
|
||||||
{{- end }}
|
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
{{- include "ix-chart.selectorLabels" . | nindent 6 }}
|
{{- include "ix-chart.selectorLabels" . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
|
@ -22,7 +22,7 @@ spec:
|
||||||
k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.ixExternalInterfacesConfigurationNames }}
|
k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.ixExternalInterfacesConfigurationNames }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
restartPolicy: {{ .Values.restartPolicy | quote }}
|
restartPolicy: {{ template "restartPolicy" . }}
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}
|
||||||
{{- if or .Values.hostPathVolumes .Values.persistentVolumeClaims }}
|
{{- if or .Values.hostPathVolumes .Values.persistentVolumeClaims }}
|
||||||
|
|
|
@ -6,9 +6,6 @@ image:
|
||||||
# Overrides the image tag whose default is the chart appVersion.
|
# Overrides the image tag whose default is the chart appVersion.
|
||||||
tag: "testing"
|
tag: "testing"
|
||||||
|
|
||||||
# Restart Policy
|
|
||||||
restartPolicy: "Always"
|
|
||||||
|
|
||||||
# Container CMD / entrypoint
|
# Container CMD / entrypoint
|
||||||
containerCommand: []
|
containerCommand: []
|
||||||
containerArgs: []
|
containerArgs: []
|
||||||
|
|
Loading…
Reference in New Issue