From 984ecbe1d1d42cb16e2f59cc3e1fde3bc8e0c2b5 Mon Sep 17 00:00:00 2001 From: Kevin Wiesmueller Date: Wed, 14 Apr 2021 14:48:22 +0200 Subject: [PATCH 1/2] support deloying with tags instead of shas Signed-off-by: Kevin Wiesmueller --- Makefile | 2 +- hack/cluster-build.sh | 2 +- hack/parse-shasums.sh | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 39ab7d0ed10a..41b2063dec07 100644 --- a/Makefile +++ b/Makefile @@ -114,7 +114,7 @@ build-verify: manifests: hack/dockerized "CSV_VERSION=${CSV_VERSION} QUAY_REPOSITORY=${QUAY_REPOSITORY} \ - DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} \ + DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} KUBEVIRT_ONLY_USE_TAGS=${KUBEVIRT_ONLY_USE_TAGS} \ IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} PACKAGE_NAME=${PACKAGE_NAME} \ KUBEVIRT_INSTALLED_NAMESPACE=${KUBEVIRT_INSTALLED_NAMESPACE} ./hack/build-manifests.sh" diff --git a/hack/cluster-build.sh b/hack/cluster-build.sh index 7aebb0250742..02646d44bc59 100755 --- a/hack/cluster-build.sh +++ b/hack/cluster-build.sh @@ -36,7 +36,7 @@ echo "Building ..." # Build everyting and publish it ${KUBEVIRT_PATH}hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} ./hack/build-func-tests.sh" ${KUBEVIRT_PATH}hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} DOCKER_TAG_ALT=${DOCKER_TAG_ALT} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} IMAGE_PREFIX=${IMAGE_PREFIX} IMAGE_PREFIX_ALT=${IMAGE_PREFIX_ALT} ./hack/bazel-push-images.sh" -${KUBEVIRT_PATH}hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} IMAGE_PREFIX=${IMAGE_PREFIX} IMAGE_PREFIX_ALT=${IMAGE_PREFIX_ALT} feature_gates=${FEATURE_GATES} ./hack/build-manifests.sh" +${KUBEVIRT_PATH}hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} IMAGE_PREFIX=${IMAGE_PREFIX} IMAGE_PREFIX_ALT=${IMAGE_PREFIX_ALT} feature_gates=${FEATURE_GATES} KUBEVIRT_ONLY_USE_TAGS=${KUBEVIRT_ONLY_USE_TAGS} ./hack/build-manifests.sh" # Make sure that all nodes use the newest images container="" diff --git a/hack/parse-shasums.sh b/hack/parse-shasums.sh index c53c7484830b..42bd722b3a88 100755 --- a/hack/parse-shasums.sh +++ b/hack/parse-shasums.sh @@ -24,6 +24,11 @@ if [[ ! -f "${KUBEVIRT_DIR}/bazel-bin/push-virt-operator.digest" ]]; then return fi +if [[ ${KUBEVIRT_ONLY_USE_TAGS} == "true" ]]; then + echo "found KUBEVIRT_ONLY_USE_TAGS; using tags instead of shasums" + return +fi + # bazel push images creates digest files in bazel-bin/push-.digest VIRT_OPERATOR_SHA=$(cat ${KUBEVIRT_DIR}/bazel-bin/push-virt-operator.digest) From e24d82817d42b3644be365aeeea4597567ca776b Mon Sep 17 00:00:00 2001 From: Kevin Wiesmueller Date: Tue, 18 May 2021 20:20:38 +0200 Subject: [PATCH 2/2] explain tag based pulls in README.md Signed-off-by: Kevin Wiesmueller --- docs/getting-started.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/getting-started.md b/docs/getting-started.md index 19b2f6679c9a..cd8a353c4c32 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -119,6 +119,29 @@ make cluster-down **Note:** Whenever you type `make cluster-down && make cluster-up`, you will have a completely fresh cluster to play with. +#### Sync specific components + +**Note:** The following is meant for allowing faster iteration on small changes to components that support it. +Not every component is that simply exchangable without a full re-deploy. Always test with the final SHA based method in the end. + +In situations where you just want to work on a single component and rollout updates +without re-deploying the whole environment, you can tell kubevirt to deploy using tags. + +```sh +export KUBEVIRT_ONLY_USE_TAGS=true +``` + +After this any `make cluster-sync` will use the `DOCKER_TAG` for pulling images instead of SHAs. +This means you can simply rebuild the component that changed and then kill the respective pods to +cause a fresh pull: + +```sh +PUSH_TARGETS='virt-api' ./hack/bazel-push-images.sh +kubectl delete po -n kubevirt -l kubevirt.io=virt-api +``` + +Once the respective component is back, it should be using your new build. + ### Accessing the containerized nodes via ssh Based on the used cluster, node names might be different.