From abb00e97fdea1d986948d7b71e0ea905cbb5325b Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Fri, 15 Jun 2018 19:33:33 -0500 Subject: [PATCH] Gotpl: remove quote and trunc to suppress output This PS removes the use of the `quote and truncate` approach to suppress output from gotpl actions in templates and replaces it with the recommended practice of defining `$_` instead. Change-Id: I5fedc3471dcbecef37d2fe1302bf9760b3163467 Signed-off-by: Pete Birley --- calico/templates/bin/_calico-settings.sh.tpl | 2 +- calico/templates/configmap-etc.yaml | 4 ++-- calico/templates/daemonset-calico-node.yaml | 6 +++--- grafana/templates/configmap-etc.yaml | 4 ++-- prometheus/templates/configmap-etc.yaml | 2 +- registry/templates/configmap-etc.yaml | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/calico/templates/bin/_calico-settings.sh.tpl b/calico/templates/bin/_calico-settings.sh.tpl index 641a50cdb..c08a95129 100644 --- a/calico/templates/bin/_calico-settings.sh.tpl +++ b/calico/templates/bin/_calico-settings.sh.tpl @@ -3,7 +3,7 @@ set -eux {{ if empty .Values.conf.node.CALICO_IPV4POOL_CIDR }} -{{ set .Values.conf.node "CALICO_IPV4POOL_CIDR" .Values.networking.podSubnet | quote | trunc 0 }} +{{ $_ := set .Values.conf.node "CALICO_IPV4POOL_CIDR" .Values.networking.podSubnet }} {{ end }} # An idempotent script for interacting with calicoctl to instantiate diff --git a/calico/templates/configmap-etc.yaml b/calico/templates/configmap-etc.yaml index 7549546dc..39629f090 100644 --- a/calico/templates/configmap-etc.yaml +++ b/calico/templates/configmap-etc.yaml @@ -23,9 +23,9 @@ limitations under the License. # MTU to account for IPIP overhead unless explicty turned off. */}} {{- if eq .Values.conf.node.CALICO_IPV4POOL_IPIP "off" -}} -{{- set .Values.conf.cni_network_config "mtu" .Values.networking.mtu | quote | trunc 0 -}} +{{- $_ := set .Values.conf.cni_network_config "mtu" .Values.networking.mtu -}} {{- else -}} -{{- set .Values.conf.cni_network_config "mtu" (sub .Values.networking.mtu 20) | quote | trunc 0 -}} +{{- $_ := set .Values.conf.cni_network_config "mtu" (sub .Values.networking.mtu 20) -}} {{- end -}} {{- end -}} diff --git a/calico/templates/daemonset-calico-node.yaml b/calico/templates/daemonset-calico-node.yaml index b4caf1ea8..194e38d2c 100644 --- a/calico/templates/daemonset-calico-node.yaml +++ b/calico/templates/daemonset-calico-node.yaml @@ -18,7 +18,7 @@ limitations under the License. {{- $envAll := . }} {{- if empty .Values.conf.node.CALICO_IPV4POOL_CIDR -}} -{{- set .Values.conf.node "CALICO_IPV4POOL_CIDR" .Values.networking.podSubnet | quote | trunc 0 -}} +{{- $_ := set .Values.conf.node "CALICO_IPV4POOL_CIDR" .Values.networking.podSubnet -}} {{- end -}} {{- if empty .Values.conf.node.FELIX_IPINIPMTU -}} @@ -27,9 +27,9 @@ limitations under the License. # MTU to account for IPIP overhead unless explicty turned off. */}} {{- if eq .Values.conf.node.CALICO_IPV4POOL_IPIP "off" -}} -{{- set .Values.conf.node "FELIX_IPINIPMTU" .Values.networking.mtu | quote | trunc 0 -}} +{{- $_ := set .Values.conf.node "FELIX_IPINIPMTU" .Values.networking.mtu -}} {{- else -}} -{{- set .Values.conf.node "FELIX_IPINIPMTU" (sub .Values.networking.mtu 20) | quote | trunc 0 -}} +{{- $_ := set .Values.conf.node "FELIX_IPINIPMTU" (sub .Values.networking.mtu 20) -}} {{- end -}} {{- end -}} diff --git a/grafana/templates/configmap-etc.yaml b/grafana/templates/configmap-etc.yaml index 4a05f637f..646d95fd8 100644 --- a/grafana/templates/configmap-etc.yaml +++ b/grafana/templates/configmap-etc.yaml @@ -18,7 +18,7 @@ limitations under the License. {{- $envAll := . }} {{- if and (empty .Values.conf.grafana.database.url) (not (eq .Values.conf.grafana.database.type "sqlite3") ) -}} -{{- tuple "oslo_db" "internal" "user" "mysql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | replace "mysql+pymysql://" "mysql://" | set .Values.conf.grafana.database "url" | quote | trunc 0 -}} +{{- $_ := tuple "oslo_db" "internal" "user" "mysql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | replace "mysql+pymysql://" "mysql://" | set .Values.conf.grafana.database "url" }} {{- end -}} {{- if empty .Values.conf.grafana.session.provider_config -}} @@ -26,7 +26,7 @@ limitations under the License. {{- $pass := .Values.endpoints.oslo_db_session.auth.user.password }} {{- $host_port := tuple "oslo_db_session" "internal" "mysql" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" }} {{- $path := .Values.endpoints.oslo_db_session.path }} -{{- printf "%s:%s%s(%s)%s" $user $pass "@tcp" $host_port $path | set .Values.conf.grafana.session "provider_config" | quote | trunc 0 -}} +{{- $_ := printf "%s:%s%s(%s)%s" $user $pass "@tcp" $host_port $path | set .Values.conf.grafana.session "provider_config" }} {{- end -}} --- diff --git a/prometheus/templates/configmap-etc.yaml b/prometheus/templates/configmap-etc.yaml index 0f203faea..608e82b0c 100644 --- a/prometheus/templates/configmap-etc.yaml +++ b/prometheus/templates/configmap-etc.yaml @@ -25,7 +25,7 @@ limitations under the License. {{- $__rule_files := append $envAll.Values.__rule_files $rulesFile }} {{- $_ := set $envAll.Values "__rule_files" $__rule_files }} {{ end }} -{{- set .Values.conf.prometheus.scrape_configs "rule_files" $envAll.Values.__rule_files | quote | trunc 0 -}} +{{- $_ := set .Values.conf.prometheus.scrape_configs "rule_files" $envAll.Values.__rule_files -}} {{- end -}} --- diff --git a/registry/templates/configmap-etc.yaml b/registry/templates/configmap-etc.yaml index dc39a97cc..6137d5aa8 100644 --- a/registry/templates/configmap-etc.yaml +++ b/registry/templates/configmap-etc.yaml @@ -18,11 +18,11 @@ limitations under the License. {{- $envAll := . }} {{- if empty .Values.conf.registry.http.addr -}} -{{ cat "0.0.0.0" (tuple "docker_registry" "internal" "registry" . | include "helm-toolkit.endpoints.endpoint_port_lookup") | replace " " ":" | set .Values.conf.registry.http "addr" | quote | trunc 0 -}} +{{ $_ := cat "0.0.0.0" (tuple "docker_registry" "internal" "registry" . | include "helm-toolkit.endpoints.endpoint_port_lookup") | replace " " ":" | set .Values.conf.registry.http "addr" -}} {{- end -}} {{- if empty .Values.conf.registry.redis.addr -}} -{{ tuple "redis" "internal" "redis" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set .Values.conf.registry.redis "addr" | quote | trunc 0 -}} +{{ $_ := tuple "redis" "internal" "redis" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | set .Values.conf.registry.redis "addr" -}} {{- end -}} ---