mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Replaces modifying node object with returning a map of labels
- Adds label to update flow so can be picked up by an existing node
This commit is contained in:
parent
e852cd40f0
commit
f8e90eb5b0
@ -155,6 +155,7 @@ func (kl *Kubelet) updateDefaultLabels(initialNode, existingNode *v1.Node) bool
|
|||||||
v1.LabelInstanceType,
|
v1.LabelInstanceType,
|
||||||
v1.LabelOSStable,
|
v1.LabelOSStable,
|
||||||
v1.LabelArchStable,
|
v1.LabelArchStable,
|
||||||
|
v1.LabelWindowsBuild,
|
||||||
kubeletapis.LabelOS,
|
kubeletapis.LabelOS,
|
||||||
kubeletapis.LabelArch,
|
kubeletapis.LabelArch,
|
||||||
}
|
}
|
||||||
@ -230,9 +231,13 @@ func (kl *Kubelet) initialNode(ctx context.Context) (*v1.Node, error) {
|
|||||||
Unschedulable: !kl.registerSchedulable,
|
Unschedulable: !kl.registerSchedulable,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if err := addOSSpecificLabels(node); err != nil {
|
osLabels, err := getOSSpecificLabels()
|
||||||
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
for label, value := range osLabels {
|
||||||
|
node.Labels[label] = value
|
||||||
|
}
|
||||||
|
|
||||||
nodeTaints := make([]v1.Taint, 0)
|
nodeTaints := make([]v1.Taint, 0)
|
||||||
if len(kl.registerWithTaints) > 0 {
|
if len(kl.registerWithTaints) > 0 {
|
||||||
|
@ -18,10 +18,6 @@ limitations under the License.
|
|||||||
|
|
||||||
package kubelet
|
package kubelet
|
||||||
|
|
||||||
import (
|
func getOSSpecificLabels() (map[string]string, error) {
|
||||||
v1 "k8s.io/api/core/v1"
|
return nil, nil
|
||||||
)
|
|
||||||
|
|
||||||
func addOSSpecificLabels(n *v1.Node) error {
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,11 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/kubelet/winstats"
|
"k8s.io/kubernetes/pkg/kubelet/winstats"
|
||||||
)
|
)
|
||||||
|
|
||||||
func addOSSpecificLabels(n *v1.Node) error {
|
func getOSSpecificLabels() (map[string]string, error) {
|
||||||
osInfo, err := winstats.GetOSInfo()
|
osInfo, err := winstats.GetOSInfo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
n.Labels[v1.LabelWindowsBuild] = osInfo.GetBuild()
|
|
||||||
return nil
|
return map[string]string{v1.LabelWindowsBuild: osInfo.GetBuild()}, nil
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ const (
|
|||||||
LabelOSStable = "kubernetes.io/os"
|
LabelOSStable = "kubernetes.io/os"
|
||||||
LabelArchStable = "kubernetes.io/arch"
|
LabelArchStable = "kubernetes.io/arch"
|
||||||
|
|
||||||
|
// LabelWindowsBuild is used on Windows nodes to specify the Windows build number starting with v1.17.0.
|
||||||
|
// It's in the format MajorVersion.MinorVersion.BuildNumber (for ex: 10.0.17763)
|
||||||
LabelWindowsBuild = "node.kubernetes.io/windows-build"
|
LabelWindowsBuild = "node.kubernetes.io/windows-build"
|
||||||
|
|
||||||
// LabelNamespaceSuffixKubelet is an allowed label namespace suffix kubelets can self-set ([*.]kubelet.kubernetes.io/*)
|
// LabelNamespaceSuffixKubelet is an allowed label namespace suffix kubelets can self-set ([*.]kubelet.kubernetes.io/*)
|
||||||
|
Loading…
Reference in New Issue
Block a user