Commit 0f00f1b0 authored by Adam Harrison's avatar Adam Harrison
Browse files

Remove obsolete waitForDrain implementation

parent 156e9a1c
...@@ -171,40 +171,6 @@ func uncordon(nodeID string) { ...@@ -171,40 +171,6 @@ func uncordon(nodeID string) {
} }
} }
func waitForDrain(client *kubernetes.Clientset, nodeID string) {
for {
var unterminated int
namespaces, err := client.CoreV1().Namespaces().List(metav1.ListOptions{})
if err != nil {
log.Fatalf("Error waiting for drain: %v", err)
}
for _, namespace := range namespaces.Items {
drainCandidates := metav1.ListOptions{LabelSelector: "ignore_on_drain!=true"}
pods, err := client.CoreV1().Pods(namespace.ObjectMeta.Name).List(drainCandidates)
if err != nil {
log.Fatalf("Error waiting for drain: %v", err)
}
for _, pod := range pods.Items {
if pod.Spec.NodeName == nodeID &&
pod.Status.Phase != "Succeeded" &&
pod.Status.Phase != "Failed" {
unterminated++
}
}
}
if unterminated == 0 {
return
}
log.Infof("Waiting for %d pods to terminate", unterminated)
time.Sleep(time.Minute)
}
}
func commandReboot(nodeID string) { func commandReboot(nodeID string) {
log.Infof("Commanding reboot") log.Infof("Commanding reboot")
...@@ -271,7 +237,6 @@ func rebootAsRequired(nodeID string) { ...@@ -271,7 +237,6 @@ func rebootAsRequired(nodeID string) {
if acquire(lock, &nodeMeta) { if acquire(lock, &nodeMeta) {
if !nodeMeta.Unschedulable { if !nodeMeta.Unschedulable {
drain(nodeID) drain(nodeID)
waitForDrain(client, nodeID)
} }
commandReboot(nodeID) commandReboot(nodeID)
for { for {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment