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
4f4cf18f
Commit
4f4cf18f
authored
Jun 29, 2022
by
Brad Davidson
Committed by
Brad Davidson
Jun 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for down-level etcd join
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
96162c07
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
test-helpers
scripts/test-helpers
+1
-1
test-run-etcd
scripts/test-run-etcd
+29
-1
No files found.
scripts/test-helpers
View file @
4f4cf18f
...
...
@@ -325,7 +325,7 @@ test-setup() {
SERVER_MINOR
=
$(
awk
-F
.
'{print $2}'
<<<
${
K3S_IMAGE_SERVER
:-
$K3S_IMAGE
})
AGENT_MINOR
=
$(
awk
-F
.
'{print $2}'
<<<
${
K3S_IMAGE_AGENT
:-
$K3S_IMAGE
})
if
[
$AGENT_MINOR
-gt
$SERVER_MINOR
]
;
then
if
[
$
NUM_AGENTS
-gt
0
]
&&
[
$
AGENT_MINOR
-gt
$SERVER_MINOR
]
;
then
echo
"Agent minor version cannot be newer than server - not supported by Kubernetes version skew policy"
exit
0
fi
...
...
scripts/test-run-etcd
View file @
4f4cf18f
...
...
@@ -12,6 +12,13 @@ export NUM_AGENTS=0
export
WAIT_SERVICES
=
"
${
all_services
[@]
}
"
export
SERVER_1_ARGS
=
"--cluster-init"
REPO
=
${
REPO
:-
rancher
}
IMAGE_NAME
=
${
IMAGE_NAME
:-
k3s
}
PREVIOUS_CHANNEL
=
$(
grep
'k8s.io/kubernetes v'
go.mod |
head
-n1
|
awk
'{print $2}'
|
awk
-F
.
'{print "v1." ($2 - 1)}'
)
PREVIOUS_VERSION
=
$(
curl
-s
https://update.k3s.io/v1-release/channels/
${
PREVIOUS_CHANNEL
}
-o
/dev/null
-w
'%{redirect_url}'
|
awk
-F
/
'{print gensub(/\+/, "-", "g", $NF)}'
)
STABLE_VERSION
=
$(
curl
-s
https://update.k3s.io/v1-release/channels/stable
-o
/dev/null
-w
'%{redirect_url}'
|
awk
-F
/
'{print gensub(/\+/, "-", "g", $NF)}'
)
LATEST_VERSION
=
$(
curl
-s
https://update.k3s.io/v1-release/channels/latest
-o
/dev/null
-w
'%{redirect_url}'
|
awk
-F
/
'{print gensub(/\+/, "-", "g", $NF)}'
)
server-post-hook
()
{
if
[
$1
-eq
1
]
;
then
local
url
=
$(
cat
$TEST_DIR
/servers/1/metadata/url
)
...
...
@@ -20,7 +27,6 @@ server-post-hook() {
}
export
-f
server-post-hook
export
-f
server-post-hook
start-test
()
{
echo
"Cluster is up"
}
...
...
@@ -32,6 +38,28 @@ LABEL="ETCD-JOIN-BASIC" SERVER_ARGS="" run-test
# --- create a basic cluster to test joining a managed etcd cluster with --agent-token set
LABEL
=
"ETCD-JOIN-AGENTTOKEN"
SERVER_ARGS
=
"--agent-token
${
RANDOM
}${
RANDOM
}${
RANDOM
}
"
run-test
# --- test joining managed etcd cluster with stable-version first server and current-build second server
server-post-hook
()
{
if
[
$1
-eq
1
]
;
then
local
url
=
$(
cat
$TEST_DIR
/servers/1/metadata/url
)
export
SERVER_ARGS
=
"
${
SERVER_ARGS
}
--server
$url
"
export
K3S_IMAGE_SERVER
=
${
K3S_IMAGE
}
fi
}
export
-f
server-post-hook
LABEL
=
"ETCD-JOIN-STABLE-FIRST"
K3S_IMAGE_SERVER
=
${
REPO
}
/
${
IMAGE_NAME
}
:
${
STABLE_VERSION
}
run-test
# --- test joining managed etcd cluster with current-build first server and stable-version second server
server-post-hook
()
{
if
[
$1
-eq
1
]
;
then
local
url
=
$(
cat
$TEST_DIR
/servers/1/metadata/url
)
export
SERVER_ARGS
=
"
${
SERVER_ARGS
}
--server
$url
"
export
K3S_IMAGE_SERVER
=
${
K3S_IMAGE_SERVER_2
}
fi
}
export
-f
server-post-hook
LABEL
=
"ETCD-JOIN-STABLE-SECOND"
K3S_IMAGE_SERVER_2
=
${
REPO
}
/
${
IMAGE_NAME
}
:
${
STABLE_VERSION
}
run-test
# --- test joining a managed etcd cluster with incompatible configuration
test-post-hook
()
{
if
[[
$1
-eq
0
]]
;
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