-
Notifications
You must be signed in to change notification settings - Fork 218
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
Namespace deletion stuck if contains CRs that are watched by the operator #1876
Comments
Yep this is more like a generic Kubernetes issue, but will clarify how to handle it here, since we have a feature (dynamic changes of watching namespaces) that is closely related. |
Wouldn't setting a finalizer for the role and rolebinding solve the problem of immediate deletion? |
yes, this sounds like a good idea. This was suggested also here: But will create an issue in Kubernetes, see if it can be solved eventually on GC controller level. |
What JOSDK could do is to provide reconcilers (one for role and one for rolebinding) that will handle adding finalizers and removing them, and it would up to the dev to register them them. Since this has also implication on permissions of the operator (update permission on role). |
Hi @csviri we are facing the same issue that the namespace deletion is stuck, but even when the operator is deployed in the same namespace as the CRs, which is not expected according to what I understood from the Slack thread. I would appreciate any explanation. Note: The operator has a ClusterRole and ClusterRoleBinding to work with the CRs. We're using Quarkus with quarkus-operator-sdk. |
Hi @moayad-alyaghshi , I checked it briefly in namespace controller and the garbage collector controller when @gyfora reported this, and it seems (well as far I was able to see) there is nothing special to prevent this in K8S to happen even in the same namespace. So this is not an issue with JOSDK, it's rather issue with K8S. What we can offer is that reconciler that solves this, just was not priority for now, scheduled this for 4.5; Maybe it is worth asking again around this on k8s slack: https://kubernetes.slack.com/archives/CAW0GV7A5 |
issue in k8s: kubernetes/kubernetes#115070 |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
The Kubernetes issue was closed. What are the next steps for this? Is there a way to solve this in This issue causes all our namespaces to hang on termination because the CR is never finalized by Java Operator SDK... |
Bug Report
This is likely not a JOSDK bug but based on offline discussion with @csviri I am opening it here to track it.
In our current setup the operator is deployed in namespace
x
and is watching namespacey
. The access to namespacey
is controlled by roles and rolebindings (created in namespacey
).If there are CRs present in
y
and the namespace is deleted before the CRs are individually deleted we get the following exception during cleanup:Furthermore the namespace deletion gets stuck because the finalizer from the CR is never removed. The root problem seems to be when the namespace deletion is initiated the role and rolebinding is immediately deleted therefore the operator cannot remove the finalizer from the resource anymore.
Environment
Kubernetes cluster type:
kind
JOSDK version:
4.3.0
$ kubectl version
The text was updated successfully, but these errors were encountered: