mirror of
https://github.com/kubereboot/kured.git
synced 2026-03-05 10:20:29 +00:00
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.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user