Skip to content
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

protected pod against eviction with system known annotation #76

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ Keep the following in mind before deploying Draino:
* Draino considers a drain to have failed if at least one pod eviction triggered
by that drain fails. If Draino fails to evict two of five pods it will consider
the Drain to have failed, but the remaining three pods will always be evicted.
* Pods that can't be evicted by the cluster-autoscaler won't be evicted by draino.
See annotation `"cluster-autoscaler.kubernetes.io/safe-to-evict": "false"` in
[cluster-autoscaler documentation](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-types-of-pods-can-prevent-ca-from-removing-a-node)

## Deployment
Draino is automatically built from master and pushed to the [Docker Hub](https://hub.docker.com/r/planetlabs/draino/).
Expand Down
5 changes: 3 additions & 2 deletions cmd/draino/draino.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ func main() {
if !*evictStatefulSetPods {
pf = append(pf, kubernetes.NewStatefulSetPodFilter(cs))
}
if len(*protectedPodAnnotations) > 0 {
pf = append(pf, kubernetes.UnprotectedPodFilter(*protectedPodAnnotations...))
systemKnownAnnotations := []string{
"cluster-autoscaler.kubernetes.io/safe-to-evict=false", // https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-types-of-pods-can-prevent-ca-from-removing-a-node
}
pf = append(pf, kubernetes.UnprotectedPodFilter(append(systemKnownAnnotations, *protectedPodAnnotations...)...))
var h cache.ResourceEventHandler = kubernetes.NewDrainingResourceEventHandler(
kubernetes.NewAPICordonDrainer(cs,
kubernetes.MaxGracePeriod(*maxGracePeriod),
Expand Down