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

Method GetEventID

pkg/node/node.go:264–278  ·  view source on GitHub ↗

GetEventID will retrieve the event ID value from the node label

(nodeName string)

Source from the content-addressed store, hash-verified

262
263// GetEventID will retrieve the event ID value from the node label
264func (n Node) GetEventID(nodeName string) (string, error) {
265 node, err := n.fetchKubernetesNode(nodeName)
266 if err != nil {
267 return "", fmt.Errorf("could not get event ID label from node: %w", err)
268 }
269 val, ok := node.Labels[EventIDLabelKey]
270 if n.nthConfig.DryRun && !ok {
271 log.Warn().Msgf("Would have returned Error: 'Event ID Label %s was not found on the node', but dry-run flag was set", EventIDLabelKey)
272 return "", nil
273 }
274 if !ok {
275 return "", fmt.Errorf("event ID Label %s was not found on the node", EventIDLabelKey)
276 }
277 return val, nil
278}
279
280// MarkForUncordonAfterReboot adds labels to the kubernetes node which NTH will read upon reboot
281func (n Node) MarkForUncordonAfterReboot(nodeName string) error {

Callers 5

TestDryRunFunction · 0.80
TestGetEventIDSuccessFunction · 0.80
handleRebootUncordonFunction · 0.80

Calls 1

fetchKubernetesNodeMethod · 0.95

Tested by 4

TestDryRunFunction · 0.64
TestGetEventIDSuccessFunction · 0.64