MCPcopy Create free account
hub / github.com/aws/aws-node-termination-handler / Cordon

Method Cordon

pkg/node/node.go:180–194  ·  view source on GitHub ↗

Cordon will add a NoSchedule on the node

(nodeName string, reason string)

Source from the content-addressed store, hash-verified

178
179// Cordon will add a NoSchedule on the node
180func (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
197func (n Node) Uncordon(nodeName string) error {

Callers 3

CordonAndDrainMethod · 0.95
cordonNodeMethod · 0.80
TestDryRunFunction · 0.80

Calls 1

fetchKubernetesNodeMethod · 0.95

Tested by 1

TestDryRunFunction · 0.64