Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ARM
k8s
Kured
Commits
0f00f1b0
Commit
0f00f1b0
authored
Sep 21, 2017
by
Adam Harrison
Browse files
Remove obsolete waitForDrain implementation
parent
156e9a1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
cmd/kured/main.go
View file @
0f00f1b0
...
@@ -171,40 +171,6 @@ func uncordon(nodeID string) {
...
@@ -171,40 +171,6 @@ func uncordon(nodeID string) {
}
}
}
}
func
waitForDrain
(
client
*
kubernetes
.
Clientset
,
nodeID
string
)
{
for
{
var
unterminated
int
namespaces
,
err
:=
client
.
CoreV1
()
.
Namespaces
()
.
List
(
metav1
.
ListOptions
{})
if
err
!=
nil
{
log
.
Fatalf
(
"Error waiting for drain: %v"
,
err
)
}
for
_
,
namespace
:=
range
namespaces
.
Items
{
drainCandidates
:=
metav1
.
ListOptions
{
LabelSelector
:
"ignore_on_drain!=true"
}
pods
,
err
:=
client
.
CoreV1
()
.
Pods
(
namespace
.
ObjectMeta
.
Name
)
.
List
(
drainCandidates
)
if
err
!=
nil
{
log
.
Fatalf
(
"Error waiting for drain: %v"
,
err
)
}
for
_
,
pod
:=
range
pods
.
Items
{
if
pod
.
Spec
.
NodeName
==
nodeID
&&
pod
.
Status
.
Phase
!=
"Succeeded"
&&
pod
.
Status
.
Phase
!=
"Failed"
{
unterminated
++
}
}
}
if
unterminated
==
0
{
return
}
log
.
Infof
(
"Waiting for %d pods to terminate"
,
unterminated
)
time
.
Sleep
(
time
.
Minute
)
}
}
func
commandReboot
(
nodeID
string
)
{
func
commandReboot
(
nodeID
string
)
{
log
.
Infof
(
"Commanding reboot"
)
log
.
Infof
(
"Commanding reboot"
)
...
@@ -271,7 +237,6 @@ func rebootAsRequired(nodeID string) {
...
@@ -271,7 +237,6 @@ func rebootAsRequired(nodeID string) {
if
acquire
(
lock
,
&
nodeMeta
)
{
if
acquire
(
lock
,
&
nodeMeta
)
{
if
!
nodeMeta
.
Unschedulable
{
if
!
nodeMeta
.
Unschedulable
{
drain
(
nodeID
)
drain
(
nodeID
)
waitForDrain
(
client
,
nodeID
)
}
}
commandReboot
(
nodeID
)
commandReboot
(
nodeID
)
for
{
for
{
...
...
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