Skip to content

Commit

Permalink
An option to allow upgrade script to test other cloud + fix helm issue (
Browse files Browse the repository at this point in the history
istio#11159)

* disable replicas when auto scaling is enabled

* add simple way to test other cloud

* add steps to install crds from istio-init

* clarify comment

* remove accidentally pushed files

* resolve merge conflict

* address Martin's comment

* comment out RUNNING in yaml file

* add missing helm dep update
  • Loading branch information
linsun authored and hklai committed Jan 24, 2019
1 parent fc03e9f commit c7eb603
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion prow/upgrade-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ go get fortio.org/fortio


# Kick off tests
"${ROOT}/tests/upgrade/test_crossgrade.sh" --from_hub="${HUB}" --from_tag="${SOURCE_VERSION}" --from_path="istio-${SOURCE_VERSION}" --to_hub="${HUB}" --to_tag="${TARGET_VERSION}" --to_path="istio-${TARGET_VERSION}"
"${ROOT}/tests/upgrade/test_crossgrade.sh" --from_hub="${HUB}" --from_tag="${SOURCE_VERSION}" --from_path="istio-${SOURCE_VERSION}" --to_hub="${HUB}" --to_tag="${TARGET_VERSION}" --to_path="istio-${TARGET_VERSION}" --cloud="GKE"

27 changes: 19 additions & 8 deletions tests/upgrade/test_crossgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ usage() {
echo " auth_enable enable mtls."
echo " skip_cleanup leave install intact after test completes."
echo " namespace namespace to install istio control plane in (default istio-system)."
echo " cloud cloud provider name (required)"
echo
echo " e.g. ./test_crossgrade.sh \"
echo " --from_hub=gcr.io/istio-testing --from_tag=d639408fd --from_path=/tmp/release-d639408fd \"
echo " --to_hub=gcr.io/istio-release --to_tag=1.0.2 --to_path=/tmp/istio-1.0.2"
echo " --to_hub=gcr.io/istio-release --to_tag=1.0.2 --to_path=/tmp/istio-1.0.2 --cloud=GKE"
echo
exit 1
}
Expand Down Expand Up @@ -80,6 +81,9 @@ while (( "$#" )); do
--to_path)
TO_PATH=${VALUE}
;;
--cloud)
CLOUD=${VALUE}
;;
*)
echo "ERROR: unknown parameter \"$PARAM\""
usage
Expand Down Expand Up @@ -111,9 +115,9 @@ TRAFFIC_RUNTIME_SEC=500
# Used to signal that background external process is done.
EXTERNAL_FORTIO_DONE_FILE=${TMP_DIR}/fortio_done_file

echo_and_run() { echo "RUNNING $*" ; "$@" ; }
echo_and_run_quiet() { echo "RUNNING(quiet) $*" ; "$@" > /dev/null 2>&1 ; }
echo_and_run_or_die() { echo "RUNNING $*" ; "$@" || die "failed!" ; }
echo_and_run() { echo "# RUNNING $*" ; "$@" ; }
echo_and_run_quiet() { echo "# RUNNING(quiet) $*" ; "$@" > /dev/null 2>&1 ; }
echo_and_run_or_die() { echo "# RUNNING $*" ; "$@" || die "failed!" ; }

# withRetries retries the given command ${1} times with ${2} sleep between retries
# e.g. withRetries 10 60 myFunc param1 param2
Expand Down Expand Up @@ -178,14 +182,17 @@ deleteWithWait() {
}

installIstioSystemAtVersionHelmTemplate() {
writeMsg "helm template installing version ${2} from ${3}."
writeMsg "helm templating then applying new yaml using version ${2} from ${3}."
if [ -n "${AUTH_ENABLE}" ]; then
echo "Auth is enabled, generating manifest with auth."
auth_opts="--set global.mtls.enabled=true --set global.controlPlaneSecurityEnabled=true "
fi
release_path="${3}"/install/kubernetes/helm/istio
if [[ "${release_path}" == *"1.1"* || "${release_path}" == *"master"* ]]; then
# See https://preliminary.istio.io/docs/setup/kubernetes/helm-install/
helm init --client-only
helm repo add istio.io https://storage.googleapis.com/istio-prerelease/daily-build/release-1.1-latest-daily/charts
helm dependency update "${release_path}"
for i in install/kubernetes/helm/istio-init/files/crd*yaml; do
echo_and_run kubectl apply -f "${i}"
done
Expand All @@ -194,7 +201,6 @@ installIstioSystemAtVersionHelmTemplate() {

helm template "${release_path}" "${auth_opts}" \
--name istio --namespace "${ISTIO_NAMESPACE}" \
--set gateways.istio-ingressgateway.replicaCount=4 \
--set gateways.istio-ingressgateway.autoscaleMin=4 \
--set prometheus.enabled=false \
--set global.hub="${1}" \
Expand Down Expand Up @@ -372,8 +378,13 @@ copy_test_files() {

copy_test_files

# This should already be done, repeat just in case.
echo_and_run_quiet kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user="$(gcloud config get-value core/account)"
# create cluster admin role binding
user="cluster-admin"
if [[ $CLOUD == "GKE" ]];then
user="$(gcloud config get-value core/account)"
fi
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user="${user}" || echo "clusterrolebinding already created."


echo_and_run pushd "${ISTIO_ROOT}"

Expand Down

0 comments on commit c7eb603

Please sign in to comment.