mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Check for invalid kubectl/ctr/crictl version strings
This commit is contained in:
parent
8a8fa8a351
commit
b680295922
@ -87,6 +87,24 @@ export -f wait-for-services
|
||||
|
||||
# ---
|
||||
|
||||
verify-valid-version() {
|
||||
if docker exec $@ 2>&1 | grep -iE '(dev|head|unknown|fail|refuse)'; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
export -f verify-valid-version
|
||||
|
||||
# ---
|
||||
|
||||
verify-valid-versions() {
|
||||
verify-valid-version $1 kubectl version
|
||||
verify-valid-version $1 ctr version
|
||||
verify-valid-version $1 crictl version
|
||||
}
|
||||
export -f verify-valid-versions
|
||||
|
||||
# ---
|
||||
|
||||
dump-container-logs() {
|
||||
mkdir -p ${LOGS}
|
||||
for container in ${CONTAINERS}; do
|
||||
@ -179,9 +197,10 @@ docker run -d --name ${K3S_SERVER} --privileged \
|
||||
K3S_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${K3S_SERVER})
|
||||
echo "Started ${K3S_SERVER} @ ${K3S_IP}:${K3S_PORT}"
|
||||
|
||||
# ---
|
||||
|
||||
timeout --foreground 1m bash -c wait-for-kubeconfig
|
||||
verify-valid-versions ${K3S_SERVER}
|
||||
|
||||
# ---
|
||||
|
||||
docker run -d --name ${K3S_AGENT} --privileged \
|
||||
-e K3S_CLUSTER_SECRET=${SECRET} \
|
||||
|
Loading…
Reference in New Issue
Block a user