MCPcopy
hub / github.com/microsoft/retina / validateOperatingSystemSupportedForNode

Function validateOperatingSystemSupportedForNode

shell/validation.go:14–28  ·  view source on GitHub ↗
(ctx context.Context, clientset *kubernetes.Clientset, nodeName string)

Source from the content-addressed store, hash-verified

12var errUnsupportedOperatingSystem = errors.New("unsupported OS (retina-shell requires Linux)")
13
14func validateOperatingSystemSupportedForNode(ctx context.Context, clientset *kubernetes.Clientset, nodeName string) error {
15 node, err := clientset.CoreV1().
16 Nodes().
17 Get(ctx, nodeName, metav1.GetOptions{})
18 if err != nil {
19 return fmt.Errorf("error retrieving node %s: %w", nodeName, err)
20 }
21
22 osLabel := node.Labels["kubernetes.io/os"]
23 if osLabel != "linux" { // Only Linux supported for now.
24 return errUnsupportedOperatingSystem
25 }
26
27 return nil
28}

Callers 3

RunInPodFunction · 0.85
RunInNodeFunction · 0.85
RunTraceFunction · 0.85

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected