MarkForUncordonAfterReboot adds labels to the kubernetes node which NTH will read upon reboot
(nodeName string)
| 279 | |
| 280 | // MarkForUncordonAfterReboot adds labels to the kubernetes node which NTH will read upon reboot |
| 281 | func (n Node) MarkForUncordonAfterReboot(nodeName string) error { |
| 282 | // adds label to node so that the system will uncordon the node after the scheduled reboot has taken place |
| 283 | err := n.addLabel(nodeName, ActionLabelKey, UncordonAfterRebootLabelVal, false) |
| 284 | if err != nil { |
| 285 | return fmt.Errorf("unable to label node with action to uncordon after system-reboot: %w", err) |
| 286 | } |
| 287 | // adds label with the current time which is checked against the uptime of the node when processing labels on startup |
| 288 | err = n.addLabel(nodeName, ActionLabelTimeKey, strconv.FormatInt(time.Now().Unix(), 10), false) |
| 289 | if err != nil { |
| 290 | // if time can't be recorded, rollback the action label |
| 291 | err := n.removeLabel(nodeName, ActionLabelKey) |
| 292 | errMsg := "Unable to label node with action time for uncordon after system-reboot" |
| 293 | if err != nil { |
| 294 | return fmt.Errorf("%s and unable to rollback action label \"%s\": %w", errMsg, ActionLabelKey, err) |
| 295 | } |
| 296 | return fmt.Errorf("unable to label node with action time for uncordon after system-reboot: %w", err) |
| 297 | } |
| 298 | return nil |
| 299 | } |
| 300 | |
| 301 | func (n Node) GetNthConfig() config.Config { |
| 302 | return n.nthConfig |