From 2f52899595fd265d622108f17df6698c2071de3c Mon Sep 17 00:00:00 2001 From: Simon Emms Date: Wed, 16 Mar 2022 09:23:24 +0000 Subject: [PATCH] [installer]: allow for minified config YAML The regex for the `apiVersion` errored if the YAML was minified, which is what we're using in KOTS installation job. --- install/installer/pkg/config/loader.go | 3 ++- install/kots/manifests/gitpod-installer-job.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/install/installer/pkg/config/loader.go b/install/installer/pkg/config/loader.go index b8485f5c22105b..ab956da253bd5b 100644 --- a/install/installer/pkg/config/loader.go +++ b/install/installer/pkg/config/loader.go @@ -105,7 +105,8 @@ func Load(overrideConfig string) (cfg interface{}, version string, err error) { // `apiVersion: vx` line is removed from config since the version dependant // Config structure doesn't have that field - apiVersionRegexp := regexp.MustCompile(`apiVersion: .+\n`) + // The line-ending is either comma (minified YAML) or newline (unminified) + apiVersionRegexp := regexp.MustCompile(`apiVersion: ` + apiVersion + `(,|\n)`) overrideConfig = apiVersionRegexp.ReplaceAllString(overrideConfig, "") // Override passed configuration onto the default diff --git a/install/kots/manifests/gitpod-installer-job.yaml b/install/kots/manifests/gitpod-installer-job.yaml index fd559177601cde..b52cfce7f0a2b8 100644 --- a/install/kots/manifests/gitpod-installer-job.yaml +++ b/install/kots/manifests/gitpod-installer-job.yaml @@ -21,7 +21,7 @@ spec: containers: - name: installer # This will normally be the release tag - using this tag as need the license evaluator - image: 'eu.gcr.io/gitpod-core-dev/build/installer:sje-kots-helm.7' + image: 'eu.gcr.io/gitpod-core-dev/build/installer:sje-installer-mini-config.0' volumeMounts: - mountPath: /config-patch name: config-patch @@ -171,6 +171,7 @@ spec: appVersion: "$(/app/installer version | yq e '.version' -)" EOF + echo "Gitpod: render Kubernetes manifests" /app/installer render -c "${CONFIG_FILE}" --namespace {{repl Namespace }} > "${GITPOD_OBJECTS}/templates/gitpod.yaml" # Workaround for #8532 and #8529