summaryrefslogtreecommitdiffstats
path: root/kubernetes/common
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/common')
-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 7823c544f3..c3c744358c 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