diff --git a/.github/workflows/test-upgrade.yaml b/.github/workflows/test-upgrade.yaml new file mode 100644 index 000000000..e991765e7 --- /dev/null +++ b/.github/workflows/test-upgrade.yaml @@ -0,0 +1,93 @@ +--- +name: Kuadrant Upgrade Test + +on: + workflow_dispatch: + inputs: + kuadrantStartVersion: + description: Kuadrant start version + required: true + type: string + kuadrantUpgradeVersion: + description: Kuadrant upgrade version + required: true + type: string + clusterServer: + description: Cluster server URL + required: false + type: string + clusterToken: + description: Cluster Server Bearer Token + required: false + type: string + kuadrantNamespace: + description: Namespace where Kuadrant is installed + required: false + default: kuadrant-system + type: string +jobs: + helm-charts-upgrade-test: + runs-on: ubuntu-latest + name: Helm Charts Upgrade Test + if: ${{ github.event_name == 'workflow_dispatch' }} + env: + KIND_CLUSTER_NAME: kuadrant-test + K8S_USER: kuadrant-admin # can be whatever, it does not matter. + CLUSTER_NAME: remote-cluster + KUADRANT_START_VERSION: v${{ inputs.kuadrantStartVersion }} + KUADRANT_UPGRADE_VERSION: v${{ inputs.kuadrantUpgradeVersion }} + steps: + - name: Check out code + uses: actions/checkout@v4 + with: + ref: ${{ env.KUADRANT_UPGRADE_VERSION }} + - name: Deploy local Kind cluster + if: ${{ github.event_name == 'workflow_dispatch' && inputs.clusterServer == '' }} + uses: helm/kind-action@v1.12.0 + with: + version: v0.23.0 + config: utils/kind-cluster.yaml + cluster_name: ${{ env.KIND_CLUSTER_NAME }} + wait: 120s + - name: Install kubectl for remote cluster + if: ${{ github.event_name == 'workflow_dispatch' && inputs.clusterServer != '' }} + uses: azure/setup-kubectl@v4 + with: + version: v1.25.3 + - name: Mask cluster token + if: ${{ github.event_name == 'workflow_dispatch' && inputs.clusterToken != '' }} + run: | + CLUSTER_TOKEN=$(jq -r '.inputs.clusterToken' $GITHUB_EVENT_PATH) + echo ::add-mask::$CLUSTER_TOKEN + echo CLUSTER_TOKEN=$CLUSTER_TOKEN >> $GITHUB_ENV + - name: Setup kubectl for remote cluster + if: ${{ github.event_name == 'workflow_dispatch' && inputs.clusterServer != '' }} + run: | + kubectl config set-credentials ${{ env.K8S_USER }}/${{ env.CLUSTER_NAME }} --token ${{ env.CLUSTER_TOKEN }} + kubectl config set-cluster ${{ env.CLUSTER_NAME }} --insecure-skip-tls-verify=true --server=${{ inputs.clusterServer }} + kubectl config set-context ${{ inputs.kuadrantNamespace }}/${{ env.CLUSTER_NAME }}/${{ env.K8S_USER }} --user=${{ env.K8S_USER }}/${{ env.CLUSTER_NAME }} --namespace=${{ inputs.kuadrantNamespace }} --cluster=${{ env.CLUSTER_NAME }} + kubectl config use-context ${{ inputs.kuadrantNamespace }}/${{ env.CLUSTER_NAME }}/${{ env.K8S_USER }} + ## makes sure cluster is up and running + - run: | + kubectl cluster-info + kubectl get nodes + - name: Deploy pre-requisites on local Kind cluster + if: ${{ github.event_name == 'workflow_dispatch' && inputs.clusterServer == '' }} + run: | + make install-metallb + make install-cert-manager + make envoy-gateway-install + make deploy-eg-gateway + - name: Install helm and add Kuadrant repo + run: | + make helm + bin/helm repo add kuadrant https://kuadrant.io/helm-charts/ --force-update + bin/helm search repo kuadrant + - name: Install starting version of Kuadrant + run: | + helm install kuadrant kuadrant/kuadrant-operator \ + --wait \ + --timeout 2m0s \ + --version ${{ inputs.kuadrantStartVersion }} \ + --namespace ${{ inputs.kuadrantNamespace }} \ + --create-namespace