-
Notifications
You must be signed in to change notification settings - Fork 163
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
Support Groups as Subject Kind for Tenant Namespace RoleBindings created by Capsule #71
Support Groups as Subject Kind for Tenant Namespace RoleBindings created by Capsule #71
Conversation
@MaxFedotov thanks for your interest in Capsule and for pushing this PR. Should we consider to have a more general approach for the Tenant Ownership. I mean something like this: apiVersion: capsule.clastix.io/v1alpha1
kind: Tenant
metadata:
name: oil
spec:
...
subjectOwner:
kind: Group
name: foo Where the Not sure if technically feasible. @prometherion @MaxFedotov what do you think? |
The main concern I have is upon Namespace creation, since we're using an indexer to speed up the Owner lookup at webhook level. I need to investigate and check if it's feasible or not, since we have to lookup also per |
Exactly, that's a field indexer provided by the related struct |
There is a way to do it - kubernetes-sigs/controller-runtime#612 (comment) in our case we can use function like
But there is another problem, when https://github.com/clastix/capsule/blob/0f935d53b7acb17379e749a2d64e2f631adb6779/pkg/webhook/owner_reference/patching.go#L84-L93 Btw, according to https://github.com/clastix/capsule/blob/0f935d53b7acb17379e749a2d64e2f631adb6779/pkg/webhook/owner_reference/patching.go#L92 we do not event need to find all tenants, just first one returned (which seems like a bit strange logic, so the namespace is actually assigned to a random tenant, within an owner) Another way, is to enable by default Or we can combine these two approaches:
But my personal vote is for enabling |
@prometherion
|
Thanks @MaxFedotov, can't wait for take a look to it. @bsctl do you think we should version a new API since this breaking change in the contract? IMO, no need since we haven't yet released a stable version :) |
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.
Some typos and more details requests
d7dd352
to
9d845b3
Compare
@prometherion |
4cb0bf5
to
1666f21
Compare
@MaxFedotov this rebase will be painful, I know :( |
modify crd to support owner struct. add tenant name validation webhook. rewrite owner_reference hook logic. update and add new e2e tests apply review notes fix typo in timeout interval apply review notes move GetNamespaceTenant logic to utils from webhook rebase on master. update tests. implement new tenant selection logic for namespace
1666f21
to
8e241d0
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.
LGTM, just check why tests are not green: could be flaky
This PR closes #70 and adds additional configuration parameter
use-groups-as-tenant-owner
which allows Tenant Namespace RoleBindings to be created with"Kind": "Group"
It's completely backward-compatible, as default is set to
false
.