2
2
3
3
set -eo pipefail
4
4
5
+ DIR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd -P)
6
+
5
7
function variables_from_context() {
6
8
# Create EKS cluster without nodes
7
9
# Generate a new kubeconfig file in the local directory
@@ -139,18 +141,15 @@ function install() {
139
141
# Restart tigera-operator
140
142
kubectl delete pod -n tigera-operator -l k8s-app=tigera-operator > /dev/null 2>&1
141
143
142
- # Create RDS database, S3 bucket for docker-registry and IAM account for gitpod S3 storage
143
- # the cdk application will generates a gitpod-values.yaml file to be used by helm
144
-
145
144
# TODO: remove once we can reference a secret in the helm chart.
146
145
# generated password cannot excede 41 characters (RDS limitation)
147
- SSM_KEY=" /gitpod/cluster/${CLUSTER_NAME} /region/${AWS_REGION} "
148
- ${AWS_CMD} ssm put-parameter \
149
- --overwrite \
150
- --name " ${SSM_KEY} " \
151
- --type String \
152
- --value " $( date +%s | sha256sum | base64 | head -c 35 ; echo) " \
153
- --region " ${AWS_REGION} " > /dev/null 2>&1
146
+ # SSM_KEY="/gitpod/cluster/${CLUSTER_NAME}/region/${AWS_REGION}"
147
+ # ${AWS_CMD} ssm put-parameter \
148
+ # --overwrite \
149
+ # --name "${SSM_KEY}" \
150
+ # --type String \
151
+ # --value "$(date +%s | sha256sum | base64 | head -c 35 ; echo)" \
152
+ # --region "${AWS_REGION}" > /dev/null 2>&1
154
153
155
154
# deploy CDK stacks
156
155
cdk deploy \
@@ -160,10 +159,46 @@ function install() {
160
159
--context certificatearn=" ${CERTIFICATE_ARN} " \
161
160
--context identityoidcissuer=" $( ${AWS_CMD} eks describe-cluster --name " ${CLUSTER_NAME} " --query " cluster.identity.oidc.issuer" --output text --region " ${AWS_REGION} " ) " \
162
161
--require-approval never \
162
+ --outputs-file cdk-outputs.json \
163
163
--all
164
164
165
+ # TLS termination is done in the ALB
166
+ cat << EOF | kubectl apply -f -
167
+ apiVersion: cert-manager.io/v1
168
+ kind: Certificate
169
+ metadata:
170
+ name: https-certificates
171
+ spec:
172
+ dnsNames:
173
+ - ${DOMAIN}
174
+ - '*.${DOMAIN} '
175
+ - '*.ws.${DOMAIN} '
176
+ duration: 4380h0m0s
177
+ issuerRef:
178
+ group: cert-manager.io
179
+ kind: Issuer
180
+ name: ca-issuer
181
+ secretName: https-certificates
182
+ EOF
183
+
184
+ local CONFIG_FILE=" ${DIR} /gitpod-config.yaml"
185
+ gitpod-installer init > " ${CONFIG_FILE} "
186
+
187
+ yq e -i " .certificate.name = \" https-certificates\" " " ${CONFIG_FILE} "
188
+ yq e -i " .domain = \" ${DOMAIN} \" " " ${CONFIG_FILE} "
189
+ yq e -i " .metadata.region = \" ${AWS_REGION} \" " " ${CONFIG_FILE} "
190
+ yq e -i ' .workspace.runtime.containerdRuntimeDir = "/var/lib/containerd/io.containerd.runtime.v2.task/k8s.io"' " ${CONFIG_FILE} "
191
+
192
+ gitpod-installer \
193
+ render \
194
+ --config=" ${CONFIG_FILE} " > gitpod.yaml
195
+
196
+ kubectl apply -f gitpod.yaml
197
+
165
198
# wait for update of the ingress status
166
- sleep 5
199
+ until [ -n " $( kubectl get ingress gitpod -o jsonpath=' {.status.loadBalancer.ingress[0].hostname}' ) " ]; do
200
+ sleep 5
201
+ done
167
202
168
203
ALB_URL=$( kubectl get ingress gitpod -o json | jq -r .status.loadBalancer.ingress[0].hostname)
169
204
if [ -n " ${ALB_URL} " ]; then
0 commit comments