From e77f7542607f55f0fed3244d69d05a1cbb71882a Mon Sep 17 00:00:00 2001 From: Diego Rodriguez Date: Tue, 30 Jun 2020 11:58:14 +0200 Subject: [PATCH] cli: remove dangling images before deploy * Avoids having dangling docker images on the Kubernetes nodes because the Kubernetes Python library fails to list nodes (required by REANA-Commons and REANA-Server scheduler to determine if more workflows can be submitted) because of a validation error of data coming from the Kubernetes API. More information [here](https://github.com/kubernetes-client/python/issues/895#issuecomment-516577814). * Tags the kindest/node image to latest because after installation it has `none` tag, which makes it count as a dangling image. --- reana/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reana/cli.py b/reana/cli.py index 8c826b3d..033f7cad 100644 --- a/reana/cli.py +++ b/reana/cli.py @@ -1783,6 +1783,7 @@ def job_mounts_to_config(job_mounts): namespace=namespace, values=yaml.dump(values_dict), ) deploy_cmds = [ + "docker images -f 'dangling=true' -q | xargs docker rmi -f", "helm dep update helm/reana", helm_install, "kubectl config set-context --current --namespace={}".format(namespace), @@ -2200,6 +2201,8 @@ def add_volume_mounts(node): cluster_create, "reana-dev docker-pull -c reana", "reana-dev kind-load-docker-image -c reana", + "docker tag $(docker images -f 'dangling=true' 'kindest/node' -q) kindest/node:latest", + # avoid having kindest/node as a dangling image (no tag) ]: run_command(cmd, "reana")