-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Why doesn't garbage collection work when restricting Flux's RBAC permissions? #2648
Comments
I noticed that adding the following ClusterRole is sufficient to make garbage collection work.
The above is still too permissive. It would be useful to document the minimum permissions needed for garbage collection, so users can apply the principle of least privileges. Should fluxd support using Garbage Collection without a ClusterRole? |
In order to garbage-collect resources of certain
Depending on your configuration, e.g. if you use namespace filtering ( So, following my description above, it should be enough to use your initial RBAC configuration with minor adjustments. You could either:
I haven't tested this explicitly (I am just using my knowledge not Flux). Could you give it a try and report back? |
I tried
That wasn't sufficient. Currently using:
Which gets the job done. The logs don't show any output related to a lack of permissions on the resources that need to be garbage-collected. |
I meant adding that on top of what you already have. Is that what you did? |
Apologies for not being clear. Yes that was added on top of what I outlined in the first post. |
We are facing the same issues where flux does not delete objects that have been deleted from the repository. We are using the the 1.17.0 version. And if I remember correctly it worked with the feature-flag We have currently the following RBAC on each namespace that flux should handle:
And a clusterrolebinding with the following RBAC:
|
I'm facing something similar at the moment. Has anybody figured out anything regarding this issues? |
We have still this issue, haven't had time to investigate it further we are running 1.20.0 |
Thank you for your patience and for the reports. Flux v2 is a complete rewrite which has multi-cluster and multi-tenancy support, and as of the 0.8 release we are declaring the Feature Parity milestone is complete. https://toolkit.fluxcd.io/#where-do-i-start If you haven't already upgraded (many users are on Flux v2 in production already), it's definitely time to start thinking about it, and making plans to upgrade if you can't start right away. While it would be great to solve this issue for Flux v1 users, we are in maintenance mode and that means the priority is higher on security, maintenance/bug fixes, and migration issues, (above new features or enhancements.) Respecting you may have moved on already, I will go ahead and close out this issue for now. Welcome to follow up with more questions. If you've been following our development efforts then of course we hope you are able to upgrade, here's more info on how to find support with that: https://fluxcd.io/support/ |
For those who are still running Flux v1 and are having this issue. The logic here assumes that if you do not specify the So you have basically two choices with the current version of Flux v1 when your flux user does not have access to list resources in all namespaces. Either you give flux a cluster-reader-role as mention in #2648 (comment) or you explicitly specify all namespaces that flux has access to in the @kingdonb I guess that this is not enough to make it worth fixing in the v1 version since there is a workaround for it? |
I'm going to reopen this, since someone knows something about it. Please excuse the delay in replying, I've been tied up with KubeCon things and haven't been keeping up with e-mails very well... I have just come upon this issue in my backlog. If there is a fix possible, at this point I would guess it's going to be a docs improvement, since I'm leery of making any changes that would break things for people who made the workaround already. But for visibility, since we have someone confirming this is a real issue and seems to understand it well enough to explain the details more deeply than at least I've understood, it can be reopened, and I'll be happy to review any PRs to address this! Thanks for your interest in Flux 💖👍 |
(If the original submitter is no longer interested in this, it may still be better to re-open as an entirely separate issue, and just link back to this thread if there was important context here.) |
This project is in Migration and security support only, so unfortunately this issue won't be fixed. We recommend users migrate to Flux 2 at their earliest convenience. More information about the Flux 2 transition timetable can be found at: https://fluxcd.io/docs/migration/timetable/. |
Describe the bug
fluxd doesn't delete resources managed by flux when they are removed from the git repository, when fluxd is running with a role with limited privileges and garbage collection enabled.
we want to restrict the resources that developers can create/alter in a given namespace, so we're limiting fluxd's privileges using RBAC.
when we don't limit privileges (ie: when flux is running with
cluster-admin
privileges), garbage collection works as expected.To Reproduce
Steps to reproduce the behaviour:
configmap
, witness the resource being createdExpected behavior
expected that flux would delete resources create by flux when it has sufficient permissions to do so.
Logs
N/A - no output in logs regarding the above.
Additional context
The text was updated successfully, but these errors were encountered: