How to achieve multi-tenant isolation with ServiceAccountName references? #5300
-
If each kustomization.yaml in a tenant repository can set their serviceAccountName to whatever they want in a kustomization.yaml, how do you achieve true isolation between tenants / teams? Take a single-cluster multi-tenant setup:
A gitrepository object is declared to track each of their resources. Can the green-team gitrepo define a ./kustomization.yaml with It would make more sense to me if the GitRepository CRD defined the serviceAccountName; so that service-accounts are enforced at the repository level, but from my understanding this is meant to be managed by the kustomization.yaml (or helm) within the tenant owned repository. I can maybe work around this by locking down the ./kustomization.yaml to platform admins, but this doesn't allow any sort of app-of-apps structure; or possibly CI/CD to enforce serviceAccountNames. Regardless I feel this should be enforced by Flux, not externally. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
This assumption is wrong. When you deploy a tenant repository, the Kustomization doing it must not use kustomize-controller's |
Beta Was this translation helpful? Give feedback.
This assumption is wrong. When you deploy a tenant repository, the Kustomization doing it must not use kustomize-controller's
cluster-admin
ServiceAccount. You need to set thespec.serviceAccountName
field of this Kustomization to one that has no ClusterRoleBindings, it can only have RoleBindings on the namespace of the tenant.