akuity / kargo

Application lifecycle orchestration
https://kargo.akuity.io/
Apache License 2.0
1.75k stars 145 forks source link

idea: automate management of controller access to global cred namespaces #2937

Open krancour opened 6 days ago

krancour commented 6 days ago

Since #2761, controllers do not, by default, have cluster-wide read permissions on Secrets as they had prior to that PR.

The management controller now dynamically expands the (regular) controllers access to Secrets in Project namespaces only as Projects are created. (Project deletion deletes the corresponding namespace, and with it the relevant RoleBinding.)

Starting with #2761 we also required that RoleBindings that grant controllers read permission on Secrets in "global" credential namespaces be managed manually. The underlying technical constraint driving that is that "global" credential namespaces are user-defined at install-time. While the management controller could, at startup, grant necessary permissions within all those namespaces to the controllers, we elected not to do that because the management controller would have no way of knowing at startup what namespaces might have previously been on that list and have now been removed and therefore cannot know what permissions need to be rescinded. The less than ideal solution was to make this fully the operator's responsibility.

I think there is an opportunity here to automate this and improve UX at the same time:

I do have one concern that could render this idea untenable:

Anyone who can update a given namespace with a new label could indirectly grant Kargo access to that namespace's Secrets even if they, themselves, lack that permission. This would be problematic if that user also has any possibility of obtaining (or creating) an access token associated with a controller's SA.

I think it's at least worth some discussion to see if we cannot overcome that problem somehow.