Add helper functions for determining workload type
This commit is contained in:
parent
73e0b275cc
commit
ac7af88e7f
|
@ -63,8 +63,36 @@ Create the name of the service account to use
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Name for external interfaces to be added to chart
|
Check if workload type is a deployment
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "externalInterfaceName" -}}
|
{{- define "workloadIsDeployment" }}
|
||||||
{{- printf "ix-%s" $.Release.Name }}
|
{{- if eq .Values.workloadType "Deployment" }}
|
||||||
|
{{- true -}}
|
||||||
|
{{- else }}
|
||||||
|
{{- false -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Check if workload type is a cronjob
|
||||||
|
*/}}
|
||||||
|
{{- define "workloadIsCronJob" }}
|
||||||
|
{{- if eq .Values.workloadType "CronJob" }}
|
||||||
|
{{- true -}}
|
||||||
|
{{- else }}
|
||||||
|
{{- false -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get API Version based on workload type
|
||||||
|
*/}}
|
||||||
|
{{- define "apiVersion" -}}
|
||||||
|
{{- if eq (include "workloadIsDeployment" .) "true" }}
|
||||||
|
{{- printf "apps/v1" }}
|
||||||
|
{{- else if eq (include "workloadIsCronJob" .) "true" }}
|
||||||
|
{{- printf "batch/v1beta1" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "batch/v1" }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: apps/v1
|
apiVersion: {{ template "apiVersion" . }}
|
||||||
kind: {{ .Values.workloadType }}
|
kind: {{ .Values.workloadType }}
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "ix-chart.fullname" . }}
|
name: {{ include "ix-chart.fullname" . }}
|
||||||
|
|
Loading…
Reference in New Issue