From 9a0bb97a3437c9cf80c14c28721e7f4fa7718785 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 15 Mar 2022 15:43:11 -0400 Subject: [PATCH] add tags for KUBE_ADDON_REGISTRY when we load images locally Signed-off-by: Davanum Srinivas --- cluster/gce/gci/configure.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cluster/gce/gci/configure.sh b/cluster/gce/gci/configure.sh index c2792a2ffde..68db258f6e3 100644 --- a/cluster/gce/gci/configure.sh +++ b/cluster/gce/gci/configure.sh @@ -457,8 +457,10 @@ function try-load-docker-image { if [[ "${CONTAINER_RUNTIME_NAME:-}" == "containerd" || "${CONTAINERD_TEST:-}" == "containerd" ]]; then load_image_command=${LOAD_IMAGE_COMMAND:-ctr -n=k8s.io images import} + tag_image_command=${TAG_IMAGE_COMMAND:-ctr -n=k8s.io images tag} else load_image_command="${LOAD_IMAGE_COMMAND:-}" + tag_image_command="${TAG_IMAGE_COMMAND:-}" fi # Deliberately word split load_image_command @@ -472,6 +474,15 @@ function try-load-docker-image { sleep 5 fi done + + if [[ -n "${KUBE_ADDON_REGISTRY:-}" ]]; then + # remove the prefix and suffix from the path to get the container name + container=${img##*/} + container=${container%.tar} + # find the right one for which we will need an additional tag + container=$(ctr -n k8s.io images ls | grep "k8s.gcr.io/${container}" | awk '{print $1}' | cut -f 2 -d '/') + ${tag_image_command} "k8s.gcr.io/${container}" "${KUBE_ADDON_REGISTRY}/${container}" + fi # Re-enable errexit. set -e }