Skip to content

Commit e963107

Browse files
committed
[kots] Add new config to upload dockerConfigJson file
Signed-off-by: Tarun Pothulapati <tarun@gitpod.io>
1 parent b89a417 commit e963107

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,24 @@ spec:
329329
"${GITPOD_OBJECTS}/templates/gitpod.yaml"
330330
fi
331331
332+
if [ '{{repl ConfigOptionNotEquals "reg_docker_config" "" }}' = "true" ];
333+
then
334+
echo "Gitpod: Add given extra docker config json file"
335+
336+
yq eval-all '(select(.kind == "Secret" and .metadata.name == "builtin-registry-auth") | .data.".dockerconfigjson")' \
337+
"${GITPOD_OBJECTS}/templates/gitpod.yaml" \
338+
| base64 -d \
339+
> /tmp/currentconfig.json
340+
341+
DOCKER_CONFIG='{{repl ConfigOptionData "reg_docker_config" | Base64Encode }}'
342+
echo "${DOCKER_CONFIG}" | base64 -d > /tmp/userconfig.json
343+
export REGISTRY_SECRET=$(jq -s '.[0] * .[1]' /tmp/userconfig.json /tmp/currentconfig.json | base64 -w 0)
344+
345+
echo "Gitpod: update the in-cluster registry secret"
346+
yq eval-all --inplace '(select(.kind == "Secret" and .metadata.name == "builtin-registry-auth") | .data.".dockerconfigjson") |= env(REGISTRY_SECRET)' \
347+
"${GITPOD_OBJECTS}/templates/gitpod.yaml"
348+
fi
349+
332350
echo "Gitpod: Escape any Golang template values"
333351
sed -i -r 's/(.*\{\{.*)/{{`\1`}}/' "${GITPOD_OBJECTS}/templates/gitpod.yaml"
334352

install/kots/manifests/kots-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ spec:
4444
- name: s3
4545
title: S3
4646

47+
- name: reg_docker_config
48+
title: Registry credentials
49+
type: file
50+
help_text: docker [config json file](https://docs.docker.com/engine/reference/commandline/cli/#sample-configuration-file) used to access private registries, containing images specifically for the workspace image builds.
51+
4752
# S3 help_text
4853
- name: reg_incluster_storage_s3_region
4954
title: Storage region

0 commit comments

Comments
 (0)