From 6b1c4df45bf3396e1557bcb38086b69891237aed Mon Sep 17 00:00:00 2001 From: Mike Kolesnik Date: Mon, 1 Mar 2021 14:55:35 +0200 Subject: [PATCH] Add `preload-images` target This target preloads all the necessary images for deploying the project in KIND Signed-off-by: Mike Kolesnik --- Makefile.inc | 18 ++++++++++++++++-- scripts/shared/deploy.sh | 8 -------- scripts/shared/lib/deploy_funcs | 1 + scripts/shared/lib/deploy_operator | 2 -- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Makefile.inc b/Makefile.inc index d79160031..cad161ccc 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -1,5 +1,6 @@ , := , _using = $(subst $(,), ,$(using)) +PRELOAD_IMAGES ?= submariner-gateway submariner-operator submariner-route-agent include $(SHIPYARD_DIR)/Makefile.images include $(SHIPYARD_DIR)/Makefile.versions @@ -19,6 +20,7 @@ ifneq (,$(filter globalnet,$(_using))) override CLUSTERS_ARGS += --globalnet override DEPLOY_ARGS += --globalnet override E2E_ARGS += --globalnet +PRELOAD_IMAGES += submariner-globalnet endif ifneq (,$(filter helm,$(_using))) @@ -33,6 +35,10 @@ ifneq (,$(filter prometheus,$(_using))) override CLUSTERS_ARGS += --prometheus endif +ifneq (,$(filter ovn,$(_using))) +PRELOAD_IMAGES += submariner-networkplugin-syncer +endif + # Shipyard provided targets cleanup: @@ -41,7 +47,15 @@ cleanup: clusters: $(SCRIPTS_DIR)/clusters.sh $(CLUSTERS_ARGS) -deploy: clusters +preload-images: + set -e;\ + . $(SCRIPTS_DIR)/lib/deploy_funcs;\ + . $(SCRIPTS_DIR)/lib/debug_functions;\ + for image in $(PRELOAD_IMAGES); do\ + import_image quay.io/submariner/$${image};\ + done + +deploy: clusters preload-images $(SCRIPTS_DIR)/deploy.sh $(DEPLOY_ARGS) # Will call `deploy` if it detects no submariner running on a cluster @@ -55,7 +69,7 @@ upgrade-e2e: deploy-latest deploy e2e # are *not* rebuilt (we want to deploy the published images only) deploy-latest: curl -L get.submariner.io | VERSION=latest bash - $(MAKE) -o images deploy SUBCTL=~/.local/bin/subctl DEV_VERSION=latest CUTTING_EDGE=latest VERSION=latest DEPLOY_ARGS="$(DEPLOY_ARGS) --image_tag=subctl" using=$(using) + $(MAKE) -o images -o preload-images deploy SUBCTL=~/.local/bin/subctl DEV_VERSION=latest CUTTING_EDGE=latest VERSION=latest DEPLOY_ARGS="$(DEPLOY_ARGS) --image_tag=subctl" using=$(using) gitlint: gitlint --commits origin/devel..HEAD diff --git a/scripts/shared/deploy.sh b/scripts/shared/deploy.sh index 2cb490af6..34400edea 100755 --- a/scripts/shared/deploy.sh +++ b/scripts/shared/deploy.sh @@ -45,14 +45,6 @@ declare_kubeconfig # Always get subctl since we're using moving versions, and having it in the image results in a stale cached one bash -c "curl -Ls https://get.submariner.io | VERSION=${CUTTING_EDGE} DESTDIR=/go/bin bash" -# nettest is always referred to using :local -import_image quay.io/submariner/nettest -import_image quay.io/submariner/submariner-operator ${image_tag} -import_image quay.io/submariner/submariner ${image_tag} -import_image quay.io/submariner/submariner-route-agent ${image_tag} -[[ $globalnet != "true" ]] || import_image quay.io/submariner/submariner-globalnet ${image_tag} -[[ "${cluster_cni[$cluster]}" != "ovn" ]] || import_image quay.io/submariner/submariner-networkplugin-syncer ${image_tag} - load_deploytool $deploytool deploytool_prereqs diff --git a/scripts/shared/lib/deploy_funcs b/scripts/shared/lib/deploy_funcs index 7b6cd5022..4833dbf9b 100644 --- a/scripts/shared/lib/deploy_funcs +++ b/scripts/shared/lib/deploy_funcs @@ -72,6 +72,7 @@ function test_connection() { function connectivity_tests() { target_cluster="$1" + import_image quay.io/submariner/nettest deploy_resource "${RESOURCES_DIR}/netshoot.yaml" with_context "$target_cluster" deploy_resource "${RESOURCES_DIR}/nginx-demo.yaml" diff --git a/scripts/shared/lib/deploy_operator b/scripts/shared/lib/deploy_operator index 100d30d64..c6fddfbc5 100644 --- a/scripts/shared/lib/deploy_operator +++ b/scripts/shared/lib/deploy_operator @@ -18,8 +18,6 @@ readonly SUBCTL=${SUBCTL:-subctl} function deploytool_prereqs() { command -v subctl > /dev/null 2>&1 "${SUBCTL}" version - # shellcheck disable=SC2086 # image_tag should expand to nothing if empty - import_image quay.io/submariner/submariner-operator ${image_tag} } function setup_broker() {