Skip to content

Commit

Permalink
protected pod against eviction with system known annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
dbenque committed Apr 17, 2020
1 parent 6f82ca0 commit 98c9125
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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 evited 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

0 comments on commit 98c9125

Please sign in to comment.