Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

Commit

Permalink
Merge pull request #150 from diegs/eviction
Browse files Browse the repository at this point in the history
agent: deserialize waitForPodDeletion check.
  • Loading branch information
dghubble authored Oct 24, 2017
2 parents 55fe127 + 7208d91 commit a9bc42c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package agent

import (
"fmt"
"sync"
"time"

"github.com/coreos/go-systemd/login1"
Expand Down Expand Up @@ -162,12 +163,19 @@ func (k *Klocksmith) process(stop <-chan struct{}) error {
}
}

// wait for the pods to delete completely.
wg := sync.WaitGroup{}
for _, pod := range pods {
glog.Infof("Waiting for pod %q to terminate", pod.Name)
if err := k.waitForPodDeletion(pod); err != nil {
glog.Errorf("Skipping wait on pod %q: %v", pod.Name, err)
}
}
wg.Add(1)
go func(pod v1.Pod) {
glog.Infof("Waiting for pod %q to terminate", pod.Name)
if err := k.waitForPodDeletion(pod); err != nil {
glog.Errorf("Skipping wait on pod %q: %v", pod.Name, err)
}
wg.Done()
}(pod)
}
wg.Wait()

glog.Info("Node drained, rebooting")

Expand Down

0 comments on commit a9bc42c

Please sign in to comment.