-
Notifications
You must be signed in to change notification settings - Fork 202
Allow disabling a Kustomization's finalizer #662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks, this seems to match my understanding of how GC works. Did I get anything wrong in my issue description? |
Having annotations as a bandaid for not setting proper RBAC is not something I would consider. If users don't understand how Flux works, a better way to protect the cluster from destructive actions, would be to remove write & delete actions in RBAC, so expect for cluster admins, no other user could edit or delete Flux objects. |
All of our manifests are generated from a monorepo. We have CODEOWNERs set up for the paths that generate Kustomizations, but even a code owner can make a mistake. We'd like to have Flux be a little less destructive, and we have no use for the finalizer Also, point 2, this would allow us to do more with GitOps, less manual actions. And I didn't think things through, I meant a Kustomization setting, not an annotation. Updated the description. Sorry, I don't mean to be pushy. I just want to be sure I am fully understood before dropping this, if you still don't agree 🙂 |
I also encountered the same problem, when setting
If I want to use the first behavior and don't need the second behavior, I need to add annotation |
I have a different use case, but I am also hit by the twofold behavior of In a multi-tenant (shared) cluster, end-users cannot have RBAC with full permissions to namespaces, as that would break the multi-tenant setup. To work around this, multiple custom solutions exist. OpenShift and Rancher name resources controlling namespaces Let me first explain my setup. To make it simple/clear, I will omit some details, but feel free to ask for more details! For a dynamic review environment we create the following resources:
The source resource is not so interesting in this context, so I will focus on other two (omitting details not relevant): apiVersion: accurate.cybozu.com/v2
kind: SubNamespace
metadata:
name: review-namespace-for-branch
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: review-namespace-for-branch
spec:
prune: true # or false
serviceAccountName: review-service-account
targetNamespace: review-namespace-for-branch The SubNamespace will eventually create the
If I set What I am proposing to fix this, is something similar to what has already been suggested. Since we want this to be a non-breaking change, I would like to introduce a new optional field in I would be happy to contribute this feature if we can agree on an acceptable API enhancement. |
@erikgb we can't deprecate nor drop |
Maybe a better naming would be |
No, both could be useful! Setting |
Works for me! Are you on-board with the use cases here? 🤔 |
That's a major breaking change, people set |
No doubt! I agree totally, of course. Hoping we can find something that makes sense and works. But the new field actually has 3 different values: unset, |
We need to come up with 3 polices and not just have unset as a silent things: the default one that would follow prune and keep the behaviour unchanged, one that forces GC even if prune is false, and one that skips the GC even if prune is true. |
Maybe something like |
I have already invited my team to a "Flux naming-party" on Monday, but your suggestions seems good to me. If we ever are going to have |
Discussed here: https://cloud-native.slack.com/archives/CLAJ40HV3/p1653481382666929 but opening this for further discussion
The
prune
setting of Kustomizations has a two-fold behavior. It will delete resources which are removed from source, as is expected from a GitOps tool and it also deletes all resources managed by the Kustomization through its finalizer, when it is deleted.We'd like to be able to keep pruning but disable the finalizer for the following reasons:
Kustomization
resource from the source (git). Flux manages itself on our clusters and it can be unexpected for users that deleting or modifying a single resource will cascade to othersKustomization
, not knowing that this will delete all of the namespace's resourcesI'd propose a new Kustomization setting:
finalizerMode
with three modes:none
(disabled),delabel
(remove flux labels on managed resources,prune
(current mode)The text was updated successfully, but these errors were encountered: