mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Check for either Docker or Containerd getting active for e2e_node tests
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
parent
fbb4bb0003
commit
01183e51f0
@ -376,16 +376,7 @@ function try-load-docker-image {
|
||||
set +e
|
||||
local -r max_attempts=5
|
||||
local -i attempt_num=1
|
||||
|
||||
if [[ "${CONTAINER_RUNTIME_NAME:-}" == "docker" ]]; then
|
||||
load_image_command=${LOAD_IMAGE_COMMAND:-docker load -i}
|
||||
elif [[ "${CONTAINER_RUNTIME_NAME:-}" == "containerd" ]]; then
|
||||
load_image_command=${LOAD_IMAGE_COMMAND:-ctr -n=k8s.io images import}
|
||||
else
|
||||
load_image_command="${LOAD_IMAGE_COMMAND:-}"
|
||||
fi
|
||||
|
||||
until timeout 30 ${load_image_command} "${img}"; do
|
||||
until timeout 30 ${LOAD_IMAGE_COMMAND:-docker load -i} "${img}"; do
|
||||
if [[ "${attempt_num}" == "${max_attempts}" ]]; then
|
||||
echo "Fail to load docker image file ${img} after ${max_attempts} retries. Exit!!"
|
||||
exit 1
|
||||
|
@ -668,13 +668,15 @@ func createInstance(imageConfig *internalGCEImage) (string, error) {
|
||||
// TODO(random-liu): Remove the docker version check. Use some other command to check
|
||||
// instance readiness.
|
||||
var output string
|
||||
output, err = remote.SSH(name, "docker", "version")
|
||||
output, err = remote.SSH(name, "sh", "-c",
|
||||
"'systemctl list-units --type=service --state=running | grep -e docker -e containerd'")
|
||||
if err != nil {
|
||||
err = fmt.Errorf("instance %s not running docker daemon - Command failed: %s", name, output)
|
||||
err = fmt.Errorf("instance %s not running docker/containerd daemon - Command failed: %s", name, output)
|
||||
continue
|
||||
}
|
||||
if !strings.Contains(output, "Server") {
|
||||
err = fmt.Errorf("instance %s not running docker daemon - Server not found: %s", name, output)
|
||||
if !strings.Contains(output, "docker.service") &&
|
||||
!strings.Contains(output, "containerd.service") {
|
||||
err = fmt.Errorf("instance %s not running docker/containerd daemon: %s", name, output)
|
||||
continue
|
||||
}
|
||||
instanceRunning = true
|
||||
|
Loading…
Reference in New Issue
Block a user