MCPcopy Index your code
hub / github.com/aws/aws-node-termination-handler / IsLabeledWithAction

Method IsLabeledWithAction

pkg/node/node.go:587–595  ·  view source on GitHub ↗

IsLabeledWithAction will return true if the current node is labeled with NTH action labels

(nodeName string)

Source from the content-addressed store, hash-verified

585
586// IsLabeledWithAction will return true if the current node is labeled with NTH action labels
587func (n Node) IsLabeledWithAction(nodeName string) (bool, error) {
588 k8sNode, err := n.fetchKubernetesNode(nodeName)
589 if err != nil {
590 return false, fmt.Errorf("unable to fetch kubernetes node from API: %w", err)
591 }
592 _, actionLabelOK := k8sNode.Labels[ActionLabelKey]
593 _, eventIDLabelOK := k8sNode.Labels[EventIDLabelKey]
594 return actionLabelOK && eventIDLabelOK, nil
595}
596
597// UncordonIfRebooted will check for node labels to trigger an uncordon because of a system-reboot scheduled event
598func (n Node) UncordonIfRebooted(nodeName string) error {

Callers 3

TestDryRunFunction · 0.80
handleRebootUncordonFunction · 0.80

Calls 1

fetchKubernetesNodeMethod · 0.95

Tested by 2

TestDryRunFunction · 0.64