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
eviction doesn't work with cronjob pods if PodDisruptionBudget specifies percentage minAvailable/maxUnavailable #77383
Comments
@kubernetes/sig-scheduling-bugs |
@rajusharma: Reiterating the mentions to trigger a notification: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
From DisruptionController#getExpectedScale:
Looks like all the finders returned nil, nil |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
/assign |
So the issue here is that the PDB use When a PDB specifies either kubernetes/pkg/controller/disruption/disruption.go Lines 580 to 612 in 29a2b20
This is not possible with cronjob, only with replicationcontrollers, deployments, replicasets, statefulsets and custom resources that implement the scale subresource. If you want to set a PDB on a cronjob, it needs to use |
We don't want to set PDB on cronjobs. The issue is, we have some deployments and cronjobs with same labels and PDB doesn't work for those deployments which have same label as cronjobs. |
Ah, I see. I think your best option here is to make sure the pods created by the deployments have a label set that makes it possible to target them in the PDB without also capturing the pods from the cronjobs. |
Yeah we are doing that now by setting different labels for deployment pods and job pods. |
I think this is working as intended. Using different labels is the right way to handle this. |
That means if by accident any cronjob have same labels like deployment, then PodDisruptionBudget for that deployment will not run. Even though there was no change on deployment side, cronjob can break the PDB of deployment. Is this intended 🤔 |
I don't think we want to prevent PDBs from working with pods with different controllers or prevent PDBs from working with CronJobs. But I agree that it could be useful to provide better feedback if the disruption controller for some reason (this issue highlights one way it can fail) are unable to reconcile a PDB resource. |
what is the benefit to PDBs allowing a controller object they don't understand (and which doesn't support a generic scale subresource) to block eviction? |
I can't think of many good reasons why someone would want to set PDBs on cronjob (or any other resource that doesn't support scale). Maybe there are some use cases around batch workloads? Are you suggesting we could remove support for PDBs on pods that doesn't have a known controller or the scale subresource? |
After looking at the disruption controller in more detail, I think we can handle this better. In the situation described in this issue the controller can ignore the pods from the CronJob when computing the allowed disruptions, but create an event to notify the user that something isn't quite right. I think events are better than conditions for reporting this kind of issues to the user. I have created #85553 for this. More eyes on this would be great to make sure there aren't any scenarios I haven't considered. The disruption controller also has a failsafe functionality where the allowedDisruptions are set to 0 if the controller encounters any issues. I think we can use conditions to make it clearer to users that this happened. Currently, there isn't any good way to see from the resource itself that allowedDisruptions are 0 because of this. I will try to address this in a separate PR. |
* add configurable PDB for minio * change label for post-install-create-bucket-job because until kubernetes/kubernetes#85553 is merged, PDB will also detect the minio-create-bucket-job and PDB won't work correctly (kubernetes/kubernetes#77383) Signed-off-by: Mario Constanti <github@constanti.de>
* add configurable PDB for minio * change label for post-install-create-bucket-job because until kubernetes/kubernetes#85553 is merged, PDB will also detect the minio-create-bucket-job and PDB won't work correctly (kubernetes/kubernetes#77383) Signed-off-by: Mario Constanti <github@constanti.de>
* add configurable PDB for minio * change label for post-install-create-bucket-job because until kubernetes/kubernetes#85553 is merged, PDB will also detect the minio-create-bucket-job and PDB won't work correctly (kubernetes/kubernetes#77383) Signed-off-by: Mario Constanti <github@constanti.de>
* add configurable PDB for minio * change label for post-install-create-bucket-job because until kubernetes/kubernetes#85553 is merged, PDB will also detect the minio-create-bucket-job and PDB won't work correctly (kubernetes/kubernetes#77383) Signed-off-by: Mario Constanti <github@constanti.de>
* add configurable PDB for minio * change label for post-install-create-bucket-job because until kubernetes/kubernetes#85553 is merged, PDB will also detect the minio-create-bucket-job and PDB won't work correctly (kubernetes/kubernetes#77383) Signed-off-by: Mario Constanti <github@constanti.de>
* add configurable PDB for minio * change label for post-install-create-bucket-job because until kubernetes/kubernetes#85553 is merged, PDB will also detect the minio-create-bucket-job and PDB won't work correctly (kubernetes/kubernetes#77383) Signed-off-by: Mario Constanti <github@constanti.de>
* add configurable PDB for minio * change label for post-install-create-bucket-job because until kubernetes/kubernetes#85553 is merged, PDB will also detect the minio-create-bucket-job and PDB won't work correctly (kubernetes/kubernetes#77383) Signed-off-by: Mario Constanti <github@constanti.de>
How about setting a PDB on a cronjob to ensure that the job runs to completion in the event that another process tries to drain the node on which it's running, before it's finished? |
* add configurable PDB for minio * change label for post-install-create-bucket-job because until kubernetes/kubernetes#85553 is merged, PDB will also detect the minio-create-bucket-job and PDB won't work correctly (kubernetes/kubernetes#77383) Signed-off-by: Mario Constanti <github@constanti.de> Signed-off-by: Artur <artur@upbound.io>
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle rotten |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What happened:
PodDisruptionBudget is not working when CronJob and Deployment have same labels
Error:
What you expected to happen:
PDB should run
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
kubectl version
):GKE
cat /etc/os-release
):uname -a
):The text was updated successfully, but these errors were encountered: