From d4fe9004e49b66f1a4b68e4694d6ad81ac2c837c Mon Sep 17 00:00:00 2001 From: Carsten Schafer Date: Wed, 29 May 2024 15:46:23 -0400 Subject: [PATCH] Add new workflow to clean up a namespace Signed-off-by: Carsten Schafer --- .../workflows/ucentralgw-cluster-cleanup.yaml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/ucentralgw-cluster-cleanup.yaml diff --git a/.github/workflows/ucentralgw-cluster-cleanup.yaml b/.github/workflows/ucentralgw-cluster-cleanup.yaml new file mode 100644 index 000000000..d1e6d75d4 --- /dev/null +++ b/.github/workflows/ucentralgw-cluster-cleanup.yaml @@ -0,0 +1,57 @@ +name: Cleanup OpenWIFI Cloud SDK Namespace + +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 }} + +on: + workflow_dispatch: + inputs: + namespace: + default: 'none' + description: 'Namespace to clean up eg. dev01' + required: true + full: + default: 'false' + description: 'Remove namespace if set to true' + required: false + +jobs: + undeploy: + name: Cleanup OpenWIFI Cloud SDK Namespace + runs-on: ubuntu-latest + steps: + + - name: Checkout repo with Helm values + uses: actions/checkout@v4 + with: + repository: Telecominfraproject/wlan-cloud-ucentral-deploy + path: wlan-cloud-ucentral-deploy + ref: main + + - name: Fetch kubeconfig + run: | + aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }} + + - name: Install kubectl + 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 + + - name: Undeploy OpenWIFI Cloud SDK + working-directory: wlan-cloud-ucentral-deploy/chart/environment-values + run: | + export NAMESPACE=${{ inputs.namespace }} + opts="" + if [[ "${{ inputs.full }}" == "true" ]] ; then + opts="full" + fi + ./cleanup.sh $opts