2021-03-01 08:58:50 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
all_services=(
|
|
|
|
coredns
|
|
|
|
local-path-provisioner
|
|
|
|
metrics-server
|
|
|
|
traefik
|
|
|
|
)
|
|
|
|
|
|
|
|
export NUM_SERVERS=1
|
|
|
|
export NUM_AGENTS=1
|
|
|
|
export WAIT_SERVICES="${all_services[@]}"
|
|
|
|
export SERVER_ARGS="--node-taint=CriticalAddonsOnly=true:NoExecute"
|
|
|
|
|
|
|
|
start-test() {
|
|
|
|
echo "Cluster is up"
|
|
|
|
}
|
|
|
|
export -f start-test
|
|
|
|
|
2021-03-01 19:49:26 +00:00
|
|
|
# --- suppress test failures if the agent is intentionally incompatible with the server version
|
|
|
|
test-post-hook() {
|
|
|
|
if [[ $1 -eq 0 ]]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
grep -sqF 'incompatible down-level server detected' $TEST_DIR/agents/*/logs/system.log
|
|
|
|
}
|
|
|
|
export -f test-post-hook
|
|
|
|
|
2021-03-01 08:58:50 +00:00
|
|
|
REPO=${REPO:-rancher}
|
|
|
|
IMAGE_NAME=${IMAGE_NAME:-k3s}
|
2021-08-04 23:34:55 +00:00
|
|
|
PREVIOUS_CHANNEL=$(grep 'k8s.io/kubernetes v' go.mod | head -n1 | awk '{print $2}' | awk -F. '{print "v1." ($(NF - 1) - 1)}')
|
2021-03-01 08:58:50 +00:00
|
|
|
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)}')
|
|
|
|
|
|
|
|
# --- create a basic cluster to test for compat with the previous minor version of the server and agent
|
|
|
|
K3S_IMAGE_SERVER=${REPO}/${IMAGE_NAME}:${PREVIOUS_VERSION} LABEL=PREVIOUS-SERVER run-test
|
|
|
|
K3S_IMAGE_AGENT=${REPO}/${IMAGE_NAME}:${PREVIOUS_VERSION} LABEL=PREVIOUS-AGENT run-test
|
|
|
|
|
|
|
|
# --- create a basic cluster to test for compat with the stable version of the server and agent
|
|
|
|
K3S_IMAGE_SERVER=${REPO}/${IMAGE_NAME}:${STABLE_VERSION} LABEL=STABLE-SERVER run-test
|
|
|
|
K3S_IMAGE_AGENT=${REPO}/${IMAGE_NAME}:${STABLE_VERSION} LABEL=STABLE-AGENT run-test
|
|
|
|
|
|
|
|
# --- create a basic cluster to test for compat with the latest version of the server and agent
|
|
|
|
K3S_IMAGE_SERVER=${REPO}/${IMAGE_NAME}:${LATEST_VERSION} LABEL=LATEST-SERVER run-test
|
|
|
|
K3S_IMAGE_AGENT=${REPO}/${IMAGE_NAME}:${LATEST_VERSION} LABEL=LATEST-AGENT run-test
|