mirror of https://github.com/k3s-io/k3s
kubelet: promote OS & arch labels to GA
kubelet now applies both the beta and the GA labels to ensure backward compatibility.pull/564/head
parent
4531ce692a
commit
00d93f0cc3
|
@ -30,16 +30,19 @@ const (
|
|||
|
||||
LabelInstanceType = "beta.kubernetes.io/instance-type"
|
||||
|
||||
LabelOS = "beta.kubernetes.io/os"
|
||||
LabelArch = "beta.kubernetes.io/arch"
|
||||
LabelOS = "kubernetes.io/os"
|
||||
LabelArch = "kubernetes.io/arch"
|
||||
// The OS/Arch labels are promoted to GA in 1.14. kubelet applies both beta
|
||||
// and GA labels to ensure backward compatibility.
|
||||
// TODO: stop applying the beta OS/Arch labels in Kubernetes 1.17.
|
||||
LegacyLabelOS = "beta.kubernetes.io/os"
|
||||
LegacyLabelArch = "beta.kubernetes.io/arch"
|
||||
|
||||
// GA versions of the legacy beta labels.
|
||||
// TODO: update kubelet and controllers to set both beta and GA labels, then export these constants
|
||||
labelZoneFailureDomainGA = "failure-domain.kubernetes.io/zone"
|
||||
labelZoneRegionGA = "failure-domain.kubernetes.io/region"
|
||||
labelInstanceTypeGA = "kubernetes.io/instance-type"
|
||||
labelOSGA = "kubernetes.io/os"
|
||||
labelArchGA = "kubernetes.io/arch"
|
||||
|
||||
// LabelNamespaceSuffixKubelet is an allowed label namespace suffix kubelets can self-set ([*.]kubelet.kubernetes.io/*)
|
||||
LabelNamespaceSuffixKubelet = "kubelet.kubernetes.io"
|
||||
|
@ -62,11 +65,12 @@ var kubeletLabels = sets.NewString(
|
|||
LabelOS,
|
||||
LabelArch,
|
||||
|
||||
LegacyLabelOS,
|
||||
LegacyLabelArch,
|
||||
|
||||
labelZoneFailureDomainGA,
|
||||
labelZoneRegionGA,
|
||||
labelInstanceTypeGA,
|
||||
labelOSGA,
|
||||
labelArchGA,
|
||||
)
|
||||
|
||||
var kubeletLabelNamespaces = sets.NewString(
|
||||
|
|
|
@ -151,6 +151,8 @@ func (kl *Kubelet) updateDefaultLabels(initialNode, existingNode *v1.Node) bool
|
|||
kubeletapis.LabelInstanceType,
|
||||
kubeletapis.LabelOS,
|
||||
kubeletapis.LabelArch,
|
||||
kubeletapis.LegacyLabelOS,
|
||||
kubeletapis.LegacyLabelArch,
|
||||
}
|
||||
|
||||
needsUpdate := false
|
||||
|
@ -213,9 +215,11 @@ func (kl *Kubelet) initialNode() (*v1.Node, error) {
|
|||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: string(kl.nodeName),
|
||||
Labels: map[string]string{
|
||||
kubeletapis.LabelHostname: kl.hostname,
|
||||
kubeletapis.LabelOS: goruntime.GOOS,
|
||||
kubeletapis.LabelArch: goruntime.GOARCH,
|
||||
kubeletapis.LabelHostname: kl.hostname,
|
||||
kubeletapis.LabelOS: goruntime.GOOS,
|
||||
kubeletapis.LabelArch: goruntime.GOARCH,
|
||||
kubeletapis.LegacyLabelOS: goruntime.GOOS,
|
||||
kubeletapis.LegacyLabelArch: goruntime.GOARCH,
|
||||
},
|
||||
},
|
||||
Spec: v1.NodeSpec{
|
||||
|
|
|
@ -1046,9 +1046,11 @@ func TestRegisterWithApiServer(t *testing.T) {
|
|||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: testKubeletHostname,
|
||||
Labels: map[string]string{
|
||||
kubeletapis.LabelHostname: testKubeletHostname,
|
||||
kubeletapis.LabelOS: goruntime.GOOS,
|
||||
kubeletapis.LabelArch: goruntime.GOARCH,
|
||||
kubeletapis.LabelHostname: testKubeletHostname,
|
||||
kubeletapis.LabelOS: goruntime.GOOS,
|
||||
kubeletapis.LabelArch: goruntime.GOARCH,
|
||||
kubeletapis.LegacyLabelOS: goruntime.GOOS,
|
||||
kubeletapis.LegacyLabelArch: goruntime.GOARCH,
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
|
@ -1091,9 +1093,11 @@ func TestTryRegisterWithApiServer(t *testing.T) {
|
|||
node := &v1.Node{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
kubeletapis.LabelHostname: testKubeletHostname,
|
||||
kubeletapis.LabelOS: goruntime.GOOS,
|
||||
kubeletapis.LabelArch: goruntime.GOARCH,
|
||||
kubeletapis.LabelHostname: testKubeletHostname,
|
||||
kubeletapis.LabelOS: goruntime.GOOS,
|
||||
kubeletapis.LabelArch: goruntime.GOARCH,
|
||||
kubeletapis.LegacyLabelOS: goruntime.GOOS,
|
||||
kubeletapis.LegacyLabelArch: goruntime.GOARCH,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue