-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into WIFI-13422
- Loading branch information
Showing
9 changed files
with
743 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
name: Update CGW01 OpenLAN Cloud Gateway on tip-wlan-main | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
AWS_EKS_NAME: tip-wlan-main | ||
AWS_DEFAULT_OUTPUT: json | ||
AWS_DEFAULT_REGION: ap-south-1 | ||
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }} | ||
|
||
# # https://stackoverflow.com/questions/59977364/github-actions-how-use-strategy-matrix-with-script | ||
# # Required object fiels per environment: | ||
# # - namespace - namespace suffix that will used added for the Kubernetes environment (i.e. if you pass 'test', kubernetes namespace will be named 'openlan-test') | ||
# # - cgw_version - OpenLAN Cloud Gateway version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) | ||
# # - just_component - if true then deploy only cgw chart | ||
testbeds: '[ | ||
{ | ||
"namespace": "cgw01", | ||
"chart_version": "main", | ||
"cgw_version": "main", | ||
"just_component": "false" | ||
} | ||
]' | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
just_component: | ||
default: 'false' | ||
description: 'Just deploy component, not all the other services' | ||
required: true | ||
id: | ||
description: 'run identifier' | ||
required: false | ||
|
||
jobs: | ||
id: | ||
name: Workflow ID Provider | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ${{ github.event.inputs.id }} | ||
run: echo run identifier ${{ inputs.id }} | ||
|
||
generate-matrix: | ||
name: Generate matrix for build | ||
runs-on: ubuntu-latest | ||
needs: | ||
- id | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- name: generate-matrix | ||
id: set-matrix | ||
run: | | ||
cat >> $GITHUB_OUTPUT << EOF | ||
matrix={"include":${{ env.testbeds }}} | ||
EOF | ||
deploy: | ||
name: Update OpenLAN Cloud SDK instances | ||
runs-on: ubuntu-latest | ||
needs: | ||
- id | ||
- generate-matrix | ||
strategy: | ||
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }} | ||
fail-fast: false | ||
steps: | ||
- name: Checkout repo with Helm values | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: Telecominfraproject/wlan-cloud-ucentral-deploy | ||
path: wlan-cloud-ucentral-deploy | ||
ref: ${{ matrix.chart_version }} | ||
|
||
- name: Fetch kubeconfig | ||
run: | | ||
aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }} | ||
- name: Install kubectl, helmfile and plugins | ||
run: | | ||
curl -s -LO "https://dl.k8s.io/release/v1.27.14/bin/linux/amd64/kubectl" | ||
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | ||
# Download the binary | ||
curl -s -LO "https://github.com/getsops/sops/releases/download/v3.8.1/sops-v3.8.1.linux.amd64" | ||
sudo install -o root -g root -m 0755 sops-v3.8.1.linux.amd64 /usr/local/bin/sops | ||
curl -s -LO "https://github.com/helmfile/helmfile/releases/download/v0.165.0/helmfile_0.165.0_linux_amd64.tar.gz" | ||
tar xvzf helmfile_0.165.0_linux_amd64.tar.gz helmfile | ||
sudo install -o root -g root -m 0755 helmfile /usr/local/bin/helmfile | ||
helm plugin install https://github.com/aslafy-z/helm-git --version 0.16.0 | ||
helm plugin install https://github.com/databus23/helm-diff | ||
helm plugin install https://github.com/jkroepke/helm-secrets | ||
- name: Deploy OpenLAN Cloud Gateway and services | ||
if: ${{ github.event.inputs.just_component }} == "false" | ||
working-directory: wlan-cloud-ucentral-deploy/cgw | ||
run: | | ||
# service components can't be reinstalled easily | ||
helm ls -n ${{ matrix.namespace }} | ||
if ! helm ls -n ${{ matrix.namespace }} | grep "^kafka" >/dev/null ; then | ||
helmfile --environment ${{ matrix.namespace }} apply | ||
else | ||
helmfile --environment ${{ matrix.namespace }} -l app=cgw apply | ||
fi | ||
- name: Deploy OpenLAN Cloud Gateway only | ||
if: ${{ github.event.inputs.just_component }} == "true" | ||
working-directory: wlan-cloud-ucentral-deploy/cgw | ||
run: | | ||
helmfile --environment ${{ matrix.namespace }} -l app=cgw apply | ||
- name: Show resource state on deployment failure | ||
if: failure() | ||
run: | | ||
echo "Pods:" | ||
kubectl get pods --namespace openlan-${{ matrix.namespace }} | ||
echo "Pod Descriptions:" | ||
kubectl describe pods --namespace openlan-${{ matrix.namespace }} | ||
echo "Services:" | ||
kubectl get services --namespace openlan-${{ matrix.namespace }} | ||
echo "Service Descriptions:" | ||
kubectl describe services --namespace openlan-${{ matrix.namespace }} | ||
echo "PVCs:" | ||
kubectl get persistentvolumeclaims --namespace openlan-${{ matrix.namespace }} | ||
echo "PVC Descriptions:" | ||
kubectl describe persistentvolumeclaims --namespace openlan-${{ matrix.namespace }} | ||
# - name: Rollback Cloud SDK | ||
# if: failure() | ||
# run: | | ||
# helm rollback tip-openlan --namespace openlan-${{ matrix.namespace }} --wait --timeout 20m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.