From 48a0c09feae76b1b18bbbfbfeed0f73e5f44b9e0 Mon Sep 17 00:00:00 2001 From: "Anderson, Craig (ca846m)" Date: Mon, 26 Nov 2018 17:03:17 -0800 Subject: [PATCH] Truncate long host names for overrides Long hostnames can cause the 63 char name limit to be exceeded. Truncate the hostname if hostname > 20 char. Change-Id: Ieb7e4dafb41d1fe3ab3d663d2614f75c814afee6 --- helm-toolkit/templates/utils/_daemonset_overrides.tpl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/helm-toolkit/templates/utils/_daemonset_overrides.tpl b/helm-toolkit/templates/utils/_daemonset_overrides.tpl index 8ba22416a..302fcff0d 100644 --- a/helm-toolkit/templates/utils/_daemonset_overrides.tpl +++ b/helm-toolkit/templates/utils/_daemonset_overrides.tpl @@ -38,7 +38,13 @@ limitations under the License. {{- $current_dict := dict }} {{/* set daemonset name */}} - {{- $_ := set $current_dict "name" $host_data.name }} + {{/* Note: long hostnames can cause the 63 char name limit to be + exceeded. Truncate the hostname if hostname > 20 char */}} + {{- if gt (len $host_data.name) 20 }} + {{- $_ := set $current_dict "name" (substr 0 20 $host_data.name) }} + {{- else }} + {{- $_ := set $current_dict "name" $host_data.name }} + {{- end }} {{/* apply overrides */}} {{- $override_conf_copy := $host_data.conf }}