Fixed a bug where kubectl drain would consider a pod as having been deleted if an error occurs while calling the API.
Kubernetes-commit: 4aecb151b8301a6fc69f63c08f640c7b2b4289fc
Currently, there is no way to supply custom pod filters to
exclude pods meeting arbitrary criteria when using drain
as a library.
This commit adds the ability for developers to add custom
filters to the drain operation when utilizing drain
as a library.
This commit exports certain types that were previously
private to allow for better code reuse.
This commit also adds appropriate unit tests.
Kubernetes-commit: 85004f030dc3dceb9d15f41fdd607545758d5da2
Currently, some circumstances may cause waitForDelete to
never succeed after the pod has been marked for deletion.
In particular, Nodes that are unresponsive and have
pods with local-storage will not be able to
successfully drain.
We should allow drain to ignore pods that have a
DeletionTimestamp older than a user-provided age.
This will allow controllers utilizing kubectl/drain
to optionally account for a pod that cannot be
removed due to a misbehaving node.
Kubernetes-commit: da53044abdf8c8a9771a5c3dfd861f0c4ec78c40
Currently, if eviction is supported during a drain operation,
eviction is always used.
This commit allows the user to specify disabling eviction.
This is particularly useful when you wish to ignore
PodDisruptionBudgets after a normal drain has failed for
some time.
Kubernetes-commit: 6c1d587d5142b95e6c169a198a086332a7e4d8ad
This commits allows specifying a context.Context
in the Helper type. This context is utilized to
cancel waitForDelete.
Kubernetes-commit: 8682e902f5487e04b893da7230125db0d7ae66b4
Recently, kubectl drain has been refactored to be consumeable
as a library. Currently, if a pod cannot be evicted due
to PDBs, we will leak a goroutine.
This commit ensures the goroutine always exists.
Related-bug: https://github.com/kubernetes/kubernetes/issues/81333
Kubernetes-commit: 0e8998a040efe5dd82592911e739fe2e2258cfa3