Skip to content

Commit

Permalink
[installer]: allow for minified config YAML
Browse files Browse the repository at this point in the history
The regex for the `apiVersion` errored if the YAML was minified, which
is what we're using in KOTS installation job.
  • Loading branch information
Simon Emms authored and roboquat committed Mar 16, 2022
1 parent 9480809 commit 2f52899
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion install/installer/pkg/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion install/kots/manifests/gitpod-installer-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2f52899

Please sign in to comment.