summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucjan Bryndza <l.bryndza@samsung.com>2020-01-21 11:17:04 +0100
committerKrzysztof Opasiak <k.opasiak@samsung.com>2020-01-23 00:09:03 +0100
commit3e875fccc2b3c655e4612f365361bcb79993fa5c (patch)
tree83207c7cec0ace425e54d0b246641592cdc4f0d5
parent832ef0c7a8aea19c5565dcc073118672e92915db (diff)
Add override flag to the ingress template
Issue-ID: OOM-2267 Change-Id: I0ee8b3bc35d5f71dda6322b35766b3dec105b9c0 Signed-off-by: Lucjan Bryndza <l.bryndza@samsung.com> Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
-rw-r--r--kubernetes/common/common/templates/_ingress.tpl23
1 files changed, 20 insertions, 3 deletions
diff --git a/kubernetes/common/common/templates/_ingress.tpl b/kubernetes/common/common/templates/_ingress.tpl
index b4afe6309d..935e318fc8 100644
--- a/kubernetes/common/common/templates/_ingress.tpl
+++ b/kubernetes/common/common/templates/_ingress.tpl
@@ -1,5 +1,6 @@
{{- define "ingress.config.port" -}}
{{- if .Values.ingress -}}
+{{- if .Values.global.ingress -}}
{{- if or (not .Values.global.ingress.virtualhost) (not .Values.global.ingress.virtualhost.enabled) -}}
- http:
paths:
@@ -27,6 +28,7 @@
{{- end -}}
{{- end -}}
{{- end -}}
+{{- end -}}
{{- define "ingress.config.annotations.ssl" -}}
@@ -55,11 +57,27 @@ nginx.ingress.kubernetes.io/ssl-redirect: "false"
{{ include "ingress.config.annotations.ssl" . | indent 4 | trim }}
{{- end -}}
+{{- define "common.ingress._overrideIfDefined" -}}
+ {{- $currValue := .currVal }}
+ {{- $parent := .parent }}
+ {{- $var := .var }}
+ {{- if $parent -}}
+ {{- if hasKey $parent $var }}
+ {{- default "" (index $parent $var) }}
+ {{- else -}}
+ {{- default "" $currValue -}}
+ {{- end -}}
+ {{- else -}}
+ {{- default "" $currValue }}
+ {{- end -}}
+{{- end -}}
{{- define "common.ingress" -}}
{{- if .Values.ingress -}}
-{{- if .Values.global.ingress -}}
-{{- if and .Values.ingress.enabled .Values.global.ingress.enabled -}}
+ {{- $ingressEnabled := default false .Values.ingress.enabled -}}
+ {{- $ingressEnabled := include "common.ingress._overrideIfDefined" (dict "currVal" $ingressEnabled "parent" (default (dict) .Values.global.ingress) "var" "enabled") }}
+ {{- $ingressEnabled := include "common.ingress._overrideIfDefined" (dict "currVal" $ingressEnabled "parent" .Values.ingress "var" "enabledOverride") }}
+ {{- if $ingressEnabled }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
@@ -81,4 +99,3 @@ spec:
{{- end -}}
{{- end -}}
{{- end -}}
-{{- end -}} \ No newline at end of file