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
943ed6d2
Commit
943ed6d2
authored
Jan 05, 2015
by
Joe Beda
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3146 from zmerlynn/limit_liveness_gke
GKE: Limit liveness.sh to server version >0.7.2
parents
7d507a4f
e965fc1f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
kube-env.sh
cluster/kube-env.sh
+20
-0
liveness.sh
hack/e2e-suite/liveness.sh
+13
-3
No files found.
cluster/kube-env.sh
View file @
943ed6d2
...
@@ -30,3 +30,23 @@ if [[ -z "${color_start-}" ]]; then
...
@@ -30,3 +30,23 @@ if [[ -z "${color_start-}" ]]; then
declare
-r
color_green
=
"
${
color_start
}
0;32m"
declare
-r
color_green
=
"
${
color_start
}
0;32m"
declare
-r
color_norm
=
"
${
color_start
}
0m"
declare
-r
color_norm
=
"
${
color_start
}
0m"
fi
fi
# Returns the server version as MMmmpp, with MM as the major
# component, mm the minor component, and pp as the patch
# revision. e.g. 0.7.1 is echoed as 701, and 1.0.11 would be
# 10011. (This makes for easy integer comparison in bash.)
function
kube_server_version
()
{
local
server_version
local
major
local
minor
local
patch
# This sed expression is the POSIX BRE to match strings like:
# Server Version: &version.Info{Major:"0", Minor:"7+", GitVersion:"v0.7.0-dirty", GitCommit:"ad44234f7152e9c66bc2853575445c7071335e57", GitTreeState:"dirty"}
# and capture the GitVersion portion (which has the patch level)
server_version
=
$(${
KUBECTL
}
--match-server-version
=
false
version |
grep
"Server Version:"
)
read
major minor patch < <
(
echo
${
server_version
}
|
\
sed
"s/.*GitVersion:
\"
v
\(
[0-9]
\{
1,
\}\)\.\(
[0-9]
\{
1,
\}\)\.\(
[0-9]
\{
1,
\}\)
.*/
\1
\2
\3
/"
)
printf
"%02d%02d%02d"
${
major
}
${
minor
}
${
patch
}
|
sed
's/^0*//'
}
hack/e2e-suite/liveness.sh
View file @
943ed6d2
...
@@ -25,10 +25,20 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
...
@@ -25,10 +25,20 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source
"
${
KUBE_ROOT
}
/cluster/kube-env.sh"
source
"
${
KUBE_ROOT
}
/cluster/kube-env.sh"
source
"
${
KUBE_ROOT
}
/cluster/
$KUBERNETES_PROVIDER
/util.sh"
source
"
${
KUBE_ROOT
}
/cluster/
$KUBERNETES_PROVIDER
/util.sh"
liveness_tests
=
"http exec"
if
[[
${
KUBERNETES_PROVIDER
}
==
"gke"
]]
;
then
server_version
=
$(
kube_server_version
)
if
[[
${
server_version
}
-le
702
]]
;
then
echo
"GKE server version <= 0.7.2, limiting test to http (version =
${
server_version
}
)"
liveness_tests
=
"http"
fi
fi
function
teardown
()
{
function
teardown
()
{
echo
"Cleaning up test artifacts"
echo
"Cleaning up test artifacts"
${
KUBECFG
}
delete pods/liveness-http
for
test
in
${
liveness_tests
}
;
do
${
KUBECFG
}
delete pods/liveness-exec
${
KUBECFG
}
delete pods/liveness-
${
test
}
done
}
}
function
waitForNotPending
()
{
function
waitForNotPending
()
{
...
@@ -58,7 +68,7 @@ function waitForNotPending() {
...
@@ -58,7 +68,7 @@ function waitForNotPending() {
trap
"teardown"
EXIT
trap
"teardown"
EXIT
for
test
in
http
exec
;
do
for
test
in
${
liveness_tests
}
;
do
echo
"Liveness test:
${
test
}
"
echo
"Liveness test:
${
test
}
"
${
KUBECFG
}
-c
${
KUBE_ROOT
}
/examples/liveness/
${
test
}
-liveness
.yaml create pods
${
KUBECFG
}
-c
${
KUBE_ROOT
}
/examples/liveness/
${
test
}
-liveness
.yaml create pods
waitForNotPending
waitForNotPending
...
...
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