From 2c5e6714017ceae8d1b2f83ef91508f8a78272a4 Mon Sep 17 00:00:00 2001 From: Simon Emms Date: Fri, 18 Mar 2022 20:19:44 +0000 Subject: [PATCH] [kots]: escape golang template variables for Helm resources Helm parses Golang template variables when rendering the Kubernetes objects. For the ws-manager config (and potentially others), this breaks as this includes Golang template variables which is interpolated at runtime. Helm allows for escaping of Golang template variables if wrapped in "{{``}}". The sed command searches for any line containing "{{" and escapes it. --- install/kots/manifests/gitpod-installer-job.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install/kots/manifests/gitpod-installer-job.yaml b/install/kots/manifests/gitpod-installer-job.yaml index 90fa5debdd9dc3..ea4a1a663cd1e2 100644 --- a/install/kots/manifests/gitpod-installer-job.yaml +++ b/install/kots/manifests/gitpod-installer-job.yaml @@ -167,7 +167,7 @@ spec: apiVersion: v2 name: gitpod-kots description: Always ready-to-code - Version: "1.0.0" + version: "1.0.0" appVersion: "$(/app/installer version | yq e '.version' -)" EOF @@ -180,6 +180,9 @@ spec: 'del(select(.kind == "StatefulSet" and .metadata.name == "openvsx-proxy").status)' \ "${GITPOD_OBJECTS}/templates/gitpod.yaml" + echo "Gitpod: Escape any Golang template values" + sed -i -r 's/(.*\{\{.*)/{{`\1`}}/' "${GITPOD_OBJECTS}/templates/gitpod.yaml" + # The long timeout is to ensure the TLS cert is created (if required) echo "Gitpod: Apply the Kubernetes objects" helm upgrade \