mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
port setNodeStatusGoRuntime to Setter abstraction
This commit is contained in:
parent
8e217f7102
commit
c5a5e21639
@ -438,12 +438,6 @@ func (kl *Kubelet) recordEvent(eventType, event, message string) {
|
||||
kl.recorder.Eventf(kl.nodeRef, eventType, event, message)
|
||||
}
|
||||
|
||||
// Set the GOOS and GOARCH for this node
|
||||
func (kl *Kubelet) setNodeStatusGoRuntime(node *v1.Node) {
|
||||
node.Status.NodeInfo.OperatingSystem = goruntime.GOOS
|
||||
node.Status.NodeInfo.Architecture = goruntime.GOARCH
|
||||
}
|
||||
|
||||
// record if node schedulable change.
|
||||
func (kl *Kubelet) recordNodeSchedulableEvent(node *v1.Node) {
|
||||
kl.lastNodeUnschedulableLock.Lock()
|
||||
@ -509,7 +503,7 @@ func (kl *Kubelet) defaultNodeStatusFuncs() []func(*v1.Node) error {
|
||||
nodestatus.VersionInfo(kl.cadvisor.VersionInfo, kl.containerRuntime.Type, kl.containerRuntime.Version),
|
||||
nodestatus.DaemonEndpoints(kl.daemonEndpoints),
|
||||
nodestatus.Images(kl.nodeStatusMaxImages, kl.imageManager.GetImageList),
|
||||
withoutError(kl.setNodeStatusGoRuntime),
|
||||
nodestatus.GoRuntime(),
|
||||
)
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.AttachVolumeLimit) {
|
||||
setters = append(setters, withoutError(kl.setVolumeLimits))
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
"net"
|
||||
goruntime "runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -376,6 +377,15 @@ func Images(nodeStatusMaxImages int32,
|
||||
}
|
||||
}
|
||||
|
||||
// GoRuntime returns a Setter that sets GOOS and GOARCH on the node.
|
||||
func GoRuntime() Setter {
|
||||
return func(node *v1.Node) error {
|
||||
node.Status.NodeInfo.OperatingSystem = goruntime.GOOS
|
||||
node.Status.NodeInfo.Architecture = goruntime.GOARCH
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ReadyCondition returns a Setter that updates the v1.NodeReady condition on the node.
|
||||
func ReadyCondition(
|
||||
nowFunc func() time.Time, // typically Kubelet.clock.Now
|
||||
|
Loading…
Reference in New Issue
Block a user