Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c5a5e216
Commit
c5a5e216
authored
Jun 29, 2018
by
Michael Taufen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
port setNodeStatusGoRuntime to Setter abstraction
parent
8e217f71
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
kubelet_node_status.go
pkg/kubelet/kubelet_node_status.go
+1
-7
setters.go
pkg/kubelet/nodestatus/setters.go
+10
-0
No files found.
pkg/kubelet/kubelet_node_status.go
View file @
c5a5e216
...
@@ -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
))
...
...
pkg/kubelet/nodestatus/setters.go
View file @
c5a5e216
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment