Allow to disable tainting during pending node reboot by setting the taint name to an empty string.

This commit is contained in:
David Sauer
2021-01-06 21:39:32 +01:00
parent 10d95c426f
commit 34446f949e
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ func main() {
rootCmd.PersistentFlags().StringVar(&rebootSentinel, "reboot-sentinel", "/var/run/reboot-required",
"path to file whose existence signals need to reboot")
rootCmd.PersistentFlags().StringVar(&preferNoScheduleTaintName, "prefer-no-schedule-taint", "weave.works/kured-node-reboot",
"taint name applied during pending node reboot (to prevent receiving additional pods from other rebooting nodes)")
"Taint name applied during pending node reboot (to prevent receiving additional pods from other rebooting nodes). Set to \"\" to disable tainting.")
rootCmd.PersistentFlags().StringVar(&slackHookURL, "slack-hook-url", "",
"slack hook URL for reboot notfications")
+8
View File
@@ -32,11 +32,19 @@ func New(client *kubernetes.Clientset, nodeID, taintName string, effect v1.Taint
// Enable creates the taint for a node. Creating an existing taint is a noop.
func (t *Taint) Enable() {
if t.taintName == "" {
return
}
preferNoSchedule(t.client, t.nodeID, t.taintName, t.effect, true)
}
// Disable removes the taint for a node. Removing a missing taint is a noop.
func (t *Taint) Disable() {
if t.taintName == "" {
return
}
preferNoSchedule(t.client, t.nodeID, t.taintName, t.effect, false)
}