diff options
author | Borislav Glozman <Borislav.Glozman@amdocs.com> | 2020-02-02 13:32:41 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-02-02 13:32:41 +0000 |
commit | e328b5616a196dee6db02a89441ac83ed88817dd (patch) | |
tree | 4f42d8bb974b9fbd8e30592938f8b4fce7f4deb2 /kubernetes/common | |
parent | f41e2c488b8ec1a5383bfae264012ed6dba17ade (diff) | |
parent | 3e875fccc2b3c655e4612f365361bcb79993fa5c (diff) |
Merge "Add override flag to the ingress template"
Diffstat (limited to 'kubernetes/common')
-rw-r--r-- | kubernetes/common/common/templates/_ingress.tpl | 23 |
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 |