-
I am testing with ReconcilerTestCase and would like to emulate what happens when a childset deletes children that have finalizers (of their own). In such a case, I'd like the ResourceManager's Delete to receive the correct response from the fakeClient AND for the resources to remain in the FakeClient stubs, with deletionTimestamps added. This way, later reconcilers can query the same subresources to decide if the top level's resource should keep it's own finalizer. Is this possible? Alternatively, If I were to wrap a childset with WithFinalizer, it would be nice if the finalizer was not cleared if child deletion was itself a soft deletion. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Looking at the fake client code in controller-runtime, it appears this is mostly already happening. The gotcha is that the passed in object isn't updated to reflect the server side value. It will need to be fetched again to see the deletion timestamp. The real client appears to behave the same way. You may see different behavior in a running controller if the resource is managed by an informer. In that case you'll need to use the APIReader to talk directly to the API server instead of the Client. Logically for most cases a deleted resource with a finalizer should be treated as if it doesn't exist. The exceptions being if you are responsible for clearing the finalizer, and a new resource with the same name cannot be created. |
Beta Was this translation helpful? Give feedback.
Looking at the fake client code in controller-runtime, it appears this is mostly already happening. The gotcha is that the passed in object isn't updated to reflect the server side value. It will need to be fetched again to see the deletion timestamp. The real client appears to behave the same way. You may see different behavior in a running controller if the resource is managed by an informer. In that case you'll need to use the APIReader to talk directly to the API server instead of the Client.
https://github.…