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 e2e tests & clusterctl changes for cross-ns CC ref #11395

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Danil-Grigorev
Copy link
Member

@Danil-Grigorev Danil-Grigorev commented Nov 11, 2024

What this PR does / why we need it:
This PR allows clusterctl to create a template with a reference to CC located in a different namespace.
This change allows to perform e2e tests in a multi-ns environment.

Added e2e tests to verify cluster-class quick-start scenario and runtime extension scenario in a cross-namespaced context.

The PR is built on top of:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #5673

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-area PR is missing an area label labels Nov 11, 2024
@k8s-ci-robot k8s-ci-robot requested a review from elmiko November 11, 2024 10:19
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 11, 2024
@Danil-Grigorev Danil-Grigorev force-pushed the standardize-references-full branch 5 times, most recently from d92a5c2 to 7560e66 Compare November 12, 2024 11:33
@Danil-Grigorev Danil-Grigorev changed the title [WIP] ✨ E2E test for the classNamespace usage [WIP] ✨ Add clusterctl changes for cross-ns CC ref Nov 12, 2024
@Danil-Grigorev Danil-Grigorev changed the title [WIP] ✨ Add clusterctl changes for cross-ns CC ref ✨ Add clusterctl changes for cross-ns CC ref Nov 12, 2024
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Nov 12, 2024
@Danil-Grigorev Danil-Grigorev force-pushed the standardize-references-full branch from 7560e66 to 09ce978 Compare November 18, 2024 19:46
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 18, 2024
@fabriziopandini fabriziopandini changed the title ✨ Add clusterctl changes for cross-ns CC ref [WIP] ✨ Add clusterctl changes for cross-ns CC ref Nov 25, 2024
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 25, 2024
@fabriziopandini
Copy link
Member

Renamed wip since it builds on a PR not yet merged

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

Made first pass, I will get back to this when the PR it builds on top are merged

test/e2e/cross-ns-quick-start.go Outdated Show resolved Hide resolved
test/e2e/cross-ns-quick-start.go Outdated Show resolved Hide resolved
cmd/clusterctl/client/clusterclass.go Show resolved Hide resolved
cmd/clusterctl/client/clusterclass_test.go Show resolved Hide resolved
@Danil-Grigorev Danil-Grigorev force-pushed the standardize-references-full branch from 09ce978 to 2d4a64e Compare December 4, 2024 14:34
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 4, 2024
@Danil-Grigorev Danil-Grigorev force-pushed the standardize-references-full branch from 2d4a64e to c181e3e Compare December 4, 2024 15:22
@k8s-ci-robot k8s-ci-robot removed the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 4, 2024
@Danil-Grigorev Danil-Grigorev force-pushed the standardize-references-full branch 4 times, most recently from b74fdb8 to 0ddc544 Compare January 23, 2025 16:31
@Danil-Grigorev
Copy link
Member Author

/test pull-cluster-api-e2e-main

@sbueringer
Copy link
Member

/test pull-cluster-api-e2e-main

1 similar comment
@sbueringer
Copy link
Member

/test pull-cluster-api-e2e-main

@sbueringer
Copy link
Member

Failing again. Probably we should look into why the cluster breaks. It shouldn't 😅 I would probably have time for that next week

test/e2e/quick_start.go Outdated Show resolved Hide resolved
@sbueringer
Copy link
Member

Just fyi, Christian is currently looking into this. We're probably hitting an edge case in KCP

test/e2e/clusterclass_changes.go Outdated Show resolved Hide resolved
test/e2e/clusterclass_changes.go Outdated Show resolved Hide resolved
@chrischdi
Copy link
Member

cc @Danil-Grigorev the above comments should help to get this one green :-)

@Danil-Grigorev Danil-Grigorev force-pushed the standardize-references-full branch from 231fcd7 to 5d11aa7 Compare January 30, 2025 12:49
- Prevent duplicate CC creation in template processing
- Test runtimextension integration
- Add changes to CC rebase e2e test
- Add a note CLUSTER_CLASS_NAMESPACE to the clusterctl contract

Co-authored-by: Christian Schlotter <[email protected]>
Signed-off-by: Danil-Grigorev <[email protected]>
@Danil-Grigorev Danil-Grigorev force-pushed the standardize-references-full branch from 5d11aa7 to 0c1c5b9 Compare January 30, 2025 12:54
@sbueringer
Copy link
Member

/test pull-cluster-api-e2e-main

@sbueringer
Copy link
Member

Nice, only another test failed. I call this a win! :)

/test pull-cluster-api-e2e-main

@sbueringer
Copy link
Member

/test pull-cluster-api-e2e-main

2 similar comments
@sbueringer
Copy link
Member

/test pull-cluster-api-e2e-main

@sbueringer
Copy link
Member

/test pull-cluster-api-e2e-main

@k8s-ci-robot
Copy link
Contributor

@Danil-Grigorev: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-e2e-main 0c1c5b9 link true /test pull-cluster-api-e2e-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@sbueringer sbueringer added tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. and removed tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. labels Feb 4, 2025
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Very last round of findings I hope.

Didn't realize the overlap with #11780 when merging #11780

Comment on lines +850 to +851
g.Expect(ok).To(BeTrue())
g.Expect(controlPlane.GetGeneration()).To(BeComparableTo(observedGeneration))
Copy link
Member

@sbueringer sbueringer Feb 4, 2025

Choose a reason for hiding this comment

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

Suggested change
g.Expect(ok).To(BeTrue())
g.Expect(controlPlane.GetGeneration()).To(BeComparableTo(observedGeneration))
if ok {
g.Expect(controlPlane.GetGeneration()).To(BeComparableTo(observedGeneration))
}

I think (observedGeneration is not part of the contract, so we can't expect it exists)

scaling, err := contract.ControlPlane().IsScaling(controlPlane)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(scaling).To(BeFalse())
}, input.WaitForControlPlaneIntervals...).Should(BeNil())
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
}, input.WaitForControlPlaneIntervals...).Should(BeNil())
}, input.WaitForControlPlaneIntervals...).Should(Succeed())

@@ -44,6 +44,9 @@ type QuickStartSpecInput struct {
// If not set, a random one will be generated.
ClusterName *string

// DeployClusterClassInSeparateNamespace defines if the ClusterClass should be deployed in a separate namespace.
Copy link
Member

@sbueringer sbueringer Feb 4, 2025

Choose a reason for hiding this comment

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

We have to rebase onto main. In the meantime ClusterctlVariables was added as an input field and we have to add to that map (I would simply overwrite the CLUSTER_CLASS_NAMESPACE key)
(#11780)

Note: we also have to handle the case where input.ClusterctlVariables is nil

Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

One nit from my side :-)

Comment on lines +66 to +71
version, err := semver.ParseTolerant(e2eConfig.GetVariable(KubernetesVersionUpgradeFrom))
Expect(err).ToNot(HaveOccurred(), "Invalid argument, KUBERNETES_VERSION_UPGRADE_FROM is not a valid version")
if version.LT(semver.MustParse("1.24.0")) {
Fail("This test only supports upgrades from Kubernetes >= v1.24.0")
}

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
version, err := semver.ParseTolerant(e2eConfig.GetVariable(KubernetesVersionUpgradeFrom))
Expect(err).ToNot(HaveOccurred(), "Invalid argument, KUBERNETES_VERSION_UPGRADE_FROM is not a valid version")
if version.LT(semver.MustParse("1.24.0")) {
Fail("This test only supports upgrades from Kubernetes >= v1.24.0")
}

We can drop this constraint as 1.24 is rotated out of our tests/support range :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clusterclass Issues or PRs related to clusterclass cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow using a ClusterClass across namespaces
5 participants