Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test helm upgrade path #1156

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

eguzki
Copy link
Contributor

@eguzki eguzki commented Feb 3, 2025

What

Implements #1123 and is part of the work being done for #1112

It's a Github Action Workflow to test the Kuadrant upgrade process using helm charts.

It is being triggered manually (on.workflow_dispatch) and accepts as input:

  • kuadrantStartVersion: Kuadrant start version (required). For example: 1.0.0 (without v prefix)
  • kuadrantNamespace: Namespace where Kuadrant is installed (optional defaults to kuadrant-system).
  • clusterServer: Cluster server URL (optional defaults to local kind cluster). For example: https://example.com:443
  • clusterToken: Cluster Server Bearer Token (optional defaults to local kind cluster token). For example: sha256~abcdefghijk12345432432

The workflow installs published Kuadrant release from https://kuadrant.io/helm-charts with the version specified by kuadrantStartVersion. As of today, existing release versions:

❯ bin/helm search repo kuadrant -l
NAME                       	CHART VERSION	APP VERSION	DESCRIPTION                                       
kuadrant/kuadrant-operator 	1.0.2        	1.0.2      	The Operator to install and manage the lifecycl...
kuadrant/kuadrant-operator 	1.0.1        	1.0.1      	The Operator to install and manage the lifecycl...
kuadrant/kuadrant-operator 	1.0.0        	1.0.0      	The Operator to install and manage the lifecycl...
kuadrant/kuadrant-operator 	0.11.0       	           	The Operator to install and manage the lifecycl...
kuadrant/authorino-operator	0.16.0       	0.16.0     	Kubernetes operator for managing Authorino inst...
kuadrant/authorino-operator	0.15.1       	0.15.1     	Kubernetes operator for managing Authorino inst...
kuadrant/authorino-operator	0.14.0       	           	Kubernetes operator for managing Authorino inst...
kuadrant/authorino-operator	0.13.1       	           	Kubernetes operator for managing Authorino inst...
kuadrant/authorino-operator	0.13.0       	           	Kubernetes operator for managing Authorino inst...
kuadrant/authorino-operator	0.12.0       	           	Kubernetes operator for managing Authorino inst...
kuadrant/dns-operator      	0.12.0       	0.12.0     	Kubernetes operator responsible for reconciling...
kuadrant/dns-operator      	0.11.0       	0.11.0     	Kubernetes operator responsible for reconciling...
kuadrant/dns-operator      	0.10.1       	0.10.1     	Kubernetes operator responsible for reconciling...
kuadrant/dns-operator      	0.10.0       	0.10.0     	Kubernetes operator responsible for reconciling...
kuadrant/dns-operator      	0.9.0        	           	Kubernetes operator responsible for reconciling...
kuadrant/dns-operator      	0.8.0        	           	Kubernetes operator responsible for reconciling...
kuadrant/dns-operator      	0.7.0        	           	Kubernetes operator responsible for reconciling...
kuadrant/dns-operator      	0.6.0        	           	Kubernetes operator responsible for reconciling...
kuadrant/dns-operator      	0.5.0        	           	Kubernetes operator responsible for reconciling...
kuadrant/dns-operator      	0.4.1        	           	Kubernetes operator responsible for reconciling...
kuadrant/limitador-operator	0.12.1       	0.12.1     	Kubernetes operator for managing Limitador inst...
kuadrant/limitador-operator	0.12.0       	           	Kubernetes operator for managing Limitador inst...
kuadrant/limitador-operator	0.11.0       	           	Kubernetes operator for managing Limitador inst...

Then, deploys kuadrant CR and checks status is Ready. The kuadrant operator, runs a set of tests to mark the resource status as ready, so effectively, the workflow is relying on those tests to verify installation.

When the starting point installation is ready, it proceeds with the upgrade process. The upgrade is being carried out running helm upgrade command. The command waits until all deployments are ready (with a timeout set to 3 mins) and fails if some deployment is not ready after the timeout expires. Upgrade may fail for instance if some referenced docker image is not valid or does not exist. The upgrade verification steps by the workflow relies, once again, on the kuadrant CR status. After the upgrade, the kuadrant CR status should be Ready to pass the test. For example, if for whatever reason, let's say the limitador operator, or limitador instance, is not up and running, kuadrant CR would report on the status and the upgrade test would fail.

Simple commands are being coded as part of the Github workflow. For high level commands, those are implemented using makefile targets or third party tools so they can be easily run locally to dev/test.

@eguzki eguzki linked an issue Feb 3, 2025 that may be closed by this pull request
Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.62%. Comparing base (9f79273) to head (ec858aa).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1156      +/-   ##
==========================================
- Coverage   83.63%   83.62%   -0.02%     
==========================================
  Files          81       81              
  Lines        6943     6943              
==========================================
- Hits         5807     5806       -1     
- Misses        913      914       +1     
  Partials      223      223              
Flag Coverage Δ
bare-k8s-integration 22.38% <ø> (-0.51%) ⬇️
controllers-integration 75.18% <ø> (+0.23%) ⬆️
envoygateway-integration 40.29% <ø> (-0.33%) ⬇️
gatewayapi-integration 19.49% <ø> (+0.02%) ⬆️
istio-integration 43.24% <ø> (-0.03%) ⬇️
unit 19.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
api/v1beta1 (u) 90.00% <ø> (ø)
api/v1beta2 (u) ∅ <ø> (∅)
pkg/common (u) ∅ <ø> (∅)
pkg/istio (u) 62.06% <ø> (ø)
pkg/log (u) 93.18% <ø> (ø)
pkg/reconcilers (u) 24.67% <ø> (ø)
pkg/rlptools (u) ∅ <ø> (∅)
controllers (i) 86.87% <ø> (+0.04%) ⬆️

see 5 files with indirect coverage changes

@eguzki eguzki force-pushed the 1123-add-test-helm-upgrade-path branch 3 times, most recently from 7ea9e5b to 5016817 Compare February 6, 2025 17:18
Signed-off-by: Eguzki Astiz Lezaun <[email protected]>
@eguzki eguzki force-pushed the 1123-add-test-helm-upgrade-path branch from 5016817 to c048210 Compare February 6, 2025 17:23
Signed-off-by: Eguzki Astiz Lezaun <[email protected]>
@eguzki eguzki force-pushed the 1123-add-test-helm-upgrade-path branch from 9339ed9 to 1784199 Compare February 7, 2025 00:14
@eguzki eguzki marked this pull request as ready for review February 7, 2025 09:51
@eguzki eguzki requested a review from a team as a code owner February 7, 2025 09:51
@eguzki eguzki self-assigned this Feb 7, 2025
@eguzki eguzki requested review from maleck13 and Boomatang February 7, 2025 09:51
@eguzki eguzki added kind/enhancement New feature or request size/medium area/tests Changes to tests only labels Feb 7, 2025
description: Cluster server URL
required: false
type: string
clusterToken:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how secure is to pass down sensitive info like tokens from inputs, might want to check the docs or at least the full output logs with debug mode enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is one specific step to have the token redacted Mask cluster token. Good enough?

description: Kuadrant start version
required: true
type: string
clusterServer:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is having an external k8s cluster desired by these kind of tests? If not, we can just rely on kind

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, quoting from #1112

Ideally we would install the previous version into a cluster such as a kind cluster (although it would be ideal to be able to target a cluster also )

helm-charts-upgrade-test:
runs-on: ubuntu-latest
name: Helm Charts Upgrade Test
if: ${{ github.event_name == 'workflow_dispatch' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make helm-dependency-build
- name: Start upgrade to kuadrant ${{ steps.upgrade-version.outputs.version }}
run: |
bin/helm upgrade kuadrant charts/kuadrant-operator \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are not gonna be upgrading to pre-releases charts, are we?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because if we are, we might need to pass the --devel flag

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrade to pre-release charts can be tested.

The target (version being upgraded to) chart is determined by the git reference where you run the tests. Thus, the chart is available locally in the filesystem, hence the path charts/kuadrant-operator.

make/helm.mk Outdated

.PHONY: helm-print-chart-version
helm-print-chart-version: $(HELM) ## Reads chart version
@$(HELM) show chart charts/$(REPO) | grep -E "^version:" | awk '{print $$2}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given this will show the local info in charts/Chart.yaml, this workflow is only meant to be run from a branch (i.e. release branch) that has the new helm chart package for the release, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right

make/helm.mk Outdated

.PHONY: helm-print-chart-version
helm-print-chart-version: $(HELM) ## Reads chart version
@$(HELM) show chart charts/$(REPO) | grep -E "^version:" | awk '{print $$2}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should stop using the $REPO var within the charts:

Suggested change
@$(HELM) show chart charts/$(REPO) | grep -E "^version:" | awk '{print $$2}'
@$(HELM) show chart charts/$(CHART_NAME) | grep -E "^version:" | awk '{print $$2}'

@didierofrivia
Copy link
Member

It's looking good, I'd like to know if it's meant to run in an external k8s cluster, and if so, we might want to see if the secrets are treated correctly. Also, in that case, a cleaning step might be needed.

@eguzki
Copy link
Contributor Author

eguzki commented Feb 11, 2025

Thanks for the review @didierofrivia

Addressed some comments and answered questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tests Changes to tests only kind/enhancement New feature or request size/medium
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

Add test Helm upgrade path
2 participants