Skip to content

Commit 71f1942

Browse files
author
Simon Emms
committed
[kots]: add Gitpod config patch file as advanced option
Original work by @corneliusludmann
1 parent 1a2ec0f commit 71f1942

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
@@ -44,12 +44,17 @@ spec:
4444
- name: installer
4545
image: 'eu.gcr.io/gitpod-core-dev/build/installer:{{repl ConfigOption "gitpod_version" }}'
4646
volumeMounts:
47+
- mountPath: /config-patch
48+
name: config-patch
49+
readOnly: true
4750
- mountPath: /mnt/node0
4851
name: node-fs0
4952
readOnly: true
5053
env:
5154
- name: CONFIG_FILE
5255
value: /tmp/gitpod-config.yaml
56+
- name: CONFIG_PATCH_FILE
57+
value: /config-patch/gitpod-config-patch.yaml
5358
- name: CONTAINERD_DIR_K3S
5459
value: /run/k3s/containerd/io.containerd.runtime.v2.task/k8s.io
5560
- name: CONTAINERD_SOCKET_K3S
@@ -166,11 +171,23 @@ spec:
166171
yq e -i '.sshGatewayHostKey.name = "ssh-gateway-host-key"' "${CONFIG_FILE}"
167172
fi
168173
174+
echo "Gitpod: Patch Gitpod config"
175+
base64 -d "${CONFIG_PATCH_FILE}" > /tmp/patch.yaml
176+
config_patch=$(cat /tmp/patch.yaml)
177+
echo "Gitpod: ${CONFIG_PATCH_FILE}=${config_patch}"
178+
yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' "${CONFIG_FILE}" /tmp/patch.yaml
179+
169180
echo "Gitpod: Generate the Kubernetes objects and apply"
181+
config=$(cat "${CONFIG_FILE}")
182+
echo "Gitpod: ${CONFIG_FILE}=${config}"
183+
170184
/app/installer render -c "${CONFIG_FILE}" --namespace {{repl Namespace }} | kubectl apply -f -
171185
172186
echo "Gitpod: Installer job finished - goodbye"
173187
volumes:
188+
- name: config-patch
189+
configMap:
190+
name: gitpod-config-patch
174191
- name: node-fs0
175192
hostPath:
176193
path: /

install/kots/manifests/kots-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,20 @@ spec:
337337
type: bool
338338
default: "0"
339339
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.'
340+
341+
- name: advanced
342+
title: Advanced customizations (Expert Mode)
343+
description: Use with care! Enable only when you know what you are doing!
344+
items:
345+
- name: advanced_mode_enabled
346+
title: Enable advanced mode
347+
type: bool
348+
default: "0"
349+
help_text: Enables advanced customization options. Enable only when you know what you are doing!
350+
351+
- name: config_patch
352+
title: Gitpod config patch (YAML file)
353+
type: file
354+
required: false
355+
when: '{{repl ConfigOptionEquals "advanced_mode_enabled" "1" }}'
356+
help_text: A file with Gitpod config that will be used to patch the generated Gitpod config.

0 commit comments

Comments
 (0)