Kuadrant Upgrade Test #26
Workflow file for this run
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
--- | |
name: Kuadrant Upgrade Test | |
on: | |
workflow_dispatch: | |
inputs: | |
kuadrantStartVersion: | |
description: Kuadrant start version (format X.Y.Z) | |
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 | |
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 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install helm | |
run: | | |
make helm | |
- name: Install yq tool | |
run: | | |
# following sub-shells running make target should have yq already installed | |
make yq | |
- name: Determine upgrade version | |
id: upgrade-version | |
run: | | |
version=`make helm-print-chart-version` | |
echo version=$version >> $GITHUB_OUTPUT | |
- name: Print versions | |
run: echo "Installing version ${{ inputs.kuadrantStartVersion }}, upgrading to version ${{ steps.upgrade-version.outputs.version }}" | |
- name: Deploy local Kind cluster | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.clusterServer == '' }} | |
uses: helm/[email protected] | |
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.31.0 | |
- 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 | |
make helm-add-kuadrant-repo | |
bin/helm search repo kuadrant | |
- name: Install Kuadrant ${{ inputs.kuadrantStartVersion }} | |
run: | | |
bin/helm install kuadrant kuadrant/kuadrant-operator \ | |
--wait \ | |
--timeout 3m0s \ | |
--version ${{ inputs.kuadrantStartVersion }} \ | |
--namespace ${{ inputs.kuadrantNamespace }} \ | |
--create-namespace | |
- name: Deploy Kuadrant | |
run: | | |
kubectl -n ${{ inputs.kuadrantNamespace }} apply -f - <<EOF | |
apiVersion: kuadrant.io/v1beta1 | |
kind: Kuadrant | |
metadata: | |
name: kuadrant | |
spec: {} | |
EOF | |
- name: Verify Kuadrant installation | |
run: | | |
kubectl wait --timeout=300s --for=condition=Ready kuadrant kuadrant -n ${{ inputs.kuadrantNamespace }} | |
echo "kuadrant installation ✅" | |
- name: Build local chart dependencies for version ${{ steps.upgrade-version.outputs.version }} | |
run: | | |
make helm-dependency-build | |
- name: Start upgrade to kuadrant ${{ steps.upgrade-version.outputs.version }} | |
run: | | |
bin/helm upgrade kuadrant charts/kuadrant-operator \ | |
--wait \ | |
--timeout 3m0s \ | |
--namespace ${{ inputs.kuadrantNamespace }} | |
- name: Determine installed chart | |
id: installed-version-after-upgrade | |
run: | | |
installed_version=`make helm-print-installed-chart-version` | |
echo installed_version=$installed_version >> $GITHUB_OUTPUT | |
- name: Print versions | |
run: echo "Installed version ${{ steps.installed-version-after-upgrade.outputs.installed_version }}, expected version ${{steps.upgrade-version.outputs.version}}" | |
- name: Fail when installed version is not the upgraded one | |
if: ${{ steps.installed-version-after-upgrade.outputs.installed_version != steps.upgrade-version.outputs.version }} | |
run: exit 1 | |
- name: Verify Kuadrant upgrade | |
run: | | |
kubectl wait --timeout=300s --for=condition=Ready kuadrant kuadrant -n ${{ inputs.kuadrantNamespace }} | |
echo "kuadrant upgrade ✅" | |
olm-upgrade-test: | |
runs-on: ubuntu-latest | |
name: OLM 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 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install helm | |
run: | | |
make helm | |
- name: Install yq tool | |
run: | | |
# following sub-shells running make target should have yq already installed | |
make yq | |
- name: Deploy local Kind cluster | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.clusterServer == '' }} | |
uses: helm/[email protected] | |
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.31.0 | |
- 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 OLM on local Kind cluster | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.clusterServer == '' }} | |
run: | | |
make install-olm | |
- 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: Determine versions and URLs | |
id: versions | |
run: | | |
operator_repo=`make print-operator-repo` | |
echo starting_operator_url=${operator_repo}:v${{ inputs.kuadrantStartVersion }} >> $GITHUB_OUTPUT | |
catalog_repo=`make print-catalog-repo` | |
echo starting_catalog_url=${catalog_repo}:v${{ inputs.kuadrantStartVersion }} >> $GITHUB_OUTPUT | |
upgrade_version=`make read-release-version` | |
echo upgrade_version=$upgrade_version >> $GITHUB_OUTPUT | |
upgrade_bundle_url=`make print-bundle-image` | |
echo upgrade_bundle_url=$upgrade_bundle_url >> $GITHUB_OUTPUT | |
upgrade_catalog_url=`make print-catalog-image` | |
echo upgrade_catalog_url=${upgrade_catalog_url} >> $GITHUB_OUTPUT | |
- name: Print summary | |
run: echo "Installing version ${{ inputs.kuadrantStartVersion }}, upgrading to version ${{ steps.versions.outputs.upgrade_version }}" | |
- name: Create namespace | |
run: | | |
kubectl create namespace ${{ inputs.kuadrantNamespace }} | |
- name: Install Kuadrant ${{ inputs.kuadrantStartVersion }} | |
run: | | |
kubectl apply -f - <<EOF | |
--- | |
apiVersion: operators.coreos.com/v1alpha2 | |
kind: OperatorGroup | |
metadata: | |
name: all-namespaces-operator-group | |
namespace: ${{ inputs.kuadrantNamespace }} | |
--- | |
apiVersion: operators.coreos.com/v1alpha1 | |
kind: CatalogSource | |
metadata: | |
name: kuadrant-operator-catalog-starting-version | |
namespace: ${{ inputs.kuadrantNamespace }} | |
spec: | |
sourceType: grpc | |
image: ${{ steps.versions.outputs.starting_catalog_url }} | |
displayName: Kuadrant Operators | |
publisher: grpc | |
updateStrategy: | |
registryPoll: | |
interval: 45m | |
--- | |
apiVersion: operators.coreos.com/v1alpha1 | |
kind: Subscription | |
metadata: | |
name: kuadrant-operator | |
namespace: ${{ inputs.kuadrantNamespace }} | |
spec: | |
channel: stable | |
name: kuadrant-operator | |
source: kuadrant-operator-catalog-starting-version | |
sourceNamespace: ${{ inputs.kuadrantNamespace }} | |
EOF | |
- name: Wait for subscription to be ready | |
run: | | |
kubectl wait --for=jsonpath='{.status.state}'=AtLatestKnown subscription/kuadrant-operator -n ${{ inputs.kuadrantNamespace }} --timeout=600s | |
echo "kuadrant subscription ✅" | |
- name: Wait for CSV to be ready | |
run: | | |
kubectl wait --for=jsonpath='{.status.phase}'=Succeeded csv/kuadrant-operator.v${{ inputs.kuadrantStartVersion }} --timeout=300s -n ${{ inputs.kuadrantNamespace }} | |
echo "kuadrant CSV ✅" | |
- name: Verify kuadrant start version deployment image | |
run: | | |
kubectl wait --timeout=300s --for=jsonpath='{.spec.template.spec.containers[0].image}'=${{ steps.versions.outputs.starting_operator_url }} deployment kuadrant-operator-controller-manager -n ${{ inputs.kuadrantNamespace }} | |
echo "kuadrant start version deployment image ✅" | |
- name: Deploy Kuadrant | |
run: | | |
kubectl -n ${{ inputs.kuadrantNamespace }} apply -f - <<EOF | |
apiVersion: kuadrant.io/v1beta1 | |
kind: Kuadrant | |
metadata: | |
name: kuadrant | |
spec: {} | |
EOF | |
- name: Verify Kuadrant installation | |
run: | | |
kubectl wait --timeout=300s --for=condition=Ready kuadrant kuadrant -n ${{ inputs.kuadrantNamespace }} | |
echo "kuadrant installation ✅" | |
- name: Note for debugging failed upgrades | |
run: | | |
echo "📝 If the upgrade fails, you can debug it by running it locally with OLM and Catalog Operator in debugging mode." | |
echo "📝 If the upgrade fails, make sure dependencies have also upgrade path available from available operator catalogs in the cluster." | |
- name: Start upgrade to kuadrant ${{ steps.versions.outputs.upgrade_version }} | |
run: | | |
kubectl apply -f - <<EOF | |
apiVersion: operators.coreos.com/v1alpha1 | |
kind: CatalogSource | |
metadata: | |
name: kuadrant-operator-catalog-upgraded-version | |
namespace: ${{ inputs.kuadrantNamespace }} | |
spec: | |
sourceType: grpc | |
image: ${{ steps.versions.outputs.upgrade_catalog_url }} | |
displayName: Kuadrant Operators | |
publisher: grpc | |
updateStrategy: | |
registryPoll: | |
interval: 45m | |
sourceType: grpc | |
displayName: Kuadrant Operators | |
publisher: grpc | |
updateStrategy: | |
registryPoll: | |
interval: 45m | |
EOF | |
bin/operator-sdk run bundle-upgrade \ | |
--verbose \ | |
--namespace ${{ inputs.kuadrantNamespace }} \ | |
--skip-tls-verify \ | |
--timeout 3m0s \ | |
${{ steps.versions.outputs.upgrade_bundle_url }} | |
- name: Verify Kuadrant upgrade | |
run: | | |
kubectl wait --timeout=300s --for=condition=Ready kuadrant kuadrant -n ${{ inputs.kuadrantNamespace }} | |
echo "kuadrant upgrade ✅" |