Skip to content

Commit 50f9007

Browse files
authored
Merge branch 'main' into sr-rm-storage-config
2 parents 92675e6 + 096d9a1 commit 50f9007

File tree

103 files changed

+1192
-642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1192
-642
lines changed

.env.sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ AWS_ACCESS_KEY_ID=''
2121
AWS_SECRET_ACCESS_KEY=''
2222

2323

24-
OTOMI_CHARTS_URL='https://github.com/redkubes/otomi-charts.git'
24+
OTOMI_CHARTS_URL='https://github.com/linode/apl-charts.git'

.github/workflows/integration.yml

+13-172
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
cloud_provider:
66
description: Provider where Otomi will be installed
77
type: string
8-
default: scaleway
8+
default: linode
99
kubernetes_versions:
1010
description: "Kubernetes versions (JSON formatted list e.g.: ['1.27'])"
1111
type: string
@@ -50,7 +50,6 @@ on:
5050
options:
5151
- scaleway
5252
- linode
53-
- digitalocean
5453
default: 'linode'
5554
kubernetes_versions:
5655
description: 'Kubernetes version'
@@ -123,16 +122,16 @@ on:
123122
default: 'yes'
124123
env:
125124
CACHE_REGISTRY: ghcr.io
126-
CACHE_REPO: redkubes/otomi-core
125+
CACHE_REPO: linode/apl-core
127126
REPO: otomi/core
128-
GIT_USER: redkubesbot
127+
GIT_USER: svcAPLBot
129128
SCALEWAY_NODE_TYPE: PRO2-M
130129
SCALEWAY_NODE_POOL_MIN_SIZE: 3
131130
SCALEWAY_VPC_ID: e1019b0c-7c7d-49ef-86e4-b02f55b2e0d3
132-
DIGITALOCEAN_NODE_SIZE: s-8vcpu-16gb
133-
DIGITALOCEAN_NODE_POOL_MIN_SIZE: 3
134131
CHECK_CONTEXT: continuous-integration/integration-test
135132
COMMIT_ID: '${{ github.event.pull_request.head.sha || github.sha }}'
133+
BOT_EMAIL: ${{ vars.BOT_EMAIL }}
134+
BOT_USERNAME: ${{ vars.BOT_USERNAME }}
136135

137136
jobs:
138137
preprocess-input:
@@ -175,30 +174,6 @@ jobs:
175174
echo $versions
176175
echo "versions=$versions" >> $GITHUB_OUTPUT
177176
178-
preprocess-digitalocean-input:
179-
needs: preprocess-input
180-
if: ${{ inputs.cloud_provider == 'digitalocean' }}
181-
name: Preprocess input variables for digital ocean
182-
runs-on: ubuntu-latest
183-
outputs:
184-
kubernetes_versions: ${{ steps.k8s-versions.outputs.versions }}
185-
steps:
186-
- name: Install doctl
187-
uses: digitalocean/action-doctl@v2
188-
with:
189-
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
190-
- id: k8s-versions
191-
name: Process k8s version input
192-
run: |
193-
if [ -z '${{ inputs.kubernetes_versions }}' ]; then
194-
echo "Kubernetes versions not specified, determine DO supported versions"
195-
versions=`doctl kubernetes options versions -o json | jq -ce 'map(.kubernetes_versions)'`
196-
else
197-
versions='${{ inputs.kubernetes_versions }}'
198-
fi
199-
echo $versions
200-
echo "versions=$versions" >> $GITHUB_OUTPUT
201-
202177
preprocess-linode-input:
203178
needs: preprocess-input
204179
if: ${{ inputs.cloud_provider == 'linode' }}
@@ -283,16 +258,16 @@ jobs:
283258
run: |
284259
kubectl create secret docker-registry reg-otomi-github \
285260
--docker-server=${{ env.CACHE_REGISTRY }} \
286-
--docker-username=${{ env.GIT_USER }} \
287-
--docker-password='${{ secrets.NPM_TOKEN }}'
261+
--docker-username=${{ env.BOT_USERNAME }} \
262+
--docker-password='${{ secrets.BOT_PULL_TOKEN }}'
288263
- name: Checkout
289264
uses: actions/checkout@v4
290265
- name: Prepare Otomi chart
291266
if: ${{ inputs.install_profile != 'no-otomi' }}
292267
run: |
293268
ref=${{ github.event.pull_request.head.ref || github.ref }}
294269
tag=${ref##*/}
295-
sed --in-place "s/APP_VERSION_PLACEHOLDER/$tag/g" chart/otomi/Chart.yaml
270+
sed --in-place "s/APP_VERSION_PLACEHOLDER/$tag/g" chart/apl/Chart.yaml
296271
sed --in-place "s/CONTEXT_PLACEHOLDER/${{ env.SCALEWAY_CLUSTER_CONTEXT }}/g" tests/integration/${{ inputs.install_profile }}.yaml
297272
sed --in-place "s/OTOMI_VERSION_PLACEHOLDER/${GITHUB_REF##*/}/g" tests/integration/${{ inputs.install_profile }}.yaml
298273
touch values-container-registry.yaml
@@ -325,7 +300,7 @@ jobs:
325300
[[ '${{ inputs.certificate }}' == 'letsencrypt_staging' ]] && echo "$LETSENCRYPT_STAGING" >> values.yaml
326301
[[ '${{ inputs.certificate }}' == 'letsencrypt_production' ]] && echo "$LETSENCRYPT_PRODUCTION" >> values.yaml
327302
328-
install_args="--wait --wait-for-jobs --timeout 90m0s otomi chart/otomi \
303+
install_args="--wait --wait-for-jobs --timeout 90m0s otomi chart/apl \
329304
--values tests/integration/${{ inputs.install_profile }}.yaml \
330305
--values values-container-registry.yaml
331306
--values values.yaml \
@@ -362,140 +337,6 @@ jobs:
362337
SLACK_TITLE: Scheduled integration tests
363338
SLACK_USERNAME: RedKubesBot
364339

365-
run-integration-test-digitalocean:
366-
if: ${{ inputs.cloud_provider == 'digitalocean' }}
367-
name: Run integration test on digitalocean cluster
368-
needs: preprocess-digitalocean-input
369-
runs-on: ubuntu-latest
370-
strategy:
371-
fail-fast: false
372-
matrix:
373-
kubernetes_versions: ${{ fromJSON(needs.preprocess-digitalocean-input.outputs.kubernetes_versions) }}
374-
max-parallel: 5
375-
steps:
376-
- name: Install doctl
377-
uses: digitalocean/action-doctl@v2
378-
with:
379-
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
380-
- name: Set k8s cluster name
381-
run: |
382-
echo "DIGITALOCEAN_CLUSTER_NAME=$(echo ${{ github.actor }} | tr '[:upper:]' '[:lower:]')-$(TZ='GMT-2' date +'%m-%d-%H-%M')" >> $GITHUB_ENV
383-
# Cluster name must be no longer than 63 characters
384-
- name: Determine exact k8s version
385-
run: |
386-
echo "DIGITALOCEAN_K8S_VERSION=$(doctl kubernetes options versions -o json | jq -r '.[] | select(.kubernetes_version | startswith("${{ matrix.kubernetes_versions }}")) | .slug')" >> $GITHUB_ENV
387-
388-
- name: Get default VPC for region
389-
run: |
390-
echo DIGITALOCEAN_VPC_UUID=`doctl vpcs list -o json | jq -re 'map(select((.region == "ams3") and .default)) | .[0] | .id'` >> $GITHUB_ENV
391-
- name: Create k8s cluster for testing
392-
run: |
393-
doctl kubernetes cluster create ${{ env.DIGITALOCEAN_CLUSTER_NAME }} \
394-
--tag source:github \
395-
--ha \
396-
--maintenance-window any=03:00 \
397-
--region ams3 \
398-
--vpc-uuid ${{ env.DIGITALOCEAN_VPC_UUID }} \
399-
--node-pool "name=int-test-${{ strategy.job-index }}-${{ env.COMMIT_ID }};size=${{ env.DIGITALOCEAN_NODE_SIZE }};tag=integration-test;auto-scale=true;min-nodes=${{ env.DIGITALOCEAN_NODE_POOL_MIN_SIZE }};max-nodes=5;count=${{ env.DIGITALOCEAN_NODE_POOL_MIN_SIZE }};" \
400-
--version ${{ env.DIGITALOCEAN_K8S_VERSION }} \
401-
--wait
402-
- name: Retrieve cluster id
403-
run: echo DIGITALOCEAN_CLUSTER_ID=`doctl kubernetes cluster get ${{ env.DIGITALOCEAN_CLUSTER_NAME }} --format ID --no-header` >> $GITHUB_ENV
404-
- name: Assign the cluster to the project
405-
run: doctl projects resources assign ${{ secrets.DIGITALOCEAN_PROJECT }} --resource=do:kubernetes:${{ env.DIGITALOCEAN_CLUSTER_ID }}
406-
- name: Save kubectl config with auth token
407-
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 36000 ${{ env.DIGITALOCEAN_CLUSTER_NAME }}
408-
- name: Get kubectl environment
409-
run: echo DIGITALOCEAN_CLUSTER_CONTEXT=`kubectl config current-context` >> $GITHUB_ENV
410-
- name: Create image pull secret on test cluster
411-
run: |
412-
kubectl create secret docker-registry reg-otomi-github \
413-
--docker-server=${{ env.CACHE_REGISTRY }} \
414-
--docker-username=${{ env.GIT_USER }} \
415-
--docker-password='${{ secrets.NPM_TOKEN }}'
416-
- name: Checkout
417-
uses: actions/checkout@v4
418-
- name: Prepare Otomi chart
419-
if: ${{ inputs.install_profile != 'no-otomi' }}
420-
run: |
421-
ref=${{ github.event.pull_request.head.ref || github.ref }}
422-
tag=${ref##*/}
423-
sed --in-place "s/APP_VERSION_PLACEHOLDER/$tag/g" chart/otomi/Chart.yaml
424-
sed --in-place "s/CONTEXT_PLACEHOLDER/${{ env.DIGITALOCEAN_CLUSTER_CONTEXT }}/g" tests/integration/${{ inputs.install_profile }}.yaml
425-
sed --in-place "s/OTOMI_VERSION_PLACEHOLDER/${GITHUB_REF##*/}/g" tests/integration/${{ inputs.install_profile }}.yaml
426-
touch values-container-registry.yaml
427-
428-
# If a pipeline installs Otomi from the semver tag then pull container image from DockerHub
429-
[[ ${GITHUB_REF##*/} =~ ^v[0-9].+$ ]] && exit 0
430-
431-
# Pull image from cache registry
432-
cat << EOF > values-container-registry.yaml
433-
imageName: "${{ env.CACHE_REGISTRY }}/${{ env.CACHE_REPO }}"
434-
imagePullSecretNames:
435-
- reg-otomi-github
436-
EOF
437-
- name: Otomi install
438-
if: ${{ inputs.install_profile != 'no-otomi' }}
439-
env:
440-
AZ_DNS: ${{ secrets.AZ_DNS }}
441-
AZ_KMS: ${{ secrets.AZ_KMS }}
442-
AZ_OIDC: ${{ secrets.AZ_OIDC }}
443-
LETSENCRYPT_STAGING: ${{ secrets.LETSENCRYPT_STAGING }}
444-
LETSENCRYPT_PRODUCTION: ${{ secrets.LETSENCRYPT_PRODUCTION }}
445-
OTOMI_LICENSE: ${{ secrets.OTOMI_LICENSE }}
446-
run: |
447-
domainSuffix=''
448-
touch values.yaml
449-
[[ '${{ inputs.license }}' == 'yes' ]] && echo "$OTOMI_LICENSE" >> values.yaml
450-
[[ '${{ inputs.dns }}' == 'az_dns' ]] && echo "$AZ_DNS" >> values.yaml && domainSuffix='--set cluster.domainSuffix=tst-${{ github.run_id }}.aks.redkubes.net'
451-
[[ '${{ inputs.kms }}' == 'az_kms' ]] && echo "$AZ_KMS" >> values.yaml
452-
[[ '${{ inputs.oidc }}' == 'az_oidc' ]] && echo "$AZ_OIDC" >> values.yaml
453-
[[ '${{ inputs.certificate }}' == 'letsencrypt_staging' ]] && echo "$LETSENCRYPT_STAGING" >> values.yaml
454-
[[ '${{ inputs.certificate }}' == 'letsencrypt_production' ]] && echo "$LETSENCRYPT_PRODUCTION" >> values.yaml
455-
456-
install_args="--wait --wait-for-jobs --timeout 90m0s otomi chart/otomi \
457-
--values tests/integration/${{ inputs.install_profile }}.yaml \
458-
--values values-container-registry.yaml
459-
--values values.yaml \
460-
--set cluster.provider=${{ inputs.cloud_provider }}
461-
$domainSuffix"
462-
463-
[[ '${{ inputs.generate_password }}' == 'no' ]] && install_args="$install_args --set otomi.adminPassword=welcomeotomi"
464-
465-
helm install $install_args
466-
467-
- name: Gather k8s events on failure
468-
if: failure()
469-
run: |
470-
kubectl get events --sort-by='.lastTimestamp' -A
471-
- name: Gather k8s pods on failure
472-
if: failure()
473-
run: |
474-
kubectl get pods -A -o wide
475-
- name: Gather otomi logs on failure
476-
if: failure()
477-
run: |
478-
kubectl logs jobs/otomi --tail 150
479-
- name: Gather otomi-e2e logs on failure
480-
if: failure()
481-
run: |
482-
kubectl logs -n maintenance -l app.kubernetes.io/instance=job-e2e --tail 15000
483-
- name: Remove the test cluster
484-
if: always()
485-
run: |
486-
[[ "${{ inputs.cluster_persistence }}" == "preserve" ]] && echo "The cluster ${{ env.DIGITALOCEAN_CLUSTER_NAME }} will NOT be destroyed!!" && exit 0
487-
doctl kubernetes cluster delete ${{ env.DIGITALOCEAN_CLUSTER_NAME }} -f --dangerous
488-
- name: Slack Notification
489-
if: always()
490-
uses: rtCamp/action-slack-notify@v2
491-
env:
492-
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
493-
SLACK_CHANNEL: github-ci
494-
SLACK_COLOR: ${{ job.status }}
495-
SLACK_ICON: https://github.com/redkubes.png?size=48
496-
SLACK_TITLE: Scheduled integration tests
497-
SLACK_USERNAME: RedKubesBot
498-
499340
run-integration-test-linode:
500341
if: ${{ inputs.cloud_provider == 'linode' }}
501342
name: Run integration test on linode cluster
@@ -572,16 +413,16 @@ jobs:
572413
run: |
573414
kubectl create secret docker-registry reg-otomi-github \
574415
--docker-server=${{ env.CACHE_REGISTRY }} \
575-
--docker-username=${{ env.GIT_USER }} \
576-
--docker-password='${{ secrets.NPM_TOKEN }}'
416+
--docker-username=${{ env.BOT_USERNAME }} \
417+
--docker-password='${{ secrets.BOT_PULL_TOKEN }}'
577418
- name: Checkout
578419
uses: actions/checkout@v4
579420
- name: Prepare Otomi chart
580421
if: ${{ inputs.install_profile != 'no-otomi' }}
581422
run: |
582423
ref=${{ github.event.pull_request.head.ref || github.ref }}
583424
tag=${ref##*/}
584-
sed --in-place "s/APP_VERSION_PLACEHOLDER/$tag/g" chart/otomi/Chart.yaml
425+
sed --in-place "s/APP_VERSION_PLACEHOLDER/$tag/g" chart/apl/Chart.yaml
585426
sed --in-place "s/CONTEXT_PLACEHOLDER/${{ env.LINODE_CLUSTER_CONTEXT }}/g" tests/integration/${{ inputs.install_profile }}.yaml
586427
sed --in-place "s/OTOMI_VERSION_PLACEHOLDER/${GITHUB_REF##*/}/g" tests/integration/${{ inputs.install_profile }}.yaml
587428
touch values-container-registry.yaml
@@ -614,7 +455,7 @@ jobs:
614455
[[ '${{ inputs.certificate }}' == 'letsencrypt_staging' ]] && echo "$LETSENCRYPT_STAGING" >> values.yaml
615456
[[ '${{ inputs.certificate }}' == 'letsencrypt_production' ]] && echo "$LETSENCRYPT_PRODUCTION" >> values.yaml
616457
617-
install_args="--wait --wait-for-jobs --timeout 90m0s otomi chart/otomi \
458+
install_args="--wait --wait-for-jobs --timeout 90m0s otomi chart/apl \
618459
--values tests/integration/${{ inputs.install_profile }}.yaml \
619460
--values values-container-registry.yaml
620461
--values values.yaml \

0 commit comments

Comments
 (0)