Skip to content

[installer] Refactor envvars before release #13174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions install/installer/pkg/config/v1/envvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func isTruthy(input string) bool {
// ConfigEnvvars this maps the external environment variables to Golang values and forms part of our public contract
type ConfigEnvvars struct {
AdvancedModeEnabled bool `env:"ADVANCED_MODE_ENABLED"`
ComponentProxyServiceType string `env:"COMPONENT_PROXY_SERVICE_SERVICETYPE"`
ComponentProxyServiceType string `env:"COMPONENT_PROXY_SERVICE_TYPE"`
ConfigPatch string `env:"CONFIG_PATCH"`
CustomizationPatch string `env:"CUSTOMIZATION_PATCH"`
DBCloudSQLEnabled bool `env:"DB_CLOUDSQL_ENABLED"`
Expand All @@ -60,16 +60,16 @@ type ConfigEnvvars struct {
LocalRegistryHost string `env:"LOCAL_REGISTRY_HOST"`
LocalRegistryImagePullConfig string `env:"LOCAL_REGISTRY_IMAGE_PULL_DOCKER_CONFIG_JSON"`
OpenVSXUrl string `env:"OPEN_VSX_URL"`
RegistryDockerConfigEnabled bool `env:"REG_DOCKER_CONFIG_ENABLED"`
RegistryDockerConfig string `env:"REG_DOCKER_CONFIG_JSON"`
RegistryInClusterEnabled bool `env:"REG_INCLUSTER_ENABLED" envDefault:"1"`
RegistryInClusterStorageType string `env:"REG_INCLUSTER_STORAGE"`
RegistryInClusterStorageS3BucketName string `env:"REG_INCLUSTER_STORAGE_S3_BUCKETNAME"`
RegistryInClusterStorageS3CertName string `env:"REG_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME"`
RegistryInClusterStorageS3Endpoint string `env:"REG_INCLUSTER_STORAGE_S3_ENDPOINT"`
RegistryInClusterStorageS3Region string `env:"REG_INCLUSTER_STORAGE_S3_REGION"`
RegistryExternalCertName string `env:"REG_EXTERNAL_CERTIFICATE_NAME"`
RegistryExternalURL string `env:"REG_URL"`
RegistryDockerConfigEnabled bool `env:"REGISTRY_DOCKER_CONFIG_ENABLED"`
RegistryDockerConfig string `env:"REGISTRY_DOCKER_CONFIG_JSON"`
RegistryInClusterEnabled bool `env:"REGISTRY_INCLUSTER_ENABLED" envDefault:"1"`
RegistryInClusterStorageType string `env:"REGISTRY_INCLUSTER_STORAGE"`
RegistryInClusterStorageS3BucketName string `env:"REGISTRY_INCLUSTER_STORAGE_S3_BUCKET_NAME"`
RegistryInClusterStorageS3CertName string `env:"REGISTRY_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME"`
RegistryInClusterStorageS3Endpoint string `env:"REGISTRY_INCLUSTER_STORAGE_S3_ENDPOINT"`
RegistryInClusterStorageS3Region string `env:"REGISTRY_INCLUSTER_STORAGE_S3_REGION"`
RegistryExternalCertName string `env:"REGISTRY_EXTERNAL_CERTIFICATE_NAME"`
RegistryExternalURL string `env:"REGISTRY_URL"`
SSHGatewayEnabled bool `env:"SSH_GATEWAY"`
SSHGatewayHostKeyName string `env:"SSH_GATEWAY_HOST_KEY_NAME"`
StorageProvider string `env:"STORE_PROVIDER" envDefault:"incluster"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

envvars:
DOMAIN: gitpod.io
REG_DOCKER_CONFIG_ENABLED: "1"
REG_DOCKER_CONFIG_JSON: '{ "auths": { "host1": "", "host2": "", "host3": "" } }'
REGISTRY_DOCKER_CONFIG_ENABLED: "1"
REGISTRY_DOCKER_CONFIG_JSON: '{ "auths": { "host1": "", "host2": "", "host3": "" } }'
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ envvars:
DB_INCLUSTER_ENABLED: "0"
DB_EXTERNAL_CERTIFICATE_NAME: database-secret
DOMAIN: gitpod.io
REG_INCLUSTER_ENABLED: "1"
REG_INCLUSTER_STORAGE_S3_BUCKETNAME: container-s3-bucket
REG_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME: container-s3-secret
REG_INCLUSTER_STORAGE_S3_ENDPOINT: container-s3-bucket.com
REG_INCLUSTER_STORAGE_S3_REGION: container-s3-region
REG_INCLUSTER_STORAGE: s3
REGISTRY_INCLUSTER_ENABLED: "1"
REGISTRY_INCLUSTER_STORAGE_S3_BUCKET_NAME: container-s3-bucket
REGISTRY_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME: container-s3-secret
REGISTRY_INCLUSTER_STORAGE_S3_ENDPOINT: container-s3-bucket.com
REGISTRY_INCLUSTER_STORAGE_S3_REGION: container-s3-region
REGISTRY_INCLUSTER_STORAGE: s3
STORE_PROVIDER: s3
STORE_REGION: s3-region
STORE_S3_BUCKET: s3-bucket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ envvars:
DB_INCLUSTER_ENABLED: "0"
DB_EXTERNAL_CERTIFICATE_NAME: azure-db-secret
DOMAIN: gitpod.io
REG_INCLUSTER_ENABLED: "0"
REG_EXTERNAL_CERTIFICATE_NAME: azure-reg-secret
REG_URL: azure-reg-url
REGISTRY_INCLUSTER_ENABLED: "0"
REGISTRY_EXTERNAL_CERTIFICATE_NAME: azure-reg-secret
REGISTRY_URL: azure-reg-url
STORE_PROVIDER: azure
STORE_REGION: azure-region
STORE_AZURE_CREDENTIALS_NAME: azure-store-secret
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ envvars:
DB_CLOUDSQL_INSTANCE: gcp-db-instance
DB_CLOUDSQL_ENABLED: "1"
DOMAIN: gitpod.io
REG_INCLUSTER_ENABLED: "0"
REG_EXTERNAL_CERTIFICATE_NAME: gcp-reg-secret
REG_URL: gcp-reg-url
REGISTRY_INCLUSTER_ENABLED: "0"
REGISTRY_EXTERNAL_CERTIFICATE_NAME: gcp-reg-secret
REGISTRY_URL: gcp-reg-url
STORE_PROVIDER: gcp
STORE_REGION: gcp-region
STORE_GCP_PROJECT: gcp-project-name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

envvars:
ADVANCED_MODE_ENABLED: "1"
COMPONENT_PROXY_SERVICE_SERVICETYPE: ClusterIP
COMPONENT_PROXY_SERVICE_TYPE: ClusterIP
DOMAIN: gitpod.io
10 changes: 5 additions & 5 deletions install/installer/scripts/kots-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ EOF

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

# Get the in-cluster registry secret
Expand All @@ -116,18 +116,18 @@ EOF

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

if [ "${REG_DOCKER_CONFIG_ENABLED}" = "1" ];
if [ "${REGISTRY_DOCKER_CONFIG_ENABLED}" = "1" ];
then
# Work out the registry secret to use
if [ "${REG_INCLUSTER_ENABLED}" = "0" ];
if [ "${REGISTRY_INCLUSTER_ENABLED}" = "0" ];
then
export REGISTRY_SECRET_NAME="${REG_EXTERNAL_CERTIFICATE_NAME}"
export REGISTRY_SECRET_NAME="${REGISTRY_EXTERNAL_CERTIFICATE_NAME}"
else
export REGISTRY_SECRET_NAME="builtin-registry-auth"
fi
Expand Down
2 changes: 1 addition & 1 deletion install/kots/manifests/gitpod-installation-status.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
containers:
- name: installation-status
# This will normally be the release tag
image: "eu.gcr.io/gitpod-core-dev/build/installer:sje-kots-config-validate.7"
image: "eu.gcr.io/gitpod-core-dev/build/installer:tar-installer-env-refactor.2"
envFrom:
- configMapRef:
name: gitpod-kots-config
Expand Down
4 changes: 2 additions & 2 deletions install/kots/manifests/gitpod-installer-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ spec:
containers:
- name: installer
# This will normally be the release tag
image: "eu.gcr.io/gitpod-core-dev/build/installer:sje-kots-config-validate.7"
image: "eu.gcr.io/gitpod-core-dev/build/installer:tar-installer-env-refactor.2"
volumeMounts:
- mountPath: /mnt/node0
name: node-fs0
readOnly: true
env:
- name: MOUNT_PATH
value: /mnt/node0
- name: REG_DOCKER_CONFIG_JSON
- name: REGISTRY_DOCKER_CONFIG_JSON
valueFrom:
secretKeyRef:
name: custom-registry-credentials
Expand Down
20 changes: 10 additions & 10 deletions install/kots/manifests/gitpod-kots-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ data:
IMAGE_PULL_SECRET_NAME: repl{{ ImagePullSecretName | quote }}

# Registry settings
REG_INCLUSTER_ENABLED: repl{{ ConfigOption "reg_incluster" | quote }}
REG_URL: repl{{ ConfigOption "reg_url" | quote }}
REG_INCLUSTER_STORAGE: repl{{ ConfigOption "reg_incluster_storage" | quote }}
REG_INCLUSTER_STORAGE_S3_REGION: repl{{ ConfigOption "reg_incluster_storage_s3_region" | quote }}
REG_INCLUSTER_STORAGE_S3_ENDPOINT: repl{{ ConfigOption "reg_incluster_storage_s3_endpoint" | quote }}
REG_INCLUSTER_STORAGE_S3_BUCKETNAME: repl{{ ConfigOption "reg_incluster_storage_s3_bucketname" | quote }}
REG_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME: container-registry-s3-backend
REG_DOCKER_CONFIG_ENABLED: repl{{ ConfigOption "reg_docker_config_enable" | quote }}
REG_EXTERNAL_CERTIFICATE_NAME: container-registry
REGISTRY_INCLUSTER_ENABLED: repl{{ ConfigOption "reg_incluster" | quote }}
REGISTRY_URL: repl{{ ConfigOption "reg_url" | quote }}
REGISTRY_INCLUSTER_STORAGE: repl{{ ConfigOption "reg_incluster_storage" | quote }}
REGISTRY_INCLUSTER_STORAGE_S3_REGION: repl{{ ConfigOption "reg_incluster_storage_s3_region" | quote }}
REGISTRY_INCLUSTER_STORAGE_S3_ENDPOINT: repl{{ ConfigOption "reg_incluster_storage_s3_endpoint" | quote }}
REGISTRY_INCLUSTER_STORAGE_S3_BUCKET_NAME: repl{{ ConfigOption "reg_incluster_storage_s3_bucketname" | quote }}
REGISTRY_INCLUSTER_STORAGE_S3_CERTIFICATE_NAME: container-registry-s3-backend
REGISTRY_DOCKER_CONFIG_ENABLED: repl{{ ConfigOption "reg_docker_config_enable" | quote }}
REGISTRY_EXTERNAL_CERTIFICATE_NAME: container-registry

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

# Advanced settings
ADVANCED_MODE_ENABLED: repl{{ ConfigOption "advanced_mode_enabled" | quote }}
COMPONENT_PROXY_SERVICE_SERVICETYPE: repl{{ ConfigOption "component_proxy_service_serviceType" | quote }}
COMPONENT_PROXY_SERVICE_TYPE: repl{{ ConfigOption "component_proxy_service_serviceType" | quote }}
CUSTOMIZATION_PATCH_ENABLED: repl{{ ConfigOptionNotEquals "customization_patch" "" | quote }} # Use comparison not value

# Customizations
Expand Down