Skip to content

Commit 791723a

Browse files
carsten989Carsten Schafer
andauthored
Add new cluster deployer GH action (#1096)
Signed-off-by: Carsten Schafer <Carsten.Schafer@kinarasystems.com> Co-authored-by: Carsten Schafer <Carsten.Schafer@kinarasystems.com>
1 parent 0cccf05 commit 791723a

1 file changed

Lines changed: 163 additions & 0 deletions

File tree

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
name: New Deploy QA01 OpenWIFI Cloud SDK
2+
3+
defaults:
4+
run:
5+
shell: bash
6+
7+
env:
8+
AWS_EKS_NAME: tip-openlan-lab
9+
K8S_VERSION: "1.36.1"
10+
AWS_DEFAULT_OUTPUT: json
11+
AWS_DEFAULT_REGION: ap-south-1
12+
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
13+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }}
14+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }}
15+
16+
WEBSOCKET_CERT: ${{ secrets.INSTA_WEBSOCKET_CERT }}
17+
WEBSOCKET_KEY: ${{ secrets.INSTA_WEBSOCKET_KEY }}
18+
19+
# https://stackoverflow.com/questions/59977364/github-actions-how-use-strategy-matrix-with-script
20+
# Required object fiels per environment:
21+
# - namespace - namespace suffix that will used added for the Kubernetes environment (i.e. if you pass 'test', kubernetes namespace will be named 'openwifi-test')
22+
# - deploy_method - deployment method for the chart deployment (supported methods - 'git' (will use helm-git from assembly chart) and 'bundle' (will use chart stored in the Artifactory0
23+
# - chart_version - version of chart to be deployed from assembly chart (for 'git' method git ref may be passed, for 'bundle' method version of chart may be passed)
24+
# - owgw_version - OpenWIFI Gateway version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)
25+
# - owsec_version - OpenWIFI Security version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)
26+
# - owfms_version - OpenWIFI Firmware version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)
27+
# - owprov_version - OpenWIFI Provisioning version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)
28+
# - owanalytics_version - OpenWIFI Analytics version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)
29+
# - owsub_version - OpenWIFI Subscription (Userportal) version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)
30+
# - owrrm_version - OpenWIFI radio resource management service version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)
31+
# - owgwui_version - OpenWIFI Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)
32+
# - owprovui_version - OpenWIFI Provisioning Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)
33+
testbeds: '[
34+
{
35+
"namespace": "qa01",
36+
"deploy_method": "git",
37+
"chart_version": "${{ github.event.inputs.chart_version }}",
38+
"owgw_version": "master",
39+
"owsec_version": "main",
40+
"owfms_version": "main",
41+
"owprov_version": "main",
42+
"owanalytics_version": "main",
43+
"owsub_version": "main",
44+
"owrrm_version": "main",
45+
"owgwui_version": "main",
46+
"owprovui_version": "main"
47+
}
48+
]'
49+
50+
on:
51+
workflow_dispatch:
52+
inputs:
53+
chart_version:
54+
description: 'Chart version to deploy eg: v3.1.0'
55+
required: true
56+
default: 'main'
57+
58+
jobs:
59+
generate-matrix:
60+
name: Generate matrix for build
61+
runs-on: ubuntu-latest
62+
outputs:
63+
matrix: ${{ steps.set-matrix.outputs.matrix }}
64+
steps:
65+
- name: generate-matrix
66+
id: set-matrix
67+
run: |
68+
cat >> $GITHUB_OUTPUT << EOF
69+
matrix={"include":${{ env.testbeds }}}
70+
EOF
71+
72+
deploy:
73+
name: Update OpenWIFI Cloud SDK instances
74+
runs-on: ubuntu-latest
75+
needs: [ generate-matrix ]
76+
strategy:
77+
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
78+
fail-fast: false
79+
steps:
80+
81+
- name: Checkout repo with Helm values
82+
uses: actions/checkout@v4
83+
with:
84+
repository: Telecominfraproject/wlan-cloud-ucentral-deploy
85+
path: wlan-cloud-ucentral-deploy
86+
ref: ${{ matrix.chart_version }}
87+
88+
- name: Prepare certificates from secrets
89+
working-directory: wlan-cloud-ucentral-deploy/chart/environment-values
90+
run: |
91+
echo "${{ env.WEBSOCKET_CERT }}" | base64 -d > cert.pem
92+
echo "${{ env.WEBSOCKET_KEY }}" | base64 -d > key.pem
93+
94+
- name: Fetch kubeconfig
95+
run: |
96+
aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
97+
98+
- name: Install kubectl
99+
run: |
100+
curl -s -LO "https://dl.k8s.io/release/${{ env.K8S_VERSION }}/bin/linux/amd64/kubectl"
101+
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
102+
103+
- name: Deploy OpenWIFI Cloud SDK
104+
working-directory: wlan-cloud-ucentral-deploy/chart/environment-values
105+
run: |
106+
export NAMESPACE=${{ matrix.namespace }}
107+
export DEPLOY_METHOD=${{ matrix.deploy_method }}
108+
export CHART_VERSION=${{ matrix.chart_version }}
109+
export OWGW_VERSION=${{ matrix.owgw_version }}
110+
export OWGWUI_VERSION=${{ matrix.owgwui_version }}
111+
export OWSEC_VERSION=${{ matrix.owsec_version }}
112+
export OWFMS_VERSION=${{ matrix.owfms_version }}
113+
export OWPROV_VERSION=${{ matrix.owprov_version }}
114+
export OWPROVUI_VERSION=${{ matrix.owprovui_version }}
115+
export OWANALYTICS_VERSION=${{ matrix.owanalytics_version }}
116+
export OWSUB_VERSION=${{ matrix.owsub_version }}
117+
export OWRRM_VERSION=${{ matrix.owrrm_version }}
118+
export DOMAIN=lab.open-lan.org
119+
export CERTIFICATE_ARN=arn:aws:acm:ap-south-1:289708231103:certificate/2da39707-c340-48ec-a819-0014126548af
120+
# use insta only chaincerts here
121+
export VALUES_FILE_LOCATION=values.openwifi-qa-insta.yaml,values.openwifi-qa.single-external-db.yaml,values.openwifi-qa.separate-lbs.yaml
122+
export RTTY_TOKEN=${{ secrets.RTTY_TOKEN }}
123+
export OWGW_AUTH_USERNAME=${{ secrets.UCENTRALGW_AUTH_USERNAME }}
124+
export OWGW_AUTH_PASSWORD=${{ secrets.UCENTRALGW_AUTH_PASSWORD }}
125+
export OWFMS_S3_SECRET=${{ secrets.UCENTRALFMS_S3_SECRET }}
126+
export OWFMS_S3_KEY=${{ secrets.UCENTRALFMS_S3_KEY }}
127+
export CERT_LOCATION=cert.pem
128+
export KEY_LOCATION=key.pem
129+
export OWSEC_NEW_PASSWORD=${{ secrets.OWSEC_NEW_PASSWORD }}
130+
export MAILER_USERNAME=${{ secrets.MAILER_USERNAME }}
131+
export MAILER_PASSWORD=${{ secrets.MAILER_PASSWORD }}
132+
export IPTOCOUNTRY_IPINFO_TOKEN=${{ secrets.IPTOCOUNTRY_IPINFO_TOKEN }}
133+
export EXTRA_VALUES='owgw.configProperties.logging\.level=information'
134+
./deploy.sh
135+
136+
- name: Show resource state on deployment failure
137+
if: failure()
138+
run: |
139+
kubectl get pods --namespace openwifi-${{ matrix.namespace }}
140+
kubectl get services --namespace openwifi-${{ matrix.namespace }}
141+
kubectl get persistentvolumeclaims --namespace openwifi-${{ matrix.namespace }}
142+
143+
- name: Describe pods on deployment failure
144+
if: failure()
145+
run: |
146+
kubectl describe pods --namespace openwifi-${{ matrix.namespace }}
147+
148+
- name: Describe services on deployment failure
149+
if: failure()
150+
run: |
151+
kubectl describe services --namespace openwifi-${{ matrix.namespace }}
152+
153+
- name: Describe persistentvolumeclaims on deployment failure
154+
if: failure()
155+
run: |
156+
kubectl describe persistentvolumeclaims --namespace openwifi-${{ matrix.namespace }}
157+
158+
- name: Rollback Cloud SDK
159+
#if: failure()
160+
# don't roll back so easier to diagnose issues
161+
if: false
162+
run: |
163+
helm rollback tip-openwifi --namespace openwifi-${{ matrix.namespace }} --wait --timeout 20m

0 commit comments

Comments
 (0)