-
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
Allow using a ClusterClass across namespaces #5673
Comments
/area topology |
NOTE: I'm assuming a ClusterClass and its referenced templates should be in a single namespace as of today; the Cluster only can be in a different namespace |
The feature that ClusterClasses can be in another namespace changes our assumptions, so we have to think about how |
Would it be more user friendly to change class to a struct with name and namespace(defaulting to cluster namespace if unset? This would mirror what we're doing elsewhere at least and avoids adding new patterns which might be confusing - I think making it a namespaced name could be tough for new users to understand |
I think you both mean the same thing: type NamespacedName struct {
Namespace string
Name string
}
|
That looks right - I was thinking class: "namespace/classname" was on the table as an option. |
/assign |
|
note: #5717 adds some namespacing to webhook validation for clusterClass that will have to be addressed as part of this work. |
Thanks for the heads up @killianmuldoon! :) |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
I'm considering moving on with the suggested approach; adding some more considerations
Note, in the first iteration, I think we should not consider changing clusterctl move to move CC outsides the namespace being moved, this requires a dedicated deep dive |
Sounds good, one comment:
|
+1 Another use case for this: in provider e2e tests, we provide one namespace per test cluster but want to reuse the same clusterclass and install it in BeforeSuite https://github.com/kubernetes-sigs/cluster-api-provider-azure/pull/2235/files#r865122163 |
Not sure what CAPA does but in CAPZ if allowedNamespaces is empty it allows all namespaces (as opposed to only the current one) https://capz.sigs.k8s.io/topics/multitenancy.html#allowednamespaces Would be beneficial for testing to be able to specify all namespaces since cluster name/namespace is randomly generated for each spec so it won't be known ahead of time in BeforeSuite |
I'm not sure if that is an issue. In core CAPI today we use the same ClusterClass in multiple tests and it gets automatically applied in different namespaces because EDIT: While it's possible to reuse the same ClusterClass in e2e tests by deploying it multiple times (and it's automatically included in the output of clusterctl generate cluster) it of course might be desirable to intentionally re-use one single deployed ClusterClass in multiple tests in different namespaces. |
I'm not opposed at this behavior as well, however, I'm worried if this is "unsecure", given that if the user forgets to specify allowedNamespaces in a ClasterClass it is accessible from everywhere (instead of defaulting to the more restrictive behavior). |
/unassign Not work on this ATM |
/assign Would like to take a look at this. Perhaps we can add a topic to this week's meeting agenda to define an action plan on how this feature could be implemented. |
Should this issue be separated into two? It seems to me that for a general scenario, just adding a |
I also think that the first solution could be the namespace/name reference for a ClusterClass. This would be enough for me. |
Service Gateway API moved their referential approach into KEP, and it was merged - https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/3766-referencegrant They propose using
openly, with a future expectation that a I think this is a clean approach, allowing to rely on expectation that in the future the regular What do you think, will this help moving this issue to a solution? |
This issue is labeled with You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
/priority important-longterm |
/triage accepted |
This issue is labeled with You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
/triage accepted |
User Story
As a user/operator I would like to define ClusterClass once and reuse it across many namespaces
As a user/operator I would like to define the namespaces my ClusterClass can be used from
Detailed Description
As of today ClusterClass is a namespaced object, and the Cluster.spec.topology.class is a simple name
This works well under some many circumstances, but this approach does not works well in use cases when clusters are deployed in several namespaces/managed by different tenants, but the organisation providing ClusterCluster class is only one.
This issue is about discussing how to allow users a simple an straightforward experience in the use case above.
A possible approach requires two changes:
Whenever a Cluster is created, we are going to check if allowedNamespaces are defined; if yes, the ClusterNamespace should be in that list, otherwise the operation is denied; most probably we should make a similar check at reconcile time.
Other things that should be considered, are e.g validation check when modifying a ClusterClass; in this case, if allowedNamespaces are defined, we should check for corresponding Cluster in a list of namespaces; similarly, the change of allowedNamespaces field itself should account for those Clusters to exist before allowing the operation.
Anything else you would like to add:
Prior art for this approach:
/kind feature
The text was updated successfully, but these errors were encountered: