fix: make drain ignore DaemonSets & bypass PodDisruptionBudgets (cluster/node stop) #1414
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Make kubectl drain ignore DaemonSets & bypass PodDisruptionBudgets on cluster stop.
Why
Currently it fails if you have DaemonSets & loops infinitely (note there may be a timeout elsewhere preventing this from hanging k3d cluster/node stop) if you have PodDisruptionBudgets.
Implications
There were discussions in #1119 of reverting drain entirely due to more complex uses cases, i.e. agents, than the default single node cluster in which case I can continue using my workaround of calling drain node before I call cluster stop https://github.com/runhub-dev/runhub/blob/7d49dc314908063699b38458240d8e2540b89d88/scripts/dev.sh#L119-L120.
While ignoring DaemonSets makes sense in a multiple node use case bypassing PodDisruptionBudgets doesn't if you are only stopping a single node, i.e. k3d node stop, and not all the nodes in the cluster, i.e. k3d cluster stop. But I feel if you are going to keep drain as implemented for now bypassing PodDisruptionBudgets is better than an infinite loop (note there may be a timeout elsewhere preventing this from hanging k3d cluster/node stop).