Cordon will add a NoSchedule on the node
(nodeName string, reason string)
| 178 | |
| 179 | // Cordon will add a NoSchedule on the node |
| 180 | func (n Node) Cordon(nodeName string, reason string) error { |
| 181 | if n.nthConfig.DryRun { |
| 182 | log.Info().Str("node_name", nodeName).Str("reason", reason).Msgf("Node would have been cordoned, but dry-run flag was set") |
| 183 | return nil |
| 184 | } |
| 185 | node, err := n.fetchKubernetesNode(nodeName) |
| 186 | if err != nil { |
| 187 | return err |
| 188 | } |
| 189 | err = drain.RunCordonOrUncordon(n.drainHelper, node, true) |
| 190 | if err != nil { |
| 191 | return err |
| 192 | } |
| 193 | return nil |
| 194 | } |
| 195 | |
| 196 | // Uncordon will remove the NoSchedule on the node |
| 197 | func (n Node) Uncordon(nodeName string) error { |