Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 19 additions & 30 deletions e2e/install/upgrade/upgrade_test.go
Copy link
Copy Markdown
Contributor Author

@anandyadav3559 anandyadav3559 May 20, 2026

Choose a reason for hiding this comment

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

issue: #6631

Motivation: Right now we leverage the presence of the make target to perform installation of the older operator version during the upgrade E2E test. This forces the test to pull the entire GitHub project locally just to run the Makefile. We can instead install directly from the tag via a Kustomize procedure, which is faster and cleaner.

Modifications:

Removed the logic in e2e/install/upgrade/upgrade_test.go that creates a temporary directory, executes git clone, checks out the target tag, and runs make install-k8s-global.
Replaced it with a temporary kustomization.yaml that dynamically applies the generated test namespace alongside the remote GitHub repository base (github.com/apache/camel-k/install/overlays/kubernetes/descoped?ref=v).
Executed installation using kubectl apply -k --server-side.
Testing Verification:

✅ make fmt and make lint completed successfully with no issues.
⚠️ Note on Local testing with kind: While running the go test -v ./e2e/install/upgrade -tags=integration suite on a local kind cluster, the test initially timed out because the IntegrationPlatform resource failed to reach the Ready state. The operator logs showed: registry address not available, you need to set one. Because Camel K requires a container registry to push/pull integration images, and a local kind cluster does not provide one automatically, a local Docker registry had to be explicitly created and connected to the kind cluster for the upgrade tests to proceed and pass correctly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please, don't mix commits and stick to the scope of this PR. If you want, feel free to open a separated PR to address any other fix. For the upgrade test, mind that this is already fixed by another running PR, so, no need to work on it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

alright.

Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,25 @@ func TestUpgrade(t *testing.T) {
// We start the test by installing previous version operator
lastVersion, ok := os.LookupEnv("LAST_RELEASED_VERSION")
g.Expect(ok).To(BeTrue(), "Missing last released version: you need to set it into LAST_RELEASED_VERSION env var")
lastVersionDir := fmt.Sprintf("/tmp/camel-k-v-%s", lastVersion)
// We clone and install the previous installed operator
// from source with tag
ExpectExecSucceed(t, g,
exec.Command(
"rm",
"-rf",
lastVersionDir,
))
ExpectExecSucceed(t, g,
exec.Command(
"git",
"clone",
"https://github.com/apache/camel-k.git",
lastVersionDir,
))
checkoutCmd := exec.Command(
"git",
"checkout",
fmt.Sprintf("v%s", lastVersion),
)
checkoutCmd.Dir = lastVersionDir
ExpectExecSucceed(t, g, checkoutCmd)
installPrevCmd := exec.Command(
"make",
"install-k8s-global",
fmt.Sprintf("NAMESPACE=%s", ns),
)
installPrevCmd.Dir = lastVersionDir
ExpectExecSucceed(t, g, installPrevCmd)
// We install the previous operator directly from the git tag using Kustomize
kustomizeDir, err := os.MkdirTemp("", "camel-k-upgrade-*")
g.Expect(err).To(BeNil())
defer os.RemoveAll(kustomizeDir)

kustomization := fmt.Sprintf(`namespace: %s
resources:
- github.com/apache/camel-k/install/overlays/kubernetes/descoped?ref=v%s
`, ns, lastVersion)

err = os.WriteFile(fmt.Sprintf("%s/kustomization.yaml", kustomizeDir), []byte(kustomization), 0o644)
g.Expect(err).To(BeNil())

ExpectExecSucceed(t, g, Kubectl(
"apply",
"-k",
kustomizeDir,
"--server-side",
))

// Refresh the test client to account for the newly installed CRDs
RefreshClient(t)
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/camel/v1/trait/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/apis/camel/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/apis/duck/keda/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions script/get_catalog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ fi
# Refresh catalog sets. We can clean any leftover as well.
rm -f ${rootdir}/pkg/resources/resources/camel-catalog-*

if ! command -v mvn &> /dev/null
then
echo "Maven (mvn) is required but not installed."
exit 1
fi

mvn -q dependency:copy -Dartifact="org.apache.camel.k:camel-k-catalog:$runtime_version:yaml:catalog" \
-Dmdep.useBaseVersion=true \
-DoutputDirectory=${rootdir}/resources/ \
Expand Down