Allowing multiple service accounts to act as owner of a Tenant #1311
Replies: 2 comments 5 replies
-
I am open to that discussion, i have had multiple customers with the same demand. Do you feel comfy enough to draft a PR with your suggestion, so we can explore an effective implementation together. we have to changed this, since these are the webhooks verifying tenant ownership wrapped around all the other admissions: Now here is where we need to do changes: Here I am just a bit worried about a potential performance impact, but we would some indexers, then that should be fine. So we need to index serviceAccount owners with their corresponding. That should only be done, if none of the groups matched. I would not sync it to the capsuleConfiguration. It makes sense to me, however i am not yet 100% convinced by the declaration with WDYT @prometherion |
Beta Was this translation helpful? Give feedback.
-
A pitfall we discovered with Massimiliano is about Kubernetes RBAC: apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
creationTimestamp: "2024-05-17T09:22:08Z"
name: capsule-namespace-provisioner
resourceVersion: "163131743"
uid: ff156d60-0968-4cd0-a259-9aa4479c443d
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: capsule-namespace-provisioner
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: system:serviceaccounts:default We need to know in advance the Namespaces name, otherwise, Kubernetes will block with RBAC the creation of Namespaces. Since Capsule automatically generates this object, we could update the subjects with the entries of ServiceAccount marked to act as tenant owners in the proposed API change. |
Beta Was this translation helpful? Give feedback.
-
Hello Capsule!
Me and a colleague have been talking to the awesome people at Capsule on Slack, about a challenge we encountered when implementing multi tenancy, and using Flux.
Context
We have a tenant called "demo-tenant". We follow Capsules guide and bootstrap a namespace and create a Serviceaccount as the owner.
We add the service account to our HelmRelease:
The Tenant creates their new namespace:
Now the Tenant deploys a HelmRelease which is creating new namespaces.
The Tenant is required to do two things:
spec.serviceAccountName
We make sure each namespace in the Tenant has a service account called
tenant-gitops
, by usingGlobalTenantResource
.This service account
system:serviceaccount:demo-tenant-default:tenant-gitops
is not TenantOwner, and is not part ofCapsuleUserGroups
so it is not allowed to create the namespace.Feature request
This could be done in the
tenant.spec.additionalRoleBindings.[index].actAsOwner
. This would allow us to make alltenant-gitops
service accounts tenant owners dynamically.This would allow the Tenant to deploy HelmRelease in any namespace in the Tenant, and create new namespace from that HelmRelease.
This would also be GitOps compliant as we don't rely on mutating manifests after deployment.
We would love to hear your input on this feature!
Beta Was this translation helpful? Give feedback.
All reactions