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 <pete@port.direct>
This commit is contained in:
Pete Birley 2018-06-15 19:33:33 -05:00
parent 655f171a7a
commit abb00e97fd
6 changed files with 11 additions and 11 deletions

View File

@ -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

View File

@ -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 -}}

View File

@ -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 -}}

View File

@ -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 -}}
---

View File

@ -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 -}}
---

View File

@ -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 -}}
---