diff --git a/scripts/pre-commit.sh b/scripts/pre-commit.sh index 24a6801a7d..86b01a2f26 100755 --- a/scripts/pre-commit.sh +++ b/scripts/pre-commit.sh @@ -39,7 +39,6 @@ E2E_TEST_CMD="${TEMP_DIR}/e2e-${PLATFORM} ${COMMON_TEST_ARGS}" IN_MEMORY_E2E_TEST_CMD="go test -v -timeout 900s -race ./test/e2e -args ${COMMON_TEST_ARGS} -in-memory-controllers=true -limited-scope-in-memory-controllers=false" KUBEFED_UPGRADE_TEST_NS="upgrade-test" -KUBEFED_UPGRADE_TEST_VERSION="v0.5.0" function build-binaries() { ${MAKE_CMD} hyperfed @@ -73,15 +72,33 @@ function run-e2e-upgrade-test() { echo "Adding a repo to install an older kubefed version" helm repo add kubefed-charts https://raw.githubusercontent.com/kubernetes-sigs/kubefed/master/charts + helm repo update - echo "Installing an older kubefed version ${KUBEFED_UPGRADE_TEST_VERSION}" - helm install kubefed kubefed-charts/kubefed --namespace ${KUBEFED_UPGRADE_TEST_NS} --version=${KUBEFED_UPGRADE_TEST_VERSION} --create-namespace + # Get the previous version prior to our latest stable version + KUBEFED_UPGRADE_TEST_VERSION=$(helm search repo kubefed-charts/kubefed --versions | awk '{print $2}' | head -3 | tail -1) - deployment-image-as-expected "${KUBEFED_UPGRADE_TEST_NS}" kubefed-admission-webhook admission-webhook "quay.io/kubernetes-multicluster/kubefed:${KUBEFED_UPGRADE_TEST_VERSION}" - deployment-image-as-expected "${KUBEFED_UPGRADE_TEST_NS}" kubefed-controller-manager controller-manager "quay.io/kubernetes-multicluster/kubefed:${KUBEFED_UPGRADE_TEST_VERSION}" + echo "Installing an older kubefed version v${KUBEFED_UPGRADE_TEST_VERSION}" + helm install kubefed kubefed-charts/kubefed --namespace ${KUBEFED_UPGRADE_TEST_NS} --version=v${KUBEFED_UPGRADE_TEST_VERSION} --create-namespace + + deployment-image-as-expected "${KUBEFED_UPGRADE_TEST_NS}" kubefed-admission-webhook admission-webhook "quay.io/kubernetes-multicluster/kubefed:v${KUBEFED_UPGRADE_TEST_VERSION}" + deployment-image-as-expected "${KUBEFED_UPGRADE_TEST_NS}" kubefed-controller-manager controller-manager "quay.io/kubernetes-multicluster/kubefed:v${KUBEFED_UPGRADE_TEST_VERSION}" echo "Upgrading kubefed to current version" - KUBEFED_NAMESPACE=$KUBEFED_UPGRADE_TEST_NS KIND_CLUSTER_NAME=${HOST_CLUSTER} KIND_LOAD_IMAGE=y ./scripts/deploy-kubefed.sh local/kubefed:e2e "${join_cluster_list[@]-}" + IMAGE_NAME="local/kubefed:e2e" + local repository=${IMAGE_NAME%/*} + local image_tag=${IMAGE_NAME##*/} + local image=${image_tag%:*} + local tag=${image_tag#*:} + + helm upgrade -i kubefed charts/kubefed --namespace ${KUBEFED_UPGRADE_TEST_NS} \ + --set controllermanager.controller.repository=${repo} \ + --set controllermanager.controller.image=${image} \ + --set controllermanager.controller.tag=${tag} \ + --set controllermanager.webhook.repository=${repo} \ + --set controllermanager.webhook.image=${image} \ + --set controllermanager.webhook.tag=${tag} \ + --set controllermanager.featureGates.CrossClusterServiceDiscovery=Enabled,controllermanager.featureGates.FederatedIngress=Enabled,controllermanager.featureGates.RawResourceStatusCollection=Enabled \ + --wait deployment-image-as-expected "${KUBEFED_UPGRADE_TEST_NS}" kubefed-admission-webhook admission-webhook "local/kubefed:e2e" deployment-image-as-expected "${KUBEFED_UPGRADE_TEST_NS}" kubefed-controller-manager controller-manager "local/kubefed:e2e"