Skip to content

Commit a9faf6f

Browse files
Pothulapatiroboquat
authored andcommitted
[installer] Refactor envvars before release
This PR does a cleanup on the environment variables as now they are kind-off a public contract, which means its better to be verbose and meaningful as possible. Once the release is done, it would be harder to do the same. This has the following changes: - Rename `REG` prefix to `REGISTRY` - Change `REG_INCLUSTER_STORAGE_S3_BUCKETNAME `to `REGISTRY_INCLUSTER_STORAGE_S3_BUCKET_NAME` - Change `COMPONENT_PROXY_SERVICE_SERVICETYPE` to `COMPONENT_PROXY_SERVICE_TYPE` Signed-off-by: Tarun Pothulapati <[email protected]>
1 parent 90e3308 commit a9faf6f

File tree

10 files changed

+44
-44
lines changed

10 files changed

+44
-44
lines changed

install/installer/pkg/config/v1/envvars.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func isTruthy(input string) bool {
4141
// ConfigEnvvars this maps the external environment variables to Golang values and forms part of our public contract
4242
type ConfigEnvvars struct {
4343
AdvancedModeEnabled bool `env:"ADVANCED_MODE_ENABLED"`
44-
ComponentProxyServiceType string `env:"COMPONENT_PROXY_SERVICE_SERVICETYPE"`
44+
ComponentProxyServiceType string `env:"COMPONENT_PROXY_SERVICE_TYPE"`
4545
ConfigPatch string `env:"CONFIG_PATCH"`
4646
CustomizationPatch string `env:"CUSTOMIZATION_PATCH"`
4747
DBCloudSQLEnabled bool `env:"DB_CLOUDSQL_ENABLED"`
@@ -60,16 +60,16 @@ type ConfigEnvvars struct {
6060
LocalRegistryHost string `env:"LOCAL_REGISTRY_HOST"`
6161
LocalRegistryImagePullConfig string `env:"LOCAL_REGISTRY_IMAGE_PULL_DOCKER_CONFIG_JSON"`
6262
OpenVSXUrl string `env:"OPEN_VSX_URL"`
63-
RegistryDockerConfigEnabled bool `env:"REG_DOCKER_CONFIG_ENABLED"`
64-
RegistryDockerConfig string `env:"REG_DOCKER_CONFIG_JSON"`
65-
RegistryInClusterEnabled bool `env:"REG_INCLUSTER_ENABLED" envDefault:"1"`
66-
RegistryInClusterStorageType string `env:"REG_INCLUSTER_STORAGE"`
67-
RegistryInClusterStorageS3BucketName string `env:"REG_INCLUSTER_STORAGE_S3_BUCKETNAME"`
68-
RegistryInClusterStorageS3CertName string `env:"REG_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME"`
69-
RegistryInClusterStorageS3Endpoint string `env:"REG_INCLUSTER_STORAGE_S3_ENDPOINT"`
70-
RegistryInClusterStorageS3Region string `env:"REG_INCLUSTER_STORAGE_S3_REGION"`
71-
RegistryExternalCertName string `env:"REG_EXTERNAL_CERTIFICATE_NAME"`
72-
RegistryExternalURL string `env:"REG_URL"`
63+
RegistryDockerConfigEnabled bool `env:"REGISTRY_DOCKER_CONFIG_ENABLED"`
64+
RegistryDockerConfig string `env:"REGISTRY_DOCKER_CONFIG_JSON"`
65+
RegistryInClusterEnabled bool `env:"REGISTRY_INCLUSTER_ENABLED" envDefault:"1"`
66+
RegistryInClusterStorageType string `env:"REGISTRY_INCLUSTER_STORAGE"`
67+
RegistryInClusterStorageS3BucketName string `env:"REGISTRY_INCLUSTER_STORAGE_S3_BUCKET_NAME"`
68+
RegistryInClusterStorageS3CertName string `env:"REGISTRY_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME"`
69+
RegistryInClusterStorageS3Endpoint string `env:"REGISTRY_INCLUSTER_STORAGE_S3_ENDPOINT"`
70+
RegistryInClusterStorageS3Region string `env:"REGISTRY_INCLUSTER_STORAGE_S3_REGION"`
71+
RegistryExternalCertName string `env:"REGISTRY_EXTERNAL_CERTIFICATE_NAME"`
72+
RegistryExternalURL string `env:"REGISTRY_URL"`
7373
SSHGatewayEnabled bool `env:"SSH_GATEWAY"`
7474
SSHGatewayHostKeyName string `env:"SSH_GATEWAY_HOST_KEY_NAME"`
7575
StorageProvider string `env:"STORE_PROVIDER" envDefault:"incluster"`

install/installer/pkg/config/v1/testdata/envvars/additional-registry/envvars.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
envvars:
55
DOMAIN: gitpod.io
6-
REG_DOCKER_CONFIG_ENABLED: "1"
7-
REG_DOCKER_CONFIG_JSON: '{ "auths": { "host1": "", "host2": "", "host3": "" } }'
6+
REGISTRY_DOCKER_CONFIG_ENABLED: "1"
7+
REGISTRY_DOCKER_CONFIG_JSON: '{ "auths": { "host1": "", "host2": "", "host3": "" } }'

install/installer/pkg/config/v1/testdata/envvars/aws/envvars.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ envvars:
55
DB_INCLUSTER_ENABLED: "0"
66
DB_EXTERNAL_CERTIFICATE_NAME: database-secret
77
DOMAIN: gitpod.io
8-
REG_INCLUSTER_ENABLED: "1"
9-
REG_INCLUSTER_STORAGE_S3_BUCKETNAME: container-s3-bucket
10-
REG_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME: container-s3-secret
11-
REG_INCLUSTER_STORAGE_S3_ENDPOINT: container-s3-bucket.com
12-
REG_INCLUSTER_STORAGE_S3_REGION: container-s3-region
13-
REG_INCLUSTER_STORAGE: s3
8+
REGISTRY_INCLUSTER_ENABLED: "1"
9+
REGISTRY_INCLUSTER_STORAGE_S3_BUCKET_NAME: container-s3-bucket
10+
REGISTRY_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME: container-s3-secret
11+
REGISTRY_INCLUSTER_STORAGE_S3_ENDPOINT: container-s3-bucket.com
12+
REGISTRY_INCLUSTER_STORAGE_S3_REGION: container-s3-region
13+
REGISTRY_INCLUSTER_STORAGE: s3
1414
STORE_PROVIDER: s3
1515
STORE_REGION: s3-region
1616
STORE_S3_BUCKET: s3-bucket

install/installer/pkg/config/v1/testdata/envvars/azure/envvars.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ envvars:
55
DB_INCLUSTER_ENABLED: "0"
66
DB_EXTERNAL_CERTIFICATE_NAME: azure-db-secret
77
DOMAIN: gitpod.io
8-
REG_INCLUSTER_ENABLED: "0"
9-
REG_EXTERNAL_CERTIFICATE_NAME: azure-reg-secret
10-
REG_URL: azure-reg-url
8+
REGISTRY_INCLUSTER_ENABLED: "0"
9+
REGISTRY_EXTERNAL_CERTIFICATE_NAME: azure-reg-secret
10+
REGISTRY_URL: azure-reg-url
1111
STORE_PROVIDER: azure
1212
STORE_REGION: azure-region
1313
STORE_AZURE_CREDENTIALS_NAME: azure-store-secret

install/installer/pkg/config/v1/testdata/envvars/gcp/envvars.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ envvars:
77
DB_CLOUDSQL_INSTANCE: gcp-db-instance
88
DB_CLOUDSQL_ENABLED: "1"
99
DOMAIN: gitpod.io
10-
REG_INCLUSTER_ENABLED: "0"
11-
REG_EXTERNAL_CERTIFICATE_NAME: gcp-reg-secret
12-
REG_URL: gcp-reg-url
10+
REGISTRY_INCLUSTER_ENABLED: "0"
11+
REGISTRY_EXTERNAL_CERTIFICATE_NAME: gcp-reg-secret
12+
REGISTRY_URL: gcp-reg-url
1313
STORE_PROVIDER: gcp
1414
STORE_REGION: gcp-region
1515
STORE_GCP_PROJECT: gcp-project-name

install/installer/pkg/config/v1/testdata/envvars/service-type/envvars.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
envvars:
55
ADVANCED_MODE_ENABLED: "1"
6-
COMPONENT_PROXY_SERVICE_SERVICETYPE: ClusterIP
6+
COMPONENT_PROXY_SERVICE_TYPE: ClusterIP
77
DOMAIN: gitpod.io

install/installer/scripts/kots-install.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ EOF
9191

9292
# Combine the pull secrets
9393
echo "${LOCAL_REGISTRY_IMAGE_PULL_DOCKER_CONFIG_JSON}" > /tmp/kotsregistry.json
94-
if [ "${REG_INCLUSTER_ENABLED}" = "1" ]; then
94+
if [ "${REGISTRY_INCLUSTER_ENABLED}" = "1" ]; then
9595
echo "Gitpod: Add the local registry secret to the in-cluster registry secret"
9696

9797
# Get the in-cluster registry secret
@@ -116,18 +116,18 @@ EOF
116116

117117
echo "Gitpod: append the container-registry secret"
118118
echo "---" >> "${GITPOD_OBJECTS}/templates/gitpod.yaml"
119-
kubectl create secret docker-registry "${REG_EXTERNAL_CERTIFICATE_NAME}" \
119+
kubectl create secret docker-registry "${REGISTRY_EXTERNAL_CERTIFICATE_NAME}" \
120120
--namespace "${NAMESPACE}" \
121121
--from-file=.dockerconfigjson=/tmp/container-registry-secret \
122122
-o yaml --dry-run=client >> "${GITPOD_OBJECTS}/templates/gitpod.yaml"
123123
fi
124124

125-
if [ "${REG_DOCKER_CONFIG_ENABLED}" = "1" ];
125+
if [ "${REGISTRY_DOCKER_CONFIG_ENABLED}" = "1" ];
126126
then
127127
# Work out the registry secret to use
128-
if [ "${REG_INCLUSTER_ENABLED}" = "0" ];
128+
if [ "${REGISTRY_INCLUSTER_ENABLED}" = "0" ];
129129
then
130-
export REGISTRY_SECRET_NAME="${REG_EXTERNAL_CERTIFICATE_NAME}"
130+
export REGISTRY_SECRET_NAME="${REGISTRY_EXTERNAL_CERTIFICATE_NAME}"
131131
else
132132
export REGISTRY_SECRET_NAME="builtin-registry-auth"
133133
fi

install/kots/manifests/gitpod-installation-status.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
containers:
3131
- name: installation-status
3232
# This will normally be the release tag
33-
image: "eu.gcr.io/gitpod-core-dev/build/installer:sje-kots-config-validate.7"
33+
image: "eu.gcr.io/gitpod-core-dev/build/installer:tar-installer-env-refactor.2"
3434
envFrom:
3535
- configMapRef:
3636
name: gitpod-kots-config

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ spec:
3939
containers:
4040
- name: installer
4141
# This will normally be the release tag
42-
image: "eu.gcr.io/gitpod-core-dev/build/installer:sje-kots-config-validate.7"
42+
image: "eu.gcr.io/gitpod-core-dev/build/installer:tar-installer-env-refactor.2"
4343
volumeMounts:
4444
- mountPath: /mnt/node0
4545
name: node-fs0
4646
readOnly: true
4747
env:
4848
- name: MOUNT_PATH
4949
value: /mnt/node0
50-
- name: REG_DOCKER_CONFIG_JSON
50+
- name: REGISTRY_DOCKER_CONFIG_JSON
5151
valueFrom:
5252
secretKeyRef:
5353
name: custom-registry-credentials

install/kots/manifests/gitpod-kots-config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ data:
4040
IMAGE_PULL_SECRET_NAME: repl{{ ImagePullSecretName | quote }}
4141

4242
# Registry settings
43-
REG_INCLUSTER_ENABLED: repl{{ ConfigOption "reg_incluster" | quote }}
44-
REG_URL: repl{{ ConfigOption "reg_url" | quote }}
45-
REG_INCLUSTER_STORAGE: repl{{ ConfigOption "reg_incluster_storage" | quote }}
46-
REG_INCLUSTER_STORAGE_S3_REGION: repl{{ ConfigOption "reg_incluster_storage_s3_region" | quote }}
47-
REG_INCLUSTER_STORAGE_S3_ENDPOINT: repl{{ ConfigOption "reg_incluster_storage_s3_endpoint" | quote }}
48-
REG_INCLUSTER_STORAGE_S3_BUCKETNAME: repl{{ ConfigOption "reg_incluster_storage_s3_bucketname" | quote }}
49-
REG_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME: container-registry-s3-backend
50-
REG_DOCKER_CONFIG_ENABLED: repl{{ ConfigOption "reg_docker_config_enable" | quote }}
51-
REG_EXTERNAL_CERTIFICATE_NAME: container-registry
43+
REGISTRY_INCLUSTER_ENABLED: repl{{ ConfigOption "reg_incluster" | quote }}
44+
REGISTRY_URL: repl{{ ConfigOption "reg_url" | quote }}
45+
REGISTRY_INCLUSTER_STORAGE: repl{{ ConfigOption "reg_incluster_storage" | quote }}
46+
REGISTRY_INCLUSTER_STORAGE_S3_REGION: repl{{ ConfigOption "reg_incluster_storage_s3_region" | quote }}
47+
REGISTRY_INCLUSTER_STORAGE_S3_ENDPOINT: repl{{ ConfigOption "reg_incluster_storage_s3_endpoint" | quote }}
48+
REGISTRY_INCLUSTER_STORAGE_S3_BUCKET_NAME: repl{{ ConfigOption "reg_incluster_storage_s3_bucketname" | quote }}
49+
REGISTRY_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME: container-registry-s3-backend
50+
REGISTRY_DOCKER_CONFIG_ENABLED: repl{{ ConfigOption "reg_docker_config_enable" | quote }}
51+
REGISTRY_EXTERNAL_CERTIFICATE_NAME: container-registry
5252

5353
# Storage settings
5454
STORE_PROVIDER: repl{{ ConfigOption "store_provider" | quote }}
@@ -72,7 +72,7 @@ data:
7272

7373
# Advanced settings
7474
ADVANCED_MODE_ENABLED: repl{{ ConfigOption "advanced_mode_enabled" | quote }}
75-
COMPONENT_PROXY_SERVICE_SERVICETYPE: repl{{ ConfigOption "component_proxy_service_serviceType" | quote }}
75+
COMPONENT_PROXY_SERVICE_TYPE: repl{{ ConfigOption "component_proxy_service_serviceType" | quote }}
7676
CUSTOMIZATION_PATCH_ENABLED: repl{{ ConfigOptionNotEquals "customization_patch" "" | quote }} # Use comparison not value
7777

7878
# Customizations

0 commit comments

Comments
 (0)