From 7ee7b55c5eed2b02344211709fcdfbc2a6222d59 Mon Sep 17 00:00:00 2001 From: Wojciech Tyczynski Date: Thu, 27 Oct 2016 19:27:02 +0200 Subject: [PATCH] Rename TEST_ETCD_VERSION to ETCD_VERSION --- cluster/common.sh | 4 ++-- cluster/gce/config-test.sh | 2 +- cluster/gce/configure-vm.sh | 4 ++-- cluster/gce/gci/configure-helper.sh | 4 ++-- cluster/gce/trusty/configure-helper.sh | 4 ++-- cluster/kubemark/config-default.sh | 2 +- test/kubemark/common.sh | 11 +++++++++++ test/kubemark/start-kubemark-master.sh | 10 +++++----- test/kubemark/start-kubemark.sh | 2 +- 9 files changed, 27 insertions(+), 16 deletions(-) diff --git a/cluster/common.sh b/cluster/common.sh index c4be510641..6708893908 100755 --- a/cluster/common.sh +++ b/cluster/common.sh @@ -702,9 +702,9 @@ NUM_NODES: $(yaml-quote ${NUM_NODES}) STORAGE_BACKEND: $(yaml-quote ${STORAGE_BACKEND:-}) ENABLE_GARBAGE_COLLECTOR: $(yaml-quote ${ENABLE_GARBAGE_COLLECTOR:-}) EOF - if [ -n "${TEST_ETCD_VERSION:-}" ]; then + if [ -n "${ETCD_VERSION:-}" ]; then cat >>$file <>/srv/salt-overlay/pillar/cluster-params.sls -etcd_docker_tag: '$(echo "$TEST_ETCD_VERSION" | sed -e "s/'/''/g")' +etcd_docker_tag: '$(echo "$ETCD_VERSION" | sed -e "s/'/''/g")' EOF fi if [ -n "${APISERVER_TEST_ARGS:-}" ]; then diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index e06b5e6183..1d5085877f 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -628,8 +628,8 @@ function prepare-etcd-manifest { sed -i -e "s@{{ *etcd_cluster *}}@$etcd_cluster@g" "${temp_file}" sed -i -e "s@{{ *storage_backend *}}@${STORAGE_BACKEND:-}@g" "${temp_file}" sed -i -e "s@{{ *cluster_state *}}@$cluster_state@g" "${temp_file}" - if [[ -n "${TEST_ETCD_VERSION:-}" ]]; then - sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@${TEST_ETCD_VERSION}@g" "${temp_file}" + if [[ -n "${ETCD_VERSION:-}" ]]; then + sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@${ETCD_VERSION}@g" "${temp_file}" else sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@\1@g" "${temp_file}" fi diff --git a/cluster/gce/trusty/configure-helper.sh b/cluster/gce/trusty/configure-helper.sh index 83db29243d..05e8cadec9 100644 --- a/cluster/gce/trusty/configure-helper.sh +++ b/cluster/gce/trusty/configure-helper.sh @@ -458,8 +458,8 @@ prepare_etcd_manifest() { sed -i -e "s@{{ *etcd_cluster *}}@$etcd_cluster@g" "${etcd_temp_file}" sed -i -e "s@{{ *storage_backend *}}@${STORAGE_BACKEND:-}@g" "${temp_file}" sed -i -e "s@{{ *cluster_state *}}@$cluster_state@g" "${etcd_temp_file}" - if [[ -n "${TEST_ETCD_VERSION:-}" ]]; then - sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@${TEST_ETCD_VERSION}@g" "${etcd_temp_file}" + if [[ -n "${ETCD_VERSION:-}" ]]; then + sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@${ETCD_VERSION}@g" "${etcd_temp_file}" else sed -i -e "s@{{ *pillar\.get('etcd_docker_tag', '\(.*\)') *}}@\1@g" "${etcd_temp_file}" fi diff --git a/cluster/kubemark/config-default.sh b/cluster/kubemark/config-default.sh index e0e78dc0a3..f38f1333f9 100644 --- a/cluster/kubemark/config-default.sh +++ b/cluster/kubemark/config-default.sh @@ -47,7 +47,7 @@ RUNTIME_CONFIG="${KUBE_RUNTIME_CONFIG:-}" TERMINATED_POD_GC_THRESHOLD=${TERMINATED_POD_GC_THRESHOLD:-100} # Set etcd version (e.g. 3.0.4-migration.1) if you need non-default version. -TEST_ETCD_VERSION="${TEST_ETCD_VERSION:-}" +ETCD_VERSION="${TEST_ETCD_VERSION:-}" # Storage backend. 'etcd2' supported, 'etcd3' experimental. STORAGE_BACKEND=${STORAGE_BACKEND:-etcd2} diff --git a/test/kubemark/common.sh b/test/kubemark/common.sh index ba522e354f..099cc504cd 100644 --- a/test/kubemark/common.sh +++ b/test/kubemark/common.sh @@ -17,7 +17,18 @@ source "${KUBE_ROOT}/cluster/kubemark/config-default.sh" source "${KUBE_ROOT}/cluster/kubemark/util.sh" source "${KUBE_ROOT}/cluster/lib/util.sh" + +# hack/lib/init.sh will ovewrite ETCD_VERSION if this is unset +# what what is default in hack/lib/etcd.sh +# To avoid it, if it is empty, we set it to 'avoid-overwrite' and +# clean it after that. +if [ -z "${ETCD_VERSION}" ]; then + ETCD_VERSION="avoid-overwrite" +fi source "${KUBE_ROOT}/hack/lib/init.sh" +if [ "${ETCD_VERSION}" == "avoid-overwrite" ]; then + ETCD_VERSION="" +fi detect-project &> /dev/null export PROJECT diff --git a/test/kubemark/start-kubemark-master.sh b/test/kubemark/start-kubemark-master.sh index 12ffb16a7e..96078cf039 100644 --- a/test/kubemark/start-kubemark-master.sh +++ b/test/kubemark/start-kubemark-master.sh @@ -19,10 +19,10 @@ EVENT_STORE_IP=$1 EVENT_STORE_URL="http://${EVENT_STORE_IP}:4002" NUM_NODES=$2 -TEST_ETCD_VERSION=$3 -if [[ -z "${TEST_ETCD_VERSION}" ]]; then +KUBEMARK_ETCD_VERSION=$3 +if [[ -z "${KUBEMARK_ETCD_VERSION}" ]]; then # Default etcd version. - TEST_ETCD_VERSION="2.2.1" + KUBEMARK_ETCD_VERSION="2.2.1" fi function retry() { @@ -80,7 +80,7 @@ if [ "${EVENT_STORE_IP}" == "127.0.0.1" ]; then # Retry starting etcd to avoid pulling image errors. retry sudo docker run --net=host \ -v /var/etcd/data-events:/var/etcd/data -v /var/log:/var/log -d \ - gcr.io/google_containers/etcd:${TEST_ETCD_VERSION} /bin/sh -c "/usr/local/bin/etcd \ + gcr.io/google_containers/etcd:${KUBEMARK_ETCD_VERSION} /bin/sh -c "/usr/local/bin/etcd \ --listen-peer-urls http://127.0.0.1:2381 \ --advertise-client-urls=http://127.0.0.1:4002 \ --listen-client-urls=http://0.0.0.0:4002 \ @@ -90,7 +90,7 @@ fi # Retry starting etcd to avoid pulling image errors. retry sudo docker run --net=host \ -v /var/etcd/data:/var/etcd/data -v /var/log:/var/log -d \ - gcr.io/google_containers/etcd:${TEST_ETCD_VERSION} /bin/sh -c "/usr/local/bin/etcd \ + gcr.io/google_containers/etcd:${KUBEMARK_ETCD_VERSION} /bin/sh -c "/usr/local/bin/etcd \ --listen-peer-urls http://127.0.0.1:2380 \ --advertise-client-urls=http://127.0.0.1:2379 \ --listen-client-urls=http://0.0.0.0:2379 \ diff --git a/test/kubemark/start-kubemark.sh b/test/kubemark/start-kubemark.sh index 046f714b72..48ce8c8dc9 100755 --- a/test/kubemark/start-kubemark.sh +++ b/test/kubemark/start-kubemark.sh @@ -148,7 +148,7 @@ gcloud compute copy-files --zone="${ZONE}" --project="${PROJECT}" \ gcloud compute ssh "${MASTER_NAME}" --zone="${ZONE}" --project="${PROJECT}" \ --command="chmod a+x configure-kubectl.sh && chmod a+x start-kubemark-master.sh && \ - sudo ./start-kubemark-master.sh ${EVENT_STORE_IP:-127.0.0.1} ${NUM_NODES:-0} ${TEST_ETCD_VERSION:-}" + sudo ./start-kubemark-master.sh ${EVENT_STORE_IP:-127.0.0.1} ${NUM_NODES:-0} ${ETCD_VERSION:-}" # create kubeconfig for Kubelet: KUBECONFIG_CONTENTS=$(echo "apiVersion: v1