Skip to content

Commit 0ea2600

Browse files
author
Simon Emms
committed
[kots]: apply backup labels to all resources
1 parent 4ecf845 commit 0ea2600

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2+
# Licensed under the MIT License. See License-MIT.txt in the project root for license information.
3+
4+
apiVersion: v1
5+
kind: ConfigMap
6+
metadata:
7+
name: gitpod-custom-labels
8+
labels:
9+
app: gitpod
10+
component: gitpod-installer
11+
data:
12+
customization.yaml: |
13+
- apiVersion: "*"
14+
kind: "*"
15+
metadata:
16+
name: "*"
17+
labels:
18+
"kots.io/app-slug": "{{repl LicenseFieldValue "appSlug" }}"
19+
"kots.io/backup": "velero"

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ spec:
3333
- mountPath: /config-patch
3434
name: config-patch
3535
readOnly: true
36+
- mountPath: /custom-labels
37+
name: custom-labels
38+
readOnly: true
3639
- mountPath: /mnt/node0
3740
name: node-fs0
3841
readOnly: true
@@ -273,6 +276,7 @@ spec:
273276
yq e -i ".components.proxy.service.serviceType = \"{{repl ConfigOption "component_proxy_service_serviceType" }}\"" "${CONFIG_FILE}"
274277
fi
275278
279+
yq e -i ".customization = []" "${CONFIG_FILE}"
276280
if [ '{{repl ConfigOptionNotEquals "customization_patch" "" }}' = "true" ];
277281
then
278282
CUSTOMIZATION='{{repl ConfigOptionData "customization_patch" | Base64Encode }}'
@@ -285,6 +289,9 @@ spec:
285289
echo "Gitpod: No advanced configuration applied"
286290
fi
287291
292+
echo "Gitpod: Apply the backup labels"
293+
yq e -i '.customization += load("/custom-labels/customization.yaml")' "${CONFIG_FILE}"
294+
288295
echo "Gitpod: Update platform telemetry value"
289296
yq eval-all --inplace '.experimental.telemetry.data.platform = "{{repl Distribution }}"' "${CONFIG_FILE}"
290297
@@ -294,6 +301,9 @@ spec:
294301
echo "Gitpod: ${CONFIG_PATCH_FILE}=${config_patch}"
295302
yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' "${CONFIG_FILE}" /tmp/patch.yaml
296303
304+
echo "Gitpod: Escape all keys - this avoids any collisions in the customizations/patch"
305+
yq e -i '.' -o json -I 0 "${CONFIG_FILE}"
306+
297307
echo "Gitpod: Generate the Kubernetes objects"
298308
config=$(cat "${CONFIG_FILE}")
299309
echo "Gitpod: ${CONFIG_FILE}=${config}"
@@ -361,6 +371,9 @@ spec:
361371
- name: config-patch
362372
configMap:
363373
name: gitpod-config-patch
374+
- name: custom-labels
375+
configMap:
376+
name: gitpod-custom-labels
364377
- name: node-fs0
365378
hostPath:
366379
path: /

0 commit comments

Comments
 (0)