Restrict Application.spec.project by Application.spec.source.repoURL #3045
Labels
component:multi-tenancy
Features related to app projects
enhancement
New feature or request
type:usability
Enhancement of an existing feature
Milestone
Summary
Allow restricting the value of
Application.spec.project
to control tenants' authority.In my knowledge,
Application.spec.project
can be set any project name.Motivation
Let me explain my use case.
We're using ArgoCD for multi-tenant K8s.
To allow tenants to add Applications by themselves, I prepared the following AppProject resources:
default
: The project for the admin team. The apps belong to the project can deploy any kind of resources.tenant
: The project for tenants. The apps belong to the project can deploy the resources in specified namespaces only.tenant-apps
: The project for tenants' app-of-apps. The apps belong to the project can only deploy Application resources inargocd
namespace.Moreover, we prepared the app-of-apps that belongs to the
tenant-apps
project. The app'sspec.source.repoURL
points to the tenant's repository so that tenants can create their Applications by themselves.However, in this system, tenants can create apps whose
spec.project
isdefault
, so tenants can deploy pods with the admin's privilege.Proposal
To solve this problem, we developed the admission webhook to validate
app.spec.project
according toapp.spec.source.repoURL
. Ref: neco-containers/validate_application.goThis validating webhook is working as expected, but in my opinion, this kind of validation feature should be support in upstream of ArgoCD.
This is the example configuration YAML for the webhook.
In this configuration, App whose
spec.source.repoURL
ishttps://github.com/example/tenant-apps.git
can be set onlytenant
ortenant-apps
asspec.project
.The text was updated successfully, but these errors were encountered: