43
43
options :
44
44
- minimal
45
45
- minimal-with-team
46
- - monitoring-with-team
47
46
- full
48
47
- upgrade
48
+ - no-apl
49
49
domain_zone :
50
50
type : choice
51
51
description : ' Select Domain Zone'
52
52
options :
53
53
- Zone-1
54
54
- Zone-2
55
+ - Random
56
+ - DNS-Integration
55
57
kms :
56
58
type : choice
57
59
description : Should APL encrypt secrets in values repo (DNS or KMS is turned on)?
@@ -117,11 +119,14 @@ jobs:
117
119
case "${{ inputs.domain_zone }}" in
118
120
"Zone-1") LINODE_CLUSTER_NAME=${{ github.actor }}-1 ;;
119
121
"Zone-2") LINODE_CLUSTER_NAME=${{ github.actor }}-2 ;;
122
+ "Random") LINODE_CLUSTER_NAME=${{ github.actor }}-$RANDOM ;;
123
+ "DNS-Integration") LINODE_CLUSTER_NAME=apl-test-${{ inputs.install_profile }} ;;
120
124
esac
121
-
125
+ [[ ${{ inputs.install_profile }} == 'no-apl' ]] && LINODE_CLUSTER_NAME=$LINODE_CLUSTER_NAME-no-apl
122
126
if [[ $(linode-cli lke clusters-list --json | jq --arg name "$LINODE_CLUSTER_NAME" '[.[] | select(.label == $name)] | length > 0') == "true" ]]; then
123
- echo "An LKE cluster for Zone-1 named \"$LINODE_CLUSTER_NAME\" already exists."
124
- echo "Please delete the cluster before recreating it. Exiting workflow..."
127
+ echo "An LKE cluster with the same name ($LINODE_CLUSTER_NAME) already exists."
128
+ echo "Visit https://cloud.linode.com/kubernetes/clusters to delete your cluster"
129
+ echo "Exiting workflow..."
125
130
exit 1
126
131
fi
127
132
- id : k8s-versions
@@ -155,30 +160,33 @@ jobs:
155
160
case "${{ inputs.domain_zone }}" in
156
161
"Zone-1") LINODE_CLUSTER_NAME=${{ github.actor }}-1 ;;
157
162
"Zone-2") LINODE_CLUSTER_NAME=${{ github.actor }}-2 ;;
158
- "DNS-Integration") LINODE_CLUSTER_NAME=nightly-apl-test-$RANDOM ;;
163
+ "Random") LINODE_CLUSTER_NAME=${{ github.actor }}-$RANDOM ;;
164
+ "DNS-Integration") LINODE_CLUSTER_NAME=apl-test-${{ inputs.install_profile }} ;;
159
165
esac
166
+ [[ ${{ inputs.install_profile }} == 'no-apl' ]] && LINODE_CLUSTER_NAME=$LINODE_CLUSTER_NAME-no-apl
160
167
echo LINODE_CLUSTER_NAME=$LINODE_CLUSTER_NAME >> $GITHUB_ENV
161
168
- name : Determine exact k8s version
162
169
run : |
163
170
echo LINODE_K8S_VERSION=$(linode-cli lke versions-list --json | jq -ce --arg version "$(echo ${{ matrix.kubernetes_versions }} | sed -E 's/^([0-9]+\.[0-9])$/\10/')" '.[] | select(.id | tostring | startswith($version)) | .id') >> $GITHUB_ENV
164
- - name : Creating domain for scheduled integration test
171
+ - name : Determine domain name to use for scheduled integration test
165
172
env :
166
173
EDGEDNS_ZONE : ${{ secrets.EDGEDNS_ZONE }}
167
- if : ${{ inputs.domain_zone == 'DNS-Integration' }}
174
+ if : ${{ inputs.domain_zone == 'DNS-Integration' && inputs.install_profile != 'no-apl' }}
168
175
run : |
169
- # Generating a random 5 char string
170
176
RAND=$(openssl rand -hex 4)
171
177
DOMAIN="integration-${RAND}.${EDGEDNS_ZONE}"
172
178
echo "::add-mask::$DOMAIN"
173
179
echo DOMAIN=$DOMAIN >> $GITHUB_ENV
174
-
175
- - name : Determine domain name to use
176
- if : ${{ inputs.domain_zone != 'DNS-Integration' }}
180
+ - name : Determine domain name
181
+ if : ${{ inputs.domain_zone != 'DNS-Integration' && inputs.install_profile != 'no-apl' }}
182
+ env :
183
+ EDGEDNS_ZONE : ${{ secrets.EDGEDNS_ZONE }}
177
184
run : |
178
185
# Mapping of domain_zone to domain names
179
186
case "${{ inputs.domain_zone }}" in
180
- "Zone-1") DOMAIN=$(jq '."${{ github.actor }}"[0]' <<< ${{ env.DEV_DOMAINS }}) ;;
181
- "Zone-2") DOMAIN=$(jq '."${{ github.actor }}"[1]' <<< ${{ env.DEV_DOMAINS }}) ;;
187
+ "Zone-1") DOMAIN=$(jq -r '."${{ github.actor }}"[0]' <<< ${{ env.DEV_DOMAINS }}) ;;
188
+ "Zone-2") DOMAIN=$(jq -r '."${{ github.actor }}"[1]' <<< ${{ env.DEV_DOMAINS }}) ;;
189
+ "Random") DOMAIN="$(openssl rand -hex 4)$(date +"%d%m%y").${EDGEDNS_ZONE}" ;;
182
190
esac
183
191
184
192
echo "::add-mask::$DOMAIN"
@@ -217,6 +225,7 @@ jobs:
217
225
sleep 30
218
226
done
219
227
- name : Save kubectl config with auth token and Get kubectl environment and create docker secret
228
+ if : ${{ inputs.install_profile != 'no-apl' }}
220
229
run : |
221
230
# Get the kubeconfig from linode-cli
222
231
kubeconfig=$(linode-cli lke kubeconfig-view ${{ env.LINODE_CLUSTER_ID }} --text | sed 1d | base64 --decode)
@@ -235,14 +244,17 @@ jobs:
235
244
echo "Kubectl context set to linode"
236
245
echo LINODE_CLUSTER_CONTEXT=`kubectl config current-context` >> $GITHUB_ENV
237
246
- name : Create image pull secret on test cluster
247
+ if : ${{ inputs.install_profile != 'no-apl' }}
238
248
run : |
239
249
kubectl create secret docker-registry reg-otomi-github \
240
250
--docker-server=${{ env.CACHE_REGISTRY }} \
241
251
--docker-username=${{ env.BOT_USERNAME }} \
242
252
--docker-password='${{ secrets.BOT_PULL_TOKEN }}'
243
253
- name : Checkout
254
+ if : ${{ inputs.install_profile != 'no-apl' }}
244
255
uses : actions/checkout@v4
245
256
- name : Prepare APL chart
257
+ if : ${{ inputs.install_profile != 'no-apl' }}
246
258
run : |
247
259
ref=${{ github.event.pull_request.head.ref || github.ref }}
248
260
tag=${ref##*/}
@@ -261,6 +273,7 @@ jobs:
261
273
- reg-otomi-github
262
274
EOF
263
275
- name : APL install
276
+ if : ${{ inputs.install_profile != 'no-apl' }}
264
277
env :
265
278
LETSENCRYPT_STAGING : ${{ secrets.LETSENCRYPT_STAGING }}
266
279
LETSENCRYPT_PRODUCTION : ${{ secrets.LETSENCRYPT_PRODUCTION }}
@@ -325,10 +338,13 @@ jobs:
325
338
done
326
339
327
340
pip3 install edgegrid-python requests
328
- python3 bin/edgedns_A_record.py create $DOMAIN $PUB_IP
341
+ python3 bin/edgedns_A_record.py create "*.${DOMAIN}" $PUB_IP || \
342
+ (echo "Will try to recreate it" && \
343
+ python3 bin/edgedns_A_record.py delete "*.${DOMAIN}" && \
344
+ python3 bin/edgedns_A_record.py create "*.${DOMAIN}" $PUB_IP)
329
345
330
- wait $HELM_PID
331
346
347
+ wait $HELM_PID
332
348
- name : Gather k8s events on failure
333
349
if : failure()
334
350
run : |
@@ -340,25 +356,25 @@ jobs:
340
356
- name : Gather APL logs on failure
341
357
if : failure()
342
358
run : |
343
- kubectl logs jobs/otomi --tail 150
359
+ kubectl logs jobs/otomi-apl --tail 150
344
360
- name : Gather otomi-e2e logs on failure
345
361
if : failure()
346
362
run : |
347
363
kubectl logs -n maintenance -l app.kubernetes.io/instance=job-e2e --tail 15000
348
364
- name : Remove the test cluster
349
- if : ${{ inputs.domain_zone == 'DNS-Integration' }}
365
+ if : ${{ always() && inputs.domain_zone == 'DNS-Integration' }}
350
366
run : |
351
367
linode-cli lke cluster-delete ${{ env.LINODE_CLUSTER_ID }}
352
368
- name : Delete Domain
353
- if : ${{ inputs.domain_zone == 'DNS-Integration' }}
369
+ if : ${{ always() && inputs.domain_zone == 'DNS-Integration' }}
354
370
env :
355
371
EDGEDNS_ACCESS_TOKEN : ${{ secrets.EDGEDNS_ACCESS_TOKEN }}
356
372
EDGEDNS_CLIENT_TOKEN : ${{ secrets.EDGEDNS_CLIENT_TOKEN }}
357
373
EDGEDNS_CLIENT_SECRET : ${{ secrets.EDGEDNS_CLIENT_SECRET }}
358
374
EDGEDNS_ZONE : ${{ secrets.EDGEDNS_ZONE }}
359
375
EDGEDNS_HOST : ${{ secrets.EDGEDNS_HOST }}
360
376
run : |
361
- python3 bin/edgedns_A_record.py delete $ DOMAIN
377
+ python3 bin/edgedns_A_record.py delete "*.${ DOMAIN}"
362
378
- name : Slack Notification
363
379
if : always()
364
380
uses : rtCamp/action-slack-notify@v2
0 commit comments