From 7ace411a5d4d1bdbf545a3c0795e11a243c46f83 Mon Sep 17 00:00:00 2001 From: Mingqi Shao Date: Fri, 3 Dec 2021 11:33:29 -0800 Subject: [PATCH] add stable os label kubernetes.io/os --- internal/commands/root/node.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/commands/root/node.go b/internal/commands/root/node.go index c8b2f08..a1cbc3f 100644 --- a/internal/commands/root/node.go +++ b/internal/commands/root/node.go @@ -26,7 +26,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -const osLabel = "beta.kubernetes.io/os" +const betaOsLabel = "beta.kubernetes.io/os" +const stableOsLabel = "kubernetes.io/os" // NodeFromProvider builds a kubernetes node object from a provider // This is a temporary solution until node stuff actually split off from the provider interface itself. @@ -58,8 +59,11 @@ func NodeFromProvider(ctx context.Context, name string, taint *v1.Taint, p provi } p.ConfigureNode(ctx, node) - if _, ok := node.ObjectMeta.Labels[osLabel]; !ok { - node.ObjectMeta.Labels[osLabel] = strings.ToLower(node.Status.NodeInfo.OperatingSystem) + if _, ok := node.ObjectMeta.Labels[betaOsLabel]; !ok { + node.ObjectMeta.Labels[betaOsLabel] = strings.ToLower(node.Status.NodeInfo.OperatingSystem) + } + if _, ok := node.ObjectMeta.Labels[stableOsLabel]; !ok { + node.ObjectMeta.Labels[stableOsLabel] = strings.ToLower(node.Status.NodeInfo.OperatingSystem) } return node }