From 6776dadd67a6639c8ad6cb5e4bac595360b3f1d8 Mon Sep 17 00:00:00 2001 From: sonicaj Date: Tue, 24 Aug 2021 20:25:02 +0500 Subject: [PATCH] Generate host networking configuration separately --- test/ix-chart/2108.0.0/templates/_networking.tpl | 13 +++++++++++++ test/ix-chart/2108.0.0/templates/_workload.tpl | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/test/ix-chart/2108.0.0/templates/_networking.tpl b/test/ix-chart/2108.0.0/templates/_networking.tpl index 79a1a325d1..0c93117cbc 100644 --- a/test/ix-chart/2108.0.0/templates/_networking.tpl +++ b/test/ix-chart/2108.0.0/templates/_networking.tpl @@ -8,3 +8,16 @@ dnsConfig: {{- toYaml .Values.dnsConfig | nindent 2 }} {{- end }} {{- end }} + + +{{/* +Get configuration for host network +*/}} +{{- define "hostNetworkingConfiguration" -}} +{{- $host := default false .Values.hostNetwork -}} +{{- if or .Values.externalInterfaces (eq $host false) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} diff --git a/test/ix-chart/2108.0.0/templates/_workload.tpl b/test/ix-chart/2108.0.0/templates/_workload.tpl index 344adeda74..6f01bd382f 100644 --- a/test/ix-chart/2108.0.0/templates/_workload.tpl +++ b/test/ix-chart/2108.0.0/templates/_workload.tpl @@ -51,7 +51,7 @@ Pod specification */}} {{- define "podSepc" }} restartPolicy: {{ template "restartPolicy" . }} -hostNetwork: {{ .Values.hostNetwork }} +hostNetwork: {{ template "hostNetworkingConfiguration" . }} containers: - name: {{ .Chart.Name }} {{- include "volumeMountsConfiguration" . | indent 2}}