make some if statements better

This commit is contained in:
Stavros kois
2022-11-24 18:05:20 +02:00
parent 71aa458e8f
commit a71bd239b4
6 changed files with 7 additions and 7 deletions

View File

@@ -65,7 +65,7 @@ ports:
- port: {{ $port.port }}
targetPort: {{ $port.targetPort | default $name }}
{{- if $port.protocol -}}
{{- if or (eq $port.protocol "HTTP") (eq $port.protocol "HTTPS") (eq $port.protocol "TCP") }}
{{- if has $port.protocol (list "HTTP" "HTTPS" "TCP") }}
protocol: TCP
{{- else }}
protocol: {{ $port.protocol }}
@@ -79,7 +79,7 @@ ports:
{{- end }}
{{- end -}}
{{- end -}}
{{- if and (ne $svcType "ExternalName") (ne $svcType "ExternalIP") }}
{{- if not (has $svcType (list "ExternalName" "ExternalIP")) }}
selector:
{{- with $svcValues.selector }}
{{/*TODO: */}}

View File

@@ -22,7 +22,7 @@ That's why the custom dict is expected.
{{- end }}
- name: {{ $name | quote }}
{{- if not (kindIs "map" $value) -}}
{{- if or (kindIs "string" $value) -}} {{/* Single values are parsed as string (eg. int, bool) */}}
{{- if kindIs "string" $value -}} {{/* Single values are parsed as string (eg. int, bool) */}}
{{- $value = tpl $value $root -}} {{/* Expand Value */}}
{{- end }}
value: {{ quote $value }}

View File

@@ -28,7 +28,7 @@ can be dynamically configured via an env var.
{{- end }}
containerPort: {{ default .port .targetPort }}
{{- with .protocol }}
{{- if or (eq . "HTTP") (eq . "HTTPS") (eq . "TCP") }}
{{- if has . (list "HTTP" "HTTPS" "TCP") }}
protocol: TCP
{{- else if (eq . "UDP") }}
protocol: UDP

View File

@@ -7,7 +7,7 @@
{{- define "ix.v1.common.container.termination.messagePolicy" -}}
{{- $policy := (tpl .Values.termination.messagePolicy $) -}}
{{- with $policy -}}
{{- if and (ne . "File") (ne . "FallbackToLogsOnError") }}
{{- if not (has . (list "File" "FallbackToLogsOnError")) }}
{{- fail "Not valid option for messagePolicy" -}}
{{- end }}
{{- $policy }}

View File

@@ -47,7 +47,7 @@ you can specify a size for memory backed volumes.
sizeLimit: {{ tpl . $ }}
{{- end }}
{{- end }}
{{- else if or (eq $persistence.type "configMap") (eq $persistence.type "secret") }}
{{- else if has $persistence.type (list "configMap" "secret") }}
{{- $objectName := (required (printf "objectName not set for persistence item %s" (toString $index)) $persistence.objectName) }}
{{- $objectName = tpl $objectName $ }}
{{- if eq $persistence.type "configMap" }} {{/* configMap */}}

View File

@@ -18,7 +18,7 @@ spec:
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }}
replicas: {{ .Values.controller.replicas }}
{{- $strategy := default "Recreate" .Values.controller.strategy }}
{{- if and (ne $strategy "Recreate") (ne $strategy "RollingUpdate") }}
{{- if not (has $strategy (list "Recreate" "RollingUpdate")) }}
{{- fail (printf "Not a valid strategy type for Deployment (%s)" $strategy) }}
{{- end }}
strategy: