-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Deletion propagation support in KubernetesServer #3266
Comments
I'm guessing you're talking about the CRUD mode. I'm not sure if you're only considering how this affects to the provided resource, or if it should also consider dependent resources. If we are to consider the dependent resources (e.g. a Deployment is deleted, any dependent resources (ReplicaSet, Pod, etc.) will be deleted too), the first question should be go are those dependent resources created in CRUD mode. You most probably need to create them manually (if you create a Deployment, our mock server does nothing else but persist that entity). So it would be feasible to achieve what you want, but I'm not sure if that would be of any use (since you already need to create the dependent resources yourself). If we are only considering the affected resource ("owner"), but not its dependents. For Anyway, I'm not that sure that this brings added value. What's your use case? |
@manusa good points, all of them! My use case: I'm implementing an operator that creates jobs and secrets. I manually specify the job as the owner of the secret, so that when I delete the job, the secret is deleted by the deletion propagation. I want to test this behaviour and also rely on it for testing other aspects of the operator. So it's indeed for CRUD mode, and for deleting dependent resources. So yes I would not expect the mock server to create any dependent resources by itself in this case. I would expect that if there are matching resources they got deleted along their owner. Concerning |
Given this use case, it does make sense indeed to implement this functionality.
You can read more about how this works here: https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/#controlling-how-the-garbage-collector-deletes-dependents
So the owner object is deleted last, and only if all the dependent objects are deleted. I don't think there's any scenario where Kubernetes deletes objects synchronously. This is also related to what we discussed in #3246 |
Indeed, thank you again for the explanation, it makes more sense now to me :) I don't think we would really need to implement like this in the Mock server though. At least for my use case I suppose. |
So an initial implementation would be to delete dependent Objects, despite the DeletionPropagation. |
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions! |
This is still an active subject :) |
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions! |
+1 for this (one day).. |
BTW, I assume (or so it appears) that this also affects |
We recently added the Kube API Test module. This module is intended for this scenario and provides the extended capabilities you require. It will deploy a real Kube API server. |
Hey @manusa, that looks really cool! I will have to dig into that when I get a bit of time but it seems to clearly answer my needs :) |
Hi,
I'm not sure if this is desired to go that far in mocking the API Server, but it would be really great if
KubernetesServer
was honoring thePropagationPolicy
during delete with respect to owned resources.Maybe as a starter, it would be enough to have it implemented by always behaving as if it's a foreground policy (since a background one would need to do things in multiple threads…).
The text was updated successfully, but these errors were encountered: