| 12 | var errUnsupportedOperatingSystem = errors.New("unsupported OS (retina-shell requires Linux)") |
| 13 | |
| 14 | func 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 | } |