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
1eb91764
Commit
1eb91764
authored
Dec 16, 2016
by
Kubernetes Submit Queue
Committed by
GitHub
Dec 16, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #38814 from jszczepkowski/ha-validation-fix
Automatic merge from submit-queue Fixed infinite loop in cluster validation.
parents
08342c1f
3dbfa947
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
validate-cluster.sh
cluster/validate-cluster.sh
+15
-3
No files found.
cluster/validate-cluster.sh
View file @
1eb91764
...
...
@@ -73,7 +73,9 @@ REQUIRED_NUM_NODES=$((EXPECTED_NUM_NODES - ALLOWED_NOTREADY_NODES))
# Make several attempts to deal with slow cluster birth.
return_value
=
0
attempt
=
0
# Set the timeout to ~25minutes (100 x 15 second) to avoid timeouts for 1000-node clusters.
PAUSE_BETWEEN_ITERATIONS_SECONDS
=
15
MAX_ATTEMPTS
=
100
ADDITIONAL_ITERATIONS
=
$((
(
CLUSTER_READY_ADDITIONAL_TIME_SECONDS
+
PAUSE_BETWEEN_ITERATIONS_SECONDS
-
1
)/
PAUSE_BETWEEN_ITERATIONS_SECONDS
))
while
true
;
do
# Pause between iterations of this large outer loop.
...
...
@@ -91,7 +93,18 @@ while true; do
# Suppress errors from kubectl output because during cluster bootstrapping
# for clusters where the master node is registered, the apiserver will become
# available and then get restarted as the kubelet configures the docker bridge.
node
=
$(
kubectl_retry get nodes
)
||
continue
#
# We are assigning the result of kubectl_retry get nodes operation to the res
# varaible in that way, to prevent stopping the whole script on an error.
node
=
$(
kubectl_retry get nodes
)
&&
res
=
"
$?
"
||
res
=
"
$?
"
if
[
"
${
res
}
"
-ne
"0"
]
;
then
if
[[
"
${
attempt
}
"
-gt
"
${
last_run
:-
$MAX_ATTEMPTS
}
"
]]
;
then
echo
-e
"
${
color_red
}
Failed to get nodes.
${
color_norm
}
"
exit
1
else
continue
fi
fi
found
=
$(($(
echo
"
${
node
}
"
|
wc
-l
)
-
1
))
ready
=
$(($(
echo
"
${
node
}
"
|
grep
-v
"NotReady"
|
wc
-l
)
-
1
))
...
...
@@ -110,8 +123,7 @@ while true; do
echo
-e
"
${
color_green
}
Found
${
REQUIRED_NUM_NODES
}
Nodes, allowing additional
${
ADDITIONAL_ITERATIONS
}
iterations for other Nodes to join.
${
color_norm
}
"
last_run
=
"
${
last_run
:-$((
attempt
+
ADDITIONAL_ITERATIONS
-
1
))}
"
fi
# Set the timeout to ~25minutes (100 x 15 second) to avoid timeouts for 1000-node clusters.
if
[[
"
${
attempt
}
"
-gt
"
${
last_run
:-
100
}
"
]]
;
then
if
[[
"
${
attempt
}
"
-gt
"
${
last_run
:-
$MAX_ATTEMPTS
}
"
]]
;
then
echo
-e
"
${
color_yellow
}
Detected
${
ready
}
ready nodes, found
${
found
}
nodes out of expected
${
EXPECTED_NUM_NODES
}
. Your cluster may not be fully functional.
${
color_norm
}
"
kubectl_retry get nodes
if
[[
"
${
REQUIRED_NUM_NODES
}
"
-gt
"
${
ready
}
"
]]
;
then
...
...
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