@@ -16,14 +16,7 @@ set -a
1616SERVICES_POOL=" services"
1717WORKSPACES_POOL=" workspaces"
1818
19- K8S_NODE_VM_SIZE=${K8S_NODE_VM_SIZE:= " Standard_DS3_v2" }
20- CERT_NAME=" https-certificates"
21- MYSQL_GITPOD_ENCRYPTION_KEY=' [{"name":"general","version":1,"primary":true,"material":"4uGh1q8y2DYryJwrVMHs0kWXJlqvHWWt/KJuNi04edI="}]'
22-
23- # Secrets
24- SECRET_DATABASE=" az-sql-token"
25- SECRET_REGISTRY=" az-registry-token"
26- SECRET_STORAGE=" az-storage-token"
19+ K8S_NODE_VM_SIZE=${K8S_NODE_VM_SIZE:= " Standard_D4_v3" }
2720
2821function check_prerequisites() {
2922 if [ -z " ${AZURE_SUBSCRIPTION_ID} " ]; then
@@ -63,8 +56,6 @@ function check_prerequisites() {
6356}
6457
6558function install() {
66- echo " Gitpod installer version: $( gitpod-installer version | jq -r ' .version' ) "
67-
6859 check_prerequisites
6960
7061 echo " Updating helm repositories..."
@@ -104,7 +95,7 @@ function install() {
10495 --kubernetes-version " ${AKS_VERSION} " \
10596 --max-count " 50" \
10697 --max-pods " 110" \
107- --min-count " 3 " \
98+ --min-count " 1 " \
10899 --name " ${CLUSTER_NAME} " \
109100 --node-osdisk-size " 100" \
110101 --node-vm-size " ${K8S_NODE_VM_SIZE} " \
@@ -127,7 +118,7 @@ function install() {
127118 --labels gitpod.io/workload_workspace_services=true gitpod.io/workload_workspace_regular=true gitpod.io/workload_workspace_headless=true \
128119 --max-count " 50" \
129120 --max-pods " 110" \
130- --min-count " 3 " \
121+ --min-count " 1 " \
131122 --name " ${WORKSPACES_POOL} " \
132123 --node-osdisk-size " 100" \
133124 --node-vm-size " ${K8S_NODE_VM_SIZE} " \
@@ -150,14 +141,7 @@ function install() {
150141 setup_managed_dns
151142 setup_mysql_database
152143 setup_storage
153- install_gitpod
154-
155- cat << EOF
156- ==========================
157- Gitpod is now installed on your cluster
158-
159- Please update your DNS records with the relevant nameserver.
160- EOF
144+ output_config
161145}
162146
163147function install_cert_manager() {
@@ -174,65 +158,89 @@ function install_cert_manager() {
174158 --wait \
175159 cert-manager \
176160 jetstack/cert-manager
177-
178- # ensure cert-manager and CRDs are installed and running
179- kubectl wait --for=condition=available --timeout=300s deployment/cert-manager -n cert-manager
180161}
181162
182- function install_gitpod() {
183- echo " Installing Gitpod..."
163+ function output_config() {
164+ DOCKER_USER=$( az acr credential show \
165+ --name " ${REGISTRY_NAME} " \
166+ --output tsv \
167+ --query username \
168+ --resource-group " ${RESOURCE_GROUP} " )
184169
185- local CONFIG_FILE=" ${DIR} /gitpod-config.yaml"
170+ DOCKER_REGISTRY_SERVER=$( az acr show \
171+ --name " ${REGISTRY_NAME} " \
172+ --output tsv \
173+ --query loginServer \
174+ --resource-group " ${RESOURCE_GROUP} " )
186175
187- gitpod-installer init > " ${CONFIG_FILE} "
176+ DOCKER_PASSWORD=$( az acr credential show \
177+ --name " ${REGISTRY_NAME} " \
178+ --output tsv \
179+ --query passwords[0].value \
180+ --resource-group " ${RESOURCE_GROUP} " )
188181
189- echo " Updating config..."
182+ STORAGE_ACCOUNT_KEY=$( az storage account keys list \
183+ --account-name " ${STORAGE_ACCOUNT_NAME} " \
184+ --resource-group " ${RESOURCE_GROUP} " \
185+ --output json \
186+ | jq -r ' .[] | select(.keyName == "key1") | .value' )
190187
191- yq e -i " .certificate.name = \" ${CERT_NAME} \" " " ${CONFIG_FILE} "
192- yq e -i " .containerRegistry.inCluster = false" " ${CONFIG_FILE} "
193- yq e -i " .containerRegistry.external.url = \" ${DOCKER_REGISTRY_SERVER} \" " " ${CONFIG_FILE} "
194- yq e -i " .containerRegistry.external.certificate.kind = \" secret\" " " ${CONFIG_FILE} "
195- yq e -i " .containerRegistry.external.certificate.name = \" ${SECRET_REGISTRY} \" " " ${CONFIG_FILE} "
196- yq e -i " .database.inCluster = false" " ${CONFIG_FILE} "
197- yq e -i " .database.external.certificate.kind = \" secret\" " " ${CONFIG_FILE} "
198- yq e -i " .database.external.certificate.name = \" ${SECRET_DATABASE} \" " " ${CONFIG_FILE} "
199- yq e -i " .domain = \" ${DOMAIN} \" " " ${CONFIG_FILE} "
200- yq e -i " .metadata.region = \" ${LOCATION} \" " " ${CONFIG_FILE} "
201- yq e -i " .objectStorage.inCluster = false" " ${CONFIG_FILE} "
202- yq e -i " .objectStorage.azure.credentials.kind = \" secret\" " " ${CONFIG_FILE} "
203- yq e -i " .objectStorage.azure.credentials.name = \" ${SECRET_STORAGE} \" " " ${CONFIG_FILE} "
204- yq e -i ' .workspace.runtime.containerdRuntimeDir = "/var/lib/containerd/io.containerd.runtime.v2.task/k8s.io"' " ${CONFIG_FILE} "
188+ cat << EOF
205189
206- gitpod-installer \
207- render \
208- --config=" ${CONFIG_FILE} " > gitpod.yaml
209190
210- # See https://github.com/gitpod-io/gitpod/tree/main/install/installer#error-validating-statefulsetstatus
211- yq eval-all --inplace \
212- ' del(select(.kind == "StatefulSet" and .metadata.name == "openvsx-proxy").status)' \
213- gitpod.yaml
191+ ==========================
192+ 🎉🥳🔥🧡🚀
214193
215- kubectl apply -f gitpod.yaml
216- }
194+ Your cloud infrastructure is ready to install Gitpod. Please visit
195+ https://www.gitpod.io/docs/self-hosted/latest/getting-started#step-4-install-gitpod
196+ for your next steps.
217197
218- function install_jaeger_operator(){
219- echo " Installing Jaeger operator..."
220- kubectl apply -f https://raw.githubusercontent.com/jaegertracing/helm-charts/main/charts/jaeger-operator/crds/crd.yaml
221- helm upgrade \
222- --atomic \
223- --cleanup-on-fail \
224- --create-namespace \
225- --install \
226- --namespace=' jaeger-operator' \
227- --reset-values \
228- --set installCRDs=true \
229- --set crd.install=false \
230- --values " ${DIR} /charts/assets/jaeger-values.yaml" \
231- --wait \
232- jaegeroperator \
233- jaegertracing/jaeger-operator
198+ Passwords may change on subsequents runs of this guide.
234199
235- kubectl apply -f " ${DIR} /charts/assets/jaeger-gitpod.yaml"
200+ =================
201+ Config Parameters
202+ =================
203+
204+ Domain Name: ${DOMAIN}
205+
206+ Registry
207+ ========
208+ URL: ${DOCKER_REGISTRY_SERVER}
209+ Registry Server: <blank>
210+ Username: ${DOCKER_USER}
211+ Password: ${DOCKER_PASSWORD}
212+
213+ Database
214+ ========
215+ Host: ${MYSQL_INSTANCE_NAME} .mysql.database.azure.com
216+ Username: ${MYSQL_GITPOD_USERNAME} @${MYSQL_INSTANCE_NAME}
217+ Password: ${MYSQL_GITPOD_PASSWORD}
218+ Port: 3306
219+
220+ Storage
221+ =======
222+ Region: ${LOCATION}
223+ Account Name: ${STORAGE_ACCOUNT_NAME}
224+ Access Key: ${STORAGE_ACCOUNT_KEY}
225+
226+ TLS Certificates
227+ ================
228+ Issuer name: gitpod-issuer
229+ Issuer type: Cluster issuer
230+
231+ EOF
232+
233+ if [ -n " ${SETUP_MANAGED_DNS} " ] && [ " ${SETUP_MANAGED_DNS} " == " true" ]; then
234+ cat << EOF
235+ ===========
236+ DNS Records
237+ ===========
238+
239+ Domain Name: ${DOMAIN}
240+ Nameserver(s):
241+ $( az network dns zone show --name ${DOMAIN} --resource-group ${RESOURCE_GROUP} --query " nameServers" -o tsv)
242+ EOF
243+ fi
236244}
237245
238246function login() {
@@ -255,32 +263,6 @@ function setup_container_registry() {
255263 --resource-group " ${RESOURCE_GROUP} " \
256264 --sku Premium
257265 fi
258-
259- DOCKER_USER=$( az acr credential show \
260- --name " ${REGISTRY_NAME} " \
261- --output tsv \
262- --query username \
263- --resource-group " ${RESOURCE_GROUP} " )
264-
265- export DOCKER_REGISTRY_SERVER=$( az acr show \
266- --name " ${REGISTRY_NAME} " \
267- --output tsv \
268- --query loginServer \
269- --resource-group " ${RESOURCE_GROUP} " )
270-
271- DOCKER_PASSWORD=$( az acr credential show \
272- --name " ${REGISTRY_NAME} " \
273- --output tsv \
274- --query passwords[0].value \
275- --resource-group " ${RESOURCE_GROUP} " )
276-
277- echo " Create registry secret..."
278- kubectl create secret docker-registry " ${SECRET_REGISTRY} " \
279- --docker-server=" ${DOCKER_REGISTRY_SERVER} " \
280- --docker-username=" ${DOCKER_USER} " \
281- --docker-password=" ${DOCKER_PASSWORD} " \
282- --dry-run=client -o yaml | \
283- kubectl replace --force -f -
284266}
285267
286268function setup_kubectl() {
@@ -315,8 +297,6 @@ function setup_managed_dns() {
315297 --role " DNS Zone Contributor" \
316298 --scope " ${ZONE_ID} "
317299
318- # Use v5.4.8 as external-dns v0.10.x has issue using Azure managed identities not in v0.9.0
319- # @link https://github.com/kubernetes-sigs/external-dns/issues/2383
320300 helm upgrade \
321301 --atomic \
322302 --cleanup-on-fail \
@@ -331,7 +311,6 @@ function setup_managed_dns() {
331311 --set azure.useManagedIdentityExtension=true \
332312 --set azure.userAssignedIdentityID=" ${KUBELET_CLIENT_ID} " \
333313 --set logFormat=json \
334- --version=5.4.8 \
335314 --wait \
336315 external-dns \
337316 bitnami/external-dns
@@ -343,7 +322,7 @@ function setup_managed_dns() {
343322
344323function setup_mysql_database() {
345324 MYSQL_GITPOD_USERNAME=" gitpod"
346- MYSQL_GITPOD_PASSWORD=$( openssl rand -base64 20)
325+ export MYSQL_GITPOD_PASSWORD=$( openssl rand -base64 20)
347326
348327 if [ " $( az mysql server show --name ${MYSQL_INSTANCE_NAME} --resource-group ${RESOURCE_GROUP} --query " name == '${MYSQL_INSTANCE_NAME} '" || echo " empty" ) " == " true" ]; then
349328 echo " MySQL instance exists - updating password..."
@@ -385,16 +364,6 @@ function setup_mysql_database() {
385364 --resource-group " ${RESOURCE_GROUP} " \
386365 --server-name " ${MYSQL_INSTANCE_NAME} " \
387366 --start-ip-address " 0.0.0.0"
388-
389- echo " Create database secret..."
390- kubectl create secret generic " ${SECRET_DATABASE} " \
391- --from-literal=encryptionKeys=" ${MYSQL_GITPOD_ENCRYPTION_KEY} " \
392- --from-literal=host=" ${MYSQL_INSTANCE_NAME} .mysql.database.azure.com" \
393- --from-literal=password=" ${MYSQL_GITPOD_PASSWORD} " \
394- --from-literal=port=" 3306" \
395- --from-literal=username=" ${MYSQL_GITPOD_USERNAME} @${MYSQL_INSTANCE_NAME} " \
396- --dry-run=client -o yaml | \
397- kubectl replace --force -f -
398367}
399368
400369function setup_storage() {
@@ -423,19 +392,6 @@ function setup_storage() {
423392 --assignee " ${PRINCIPAL_ID} " \
424393 --role " Storage Blob Data Contributor" \
425394 --scope " ${STORAGE_ACCOUNT_ID} "
426-
427- STORAGE_ACCOUNT_KEY=$( az storage account keys list \
428- --account-name " ${STORAGE_ACCOUNT_NAME} " \
429- --resource-group " ${RESOURCE_GROUP} " \
430- --output json \
431- | jq -r ' .[] | select(.keyName == "key1") | .value' )
432-
433- echo " Create storage secret..."
434- kubectl create secret generic " ${SECRET_STORAGE} " \
435- --from-literal=accountName=" ${STORAGE_ACCOUNT_NAME} " \
436- --from-literal=accountKey=" ${STORAGE_ACCOUNT_KEY} " \
437- --dry-run=client -o yaml | \
438- kubectl replace --force -f -
439395}
440396
441397function uninstall() {
0 commit comments