Skip to content

Commit 863bb02

Browse files
Simon Emmsroboquat
Simon Emms
authored andcommitted
[kots]: add Gitpod config patch file as advanced option
Original work by @corneliusludmann
1 parent 4dc5438 commit 863bb02

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: gitpod-config-patch
5+
labels:
6+
app: gitpod
7+
data:
8+
gitpod-config-patch.yaml: '{{repl if and (ConfigOptionEquals "advanced_mode_enabled" "1") (ConfigOptionNotEquals "config_patch" "") }}{{repl ConfigOption "config_patch" }}{{repl else }}{{repl printf "{}" | Base64Encode }}{{repl end }}'

install/kots/manifests/gitpod-installer-job.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ spec:
4545
# This will normally be the release tag - using this tag as need the license evaluator
4646
image: 'eu.gcr.io/gitpod-core-dev/build/installer:main.2569'
4747
volumeMounts:
48+
- mountPath: /config-patch
49+
name: config-patch
50+
readOnly: true
4851
- mountPath: /mnt/node0
4952
name: node-fs0
5053
readOnly: true
5154
env:
5255
- name: CONFIG_FILE
5356
value: /tmp/gitpod-config.yaml
57+
- name: CONFIG_PATCH_FILE
58+
value: /config-patch/gitpod-config-patch.yaml
5459
- name: CONTAINERD_DIR_K3S
5560
value: /run/k3s/containerd/io.containerd.runtime.v2.task/k8s.io
5661
- name: CONTAINERD_SOCKET_K3S
@@ -167,11 +172,23 @@ spec:
167172
yq e -i '.sshGatewayHostKey.name = "ssh-gateway-host-key"' "${CONFIG_FILE}"
168173
fi
169174
175+
echo "Gitpod: Patch Gitpod config"
176+
base64 -d "${CONFIG_PATCH_FILE}" > /tmp/patch.yaml
177+
config_patch=$(cat /tmp/patch.yaml)
178+
echo "Gitpod: ${CONFIG_PATCH_FILE}=${config_patch}"
179+
yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' "${CONFIG_FILE}" /tmp/patch.yaml
180+
170181
echo "Gitpod: Generate the Kubernetes objects and apply"
182+
config=$(cat "${CONFIG_FILE}")
183+
echo "Gitpod: ${CONFIG_FILE}=${config}"
184+
171185
/app/installer render -c "${CONFIG_FILE}" --namespace {{repl Namespace }} | kubectl apply -f -
172186
173187
echo "Gitpod: Installer job finished - goodbye"
174188
volumes:
189+
- name: config-patch
190+
configMap:
191+
name: gitpod-config-patch
175192
- name: node-fs0
176193
hostPath:
177194
path: /

install/kots/manifests/kots-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,20 @@ spec:
331331
type: bool
332332
default: "0"
333333
help_text: 'Enabling the SSH gateway allows use of additional desktop IDEs. IMPORTANT: This uses port 22 on your Kubernetes nodes. When enabled, this will prevent login to the cluster via SSH. If you wish to maintain SSH access to your cluster, please configure another SSH port on your nodes.'
334+
335+
- name: advanced
336+
title: Advanced customizations (Expert Mode)
337+
description: Use with care! Enable only when you know what you are doing!
338+
items:
339+
- name: advanced_mode_enabled
340+
title: Enable advanced mode
341+
type: bool
342+
default: "0"
343+
help_text: Enables advanced customization options. Enable only when you know what you are doing!
344+
345+
- name: config_patch
346+
title: Gitpod config patch (YAML file)
347+
type: file
348+
required: false
349+
when: '{{repl ConfigOptionEquals "advanced_mode_enabled" "1" }}'
350+
help_text: A file with Gitpod config that will be used to patch the generated Gitpod config.

0 commit comments

Comments
 (0)