Merge pull request #49486 from wojtek-t/fix_ha_master

Automatic merge from submit-queue (batch tested with PRs 45345, 49470, 49407, 49448, 49486)

Fix ha-master tests
This commit is contained in:
Kubernetes Submit Queue 2017-07-24 07:40:59 -07:00 committed by GitHub
commit b4941d018d
2 changed files with 14 additions and 20 deletions

View File

@ -2035,8 +2035,7 @@ function test-setup() {
detect-project detect-project
if [[ ${MULTIZONE:-} == "true" && -n ${E2E_ZONES:-} ]]; then if [[ ${MULTIZONE:-} == "true" && -n ${E2E_ZONES:-} ]]; then
for KUBE_GCE_ZONE in ${E2E_ZONES} for KUBE_GCE_ZONE in ${E2E_ZONES}; do
do
KUBE_GCE_ZONE="${KUBE_GCE_ZONE}" KUBE_USE_EXISTING_MASTER="${KUBE_USE_EXISTING_MASTER:-}" "${KUBE_ROOT}/cluster/kube-up.sh" KUBE_GCE_ZONE="${KUBE_GCE_ZONE}" KUBE_USE_EXISTING_MASTER="${KUBE_USE_EXISTING_MASTER:-}" "${KUBE_ROOT}/cluster/kube-up.sh"
KUBE_USE_EXISTING_MASTER="true" # For subsequent zones we use the existing master KUBE_USE_EXISTING_MASTER="true" # For subsequent zones we use the existing master
done done
@ -2092,15 +2091,14 @@ function test-teardown() {
"${NODE_TAG}-${INSTANCE_PREFIX}-http-alt" \ "${NODE_TAG}-${INSTANCE_PREFIX}-http-alt" \
"${NODE_TAG}-${INSTANCE_PREFIX}-nodeports" "${NODE_TAG}-${INSTANCE_PREFIX}-nodeports"
if [[ ${MULTIZONE:-} == "true" && -n ${E2E_ZONES:-} ]]; then if [[ ${MULTIZONE:-} == "true" && -n ${E2E_ZONES:-} ]]; then
local zones=( ${E2E_ZONES} ) local zones=( ${E2E_ZONES} )
# tear them down in reverse order, finally tearing down the master too. # tear them down in reverse order, finally tearing down the master too.
for ((zone_num=${#zones[@]}-1; zone_num>0; zone_num--)) for ((zone_num=${#zones[@]}-1; zone_num>0; zone_num--)); do
do KUBE_GCE_ZONE="${zones[zone_num]}" KUBE_USE_EXISTING_MASTER="true" "${KUBE_ROOT}/cluster/kube-down.sh"
KUBE_GCE_ZONE="${zones[zone_num]}" KUBE_USE_EXISTING_MASTER="true" "${KUBE_ROOT}/cluster/kube-down.sh" done
done KUBE_GCE_ZONE="${zones[0]}" KUBE_USE_EXISTING_MASTER="false" "${KUBE_ROOT}/cluster/kube-down.sh"
KUBE_GCE_ZONE="${zones[0]}" KUBE_USE_EXISTING_MASTER="false" "${KUBE_ROOT}/cluster/kube-down.sh"
else else
"${KUBE_ROOT}/cluster/kube-down.sh" "${KUBE_ROOT}/cluster/kube-down.sh"
fi fi
} }

View File

@ -32,8 +32,7 @@ import (
func addMasterReplica(zone string) error { func addMasterReplica(zone string) error {
framework.Logf(fmt.Sprintf("Adding a new master replica, zone: %s", zone)) framework.Logf(fmt.Sprintf("Adding a new master replica, zone: %s", zone))
v, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-grow-cluster.sh"), zone, "true", "true", "false") _, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-grow-cluster.sh"), zone, "true", "true", "false")
framework.Logf("%s", v)
if err != nil { if err != nil {
return err return err
} }
@ -42,8 +41,7 @@ func addMasterReplica(zone string) error {
func removeMasterReplica(zone string) error { func removeMasterReplica(zone string) error {
framework.Logf(fmt.Sprintf("Removing an existing master replica, zone: %s", zone)) framework.Logf(fmt.Sprintf("Removing an existing master replica, zone: %s", zone))
v, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-shrink-cluster.sh"), zone, "true", "false", "false") _, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-shrink-cluster.sh"), zone, "true", "false", "false")
framework.Logf("%s", v)
if err != nil { if err != nil {
return err return err
} }
@ -52,8 +50,7 @@ func removeMasterReplica(zone string) error {
func addWorkerNodes(zone string) error { func addWorkerNodes(zone string) error {
framework.Logf(fmt.Sprintf("Adding worker nodes, zone: %s", zone)) framework.Logf(fmt.Sprintf("Adding worker nodes, zone: %s", zone))
v, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-grow-cluster.sh"), zone, "true", "false", "true") _, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-grow-cluster.sh"), zone, "true", "false", "true")
framework.Logf("%s", v)
if err != nil { if err != nil {
return err return err
} }
@ -62,8 +59,7 @@ func addWorkerNodes(zone string) error {
func removeWorkerNodes(zone string) error { func removeWorkerNodes(zone string) error {
framework.Logf(fmt.Sprintf("Removing worker nodes, zone: %s", zone)) framework.Logf(fmt.Sprintf("Removing worker nodes, zone: %s", zone))
v, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-shrink-cluster.sh"), zone, "true", "true", "true") _, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-shrink-cluster.sh"), zone, "true", "true", "true")
framework.Logf("%s", v)
if err != nil { if err != nil {
return err return err
} }
@ -82,7 +78,7 @@ func createNewRC(c clientset.Interface, ns string, name string) {
} }
func findRegionForZone(zone string) string { func findRegionForZone(zone string) string {
region, err := exec.Command("gcloud", "compute", "zones", "list", zone, "--quiet", "--format=[no-heading](region)").CombinedOutput() region, err := exec.Command("gcloud", "compute", "zones", "list", zone, "--quiet", "--format=csv[no-heading](region)").CombinedOutput()
framework.ExpectNoError(err) framework.ExpectNoError(err)
if string(region) == "" { if string(region) == "" {
framework.Failf("Region not found; zone: %s", zone) framework.Failf("Region not found; zone: %s", zone)
@ -92,7 +88,7 @@ func findRegionForZone(zone string) string {
func findZonesForRegion(region string) []string { func findZonesForRegion(region string) []string {
output, err := exec.Command("gcloud", "compute", "zones", "list", "--filter=region="+region, output, err := exec.Command("gcloud", "compute", "zones", "list", "--filter=region="+region,
"--quiet", "--format=[no-heading](name)").CombinedOutput() "--quiet", "--format=csv[no-heading](name)").CombinedOutput()
framework.ExpectNoError(err) framework.ExpectNoError(err)
zones := strings.Split(string(output), "\n") zones := strings.Split(string(output), "\n")
return zones return zones