Commit 55ba7797 authored by Adam Harrison's avatar Adam Harrison
Browse files

Move test for node schedulability

Test for schedulability immediately prior to each reboot check instead
of once at startup, thereby accomodating external changes to this value
during the lifetime of the daemon.
parent 8aafc890
......@@ -220,24 +220,26 @@ func root(cmd *cobra.Command, args []string) {
uncordon(nodeID)
}
release(lock)
} else {
node, err := client.CoreV1().Nodes().Get(nodeID)
if err != nil {
log.Fatal(err)
}
nodeMeta.Unschedulable = node.Spec.Unschedulable
}
source := rand.NewSource(time.Now().UnixNano())
tick := delaytick.New(source, time.Minute*time.Duration(period))
for _ = range tick {
if rebootRequired() && !rebootBlocked() && acquire(lock, &nodeMeta) {
if !nodeMeta.Unschedulable {
drain(nodeID)
waitForDrain(client, nodeID)
if rebootRequired() && !rebootBlocked() {
node, err := client.CoreV1().Nodes().Get(nodeID)
if err != nil {
log.Fatal(err)
}
nodeMeta.Unschedulable = node.Spec.Unschedulable
if acquire(lock, &nodeMeta) {
if !nodeMeta.Unschedulable {
drain(nodeID)
waitForDrain(client, nodeID)
}
reboot()
break
}
reboot()
break
}
}
......
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