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
cb09d4d3
Unverified
Commit
cb09d4d3
authored
Jan 18, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Jan 18, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #72507 from dixudx/remove_stale_OutOfDisk
remove stale OutOfDisk condition from kubelet side
parents
5b4b40cf
e1a854b8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
0 deletions
+64
-0
kubelet_node_status.go
pkg/kubelet/kubelet_node_status.go
+1
-0
setters.go
pkg/kubelet/nodestatus/setters.go
+15
-0
setters_test.go
pkg/kubelet/nodestatus/setters_test.go
+48
-0
No files found.
pkg/kubelet/kubelet_node_status.go
View file @
cb09d4d3
...
@@ -528,6 +528,7 @@ func (kl *Kubelet) defaultNodeStatusFuncs() []func(*v1.Node) error {
...
@@ -528,6 +528,7 @@ func (kl *Kubelet) defaultNodeStatusFuncs() []func(*v1.Node) error {
nodestatus
.
PIDPressureCondition
(
kl
.
clock
.
Now
,
kl
.
evictionManager
.
IsUnderPIDPressure
,
kl
.
recordNodeStatusEvent
),
nodestatus
.
PIDPressureCondition
(
kl
.
clock
.
Now
,
kl
.
evictionManager
.
IsUnderPIDPressure
,
kl
.
recordNodeStatusEvent
),
nodestatus
.
ReadyCondition
(
kl
.
clock
.
Now
,
kl
.
runtimeState
.
runtimeErrors
,
kl
.
runtimeState
.
networkErrors
,
validateHostFunc
,
kl
.
containerManager
.
Status
,
kl
.
recordNodeStatusEvent
),
nodestatus
.
ReadyCondition
(
kl
.
clock
.
Now
,
kl
.
runtimeState
.
runtimeErrors
,
kl
.
runtimeState
.
networkErrors
,
validateHostFunc
,
kl
.
containerManager
.
Status
,
kl
.
recordNodeStatusEvent
),
nodestatus
.
VolumesInUse
(
kl
.
volumeManager
.
ReconcilerStatesHasBeenSynced
,
kl
.
volumeManager
.
GetVolumesInUse
),
nodestatus
.
VolumesInUse
(
kl
.
volumeManager
.
ReconcilerStatesHasBeenSynced
,
kl
.
volumeManager
.
GetVolumesInUse
),
nodestatus
.
RemoveOutOfDiskCondition
(),
// TODO(mtaufen): I decided not to move this setter for now, since all it does is send an event
// TODO(mtaufen): I decided not to move this setter for now, since all it does is send an event
// and record state back to the Kubelet runtime object. In the future, I'd like to isolate
// and record state back to the Kubelet runtime object. In the future, I'd like to isolate
// these side-effects by decoupling the decisions to send events and partial status recording
// these side-effects by decoupling the decisions to send events and partial status recording
...
...
pkg/kubelet/nodestatus/setters.go
View file @
cb09d4d3
...
@@ -746,3 +746,18 @@ func VolumeLimits(volumePluginListFunc func() []volume.VolumePluginWithAttachLim
...
@@ -746,3 +746,18 @@ func VolumeLimits(volumePluginListFunc func() []volume.VolumePluginWithAttachLim
return
nil
return
nil
}
}
}
}
// RemoveOutOfDiskCondition removes stale OutOfDisk condition
// OutOfDisk condition has been removed from kubelet in 1.12
func
RemoveOutOfDiskCondition
()
Setter
{
return
func
(
node
*
v1
.
Node
)
error
{
var
conditions
[]
v1
.
NodeCondition
for
i
:=
range
node
.
Status
.
Conditions
{
if
node
.
Status
.
Conditions
[
i
]
.
Type
!=
v1
.
NodeOutOfDisk
{
conditions
=
append
(
conditions
,
node
.
Status
.
Conditions
[
i
])
}
}
node
.
Status
.
Conditions
=
conditions
return
nil
}
}
pkg/kubelet/nodestatus/setters_test.go
View file @
cb09d4d3
...
@@ -1508,6 +1508,54 @@ func TestVolumeLimits(t *testing.T) {
...
@@ -1508,6 +1508,54 @@ func TestVolumeLimits(t *testing.T) {
}
}
}
}
func
TestRemoveOutOfDiskCondition
(
t
*
testing
.
T
)
{
now
:=
time
.
Now
()
var
cases
=
[]
struct
{
desc
string
inputNode
*
v1
.
Node
expectNode
*
v1
.
Node
}{
{
desc
:
"should remove stale OutOfDiskCondition from node status"
,
inputNode
:
&
v1
.
Node
{
Status
:
v1
.
NodeStatus
{
Conditions
:
[]
v1
.
NodeCondition
{
*
makeMemoryPressureCondition
(
false
,
now
,
now
),
{
Type
:
v1
.
NodeOutOfDisk
,
Status
:
v1
.
ConditionFalse
,
},
*
makeDiskPressureCondition
(
false
,
now
,
now
),
},
},
},
expectNode
:
&
v1
.
Node
{
Status
:
v1
.
NodeStatus
{
Conditions
:
[]
v1
.
NodeCondition
{
*
makeMemoryPressureCondition
(
false
,
now
,
now
),
*
makeDiskPressureCondition
(
false
,
now
,
now
),
},
},
},
},
}
for
_
,
tc
:=
range
cases
{
t
.
Run
(
tc
.
desc
,
func
(
t
*
testing
.
T
)
{
// construct setter
setter
:=
RemoveOutOfDiskCondition
()
// call setter on node
if
err
:=
setter
(
tc
.
inputNode
);
err
!=
nil
{
t
.
Fatalf
(
"unexpected error: %v"
,
err
)
}
// check expected node
assert
.
True
(
t
,
apiequality
.
Semantic
.
DeepEqual
(
tc
.
expectNode
,
tc
.
inputNode
),
"Diff: %s"
,
diff
.
ObjectDiff
(
tc
.
expectNode
,
tc
.
inputNode
))
})
}
}
// Test Helpers:
// Test Helpers:
// sortableNodeAddress is a type for sorting []v1.NodeAddress
// sortableNodeAddress is a type for sorting []v1.NodeAddress
...
...
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