Commit c5a5e216 authored by Michael Taufen's avatar Michael Taufen

port setNodeStatusGoRuntime to Setter abstraction

parent 8e217f71
...@@ -438,12 +438,6 @@ func (kl *Kubelet) recordEvent(eventType, event, message string) { ...@@ -438,12 +438,6 @@ func (kl *Kubelet) recordEvent(eventType, event, message string) {
kl.recorder.Eventf(kl.nodeRef, eventType, event, message) 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. // record if node schedulable change.
func (kl *Kubelet) recordNodeSchedulableEvent(node *v1.Node) { func (kl *Kubelet) recordNodeSchedulableEvent(node *v1.Node) {
kl.lastNodeUnschedulableLock.Lock() kl.lastNodeUnschedulableLock.Lock()
...@@ -509,7 +503,7 @@ func (kl *Kubelet) defaultNodeStatusFuncs() []func(*v1.Node) error { ...@@ -509,7 +503,7 @@ func (kl *Kubelet) defaultNodeStatusFuncs() []func(*v1.Node) error {
nodestatus.VersionInfo(kl.cadvisor.VersionInfo, kl.containerRuntime.Type, kl.containerRuntime.Version), nodestatus.VersionInfo(kl.cadvisor.VersionInfo, kl.containerRuntime.Type, kl.containerRuntime.Version),
nodestatus.DaemonEndpoints(kl.daemonEndpoints), nodestatus.DaemonEndpoints(kl.daemonEndpoints),
nodestatus.Images(kl.nodeStatusMaxImages, kl.imageManager.GetImageList), nodestatus.Images(kl.nodeStatusMaxImages, kl.imageManager.GetImageList),
withoutError(kl.setNodeStatusGoRuntime), nodestatus.GoRuntime(),
) )
if utilfeature.DefaultFeatureGate.Enabled(features.AttachVolumeLimit) { if utilfeature.DefaultFeatureGate.Enabled(features.AttachVolumeLimit) {
setters = append(setters, withoutError(kl.setVolumeLimits)) setters = append(setters, withoutError(kl.setVolumeLimits))
......
...@@ -20,6 +20,7 @@ import ( ...@@ -20,6 +20,7 @@ import (
"fmt" "fmt"
"math" "math"
"net" "net"
goruntime "runtime"
"strings" "strings"
"time" "time"
...@@ -376,6 +377,15 @@ func Images(nodeStatusMaxImages int32, ...@@ -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. // ReadyCondition returns a Setter that updates the v1.NodeReady condition on the node.
func ReadyCondition( func ReadyCondition(
nowFunc func() time.Time, // typically Kubelet.clock.Now nowFunc func() time.Time, // typically Kubelet.clock.Now
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment