-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
✨ clusterctl move support for a cross namespace ClusterClass reference #11649
base: main
Are you sure you want to change the base?
✨ clusterctl move support for a cross namespace ClusterClass reference #11649
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this generally makes sense, but i have a couple questions.
also, happy to see the docs update 🙏
api/v1beta1/cluster_types.go
Outdated
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=253 | ||
// +kubebuilder:validation:Pattern="^[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\\.[a-z0-9](?:[-a-z0-9]*[a-z0-9])?)*$" | ||
ClassNamespace string `json:"classNamespace,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have consensus about adding this field to the API?
i mean, it seems necessary for this change, but i don't recall what we might have agreed upon in the office hours.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s actually a superset of #11352, I believe we have a consensus on the actual PR in the review #11352 (comment) (correct me if I’m wrong)
api/v1beta1/index/cluster.go
Outdated
@@ -55,3 +69,12 @@ func ClusterByClusterClassClassName(o client.Object) []string { | |||
} | |||
return nil | |||
} | |||
|
|||
// ClusterByClusterClassClassNamespace contains the logic to index Clusters by ClusterClass namespace. | |||
func ClusterByClusterClassClassNamespace(o client.Object) []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need the stutter, could we just name it ClusterByClusterClassNamespace
?
or if we need the extra context could we name it something different like ClusterByClusterClassTopologyNamespace
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch, I’ll update it. I think ClusterByClusterClassNamespace follows the naming pattern here.
bc1b8fc
to
8f8f47b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is generally making sense to me, do we need to merge #11352 first?
8f8f47b
to
2a98610
Compare
/test pull-cluster-api-e2e-main |
@@ -109,6 +110,11 @@ func (f *FakeCluster) WithTopologyClass(class string) *FakeCluster { | |||
return f | |||
} | |||
|
|||
func (f *FakeCluster) WithTopologyClassWithin(namespace string) *FakeCluster { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (f *FakeCluster) WithTopologyClassWithin(namespace string) *FakeCluster { | |
func (f *FakeCluster) WithTopologyClassNamespace(namespace string) *FakeCluster { |
2a98610
to
ba93019
Compare
866abc0
to
4e5295b
Compare
- 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 Signed-off-by: Danil-Grigorev <[email protected]>
4e5295b
to
f14a2f0
Compare
Signed-off-by: Danil-Grigorev <[email protected]>
f14a2f0
to
36b7d8a
Compare
@Danil-Grigorev: The following test failed, say
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. |
PR needs rebase. 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. |
@Danil-Grigorev I took a look at the PR, and I think we should improve it to ensure that we delete a ClusterClass a CC from the source cluster on if:
In order to do so, I suggest to:
|
|
||
// Set isGlobalHierarchy on clusterClass if is referenced from a different namespace | ||
if classNamespace != cluster.identity.Namespace { | ||
clusterClass.isGlobalHierarchy = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this probably achieve the goal, it seems a little bit hacky:
- isGlobal and isGlobalHierarchy are meant to track if "object is a global resource (no namespace).", which this is not the case for cc
- you are using isGlobalHierarchy without having an isGlobal object on top
Please take a look at the alternative solution I proposed above, happy to chat about it if you want
What this PR does / why we need it:
A follow-up on #11395 functionality, which integrates
classNamespace
field withclusterctl move
.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Related to #5673