mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
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:
commit
b4941d018d
@ -2035,8 +2035,7 @@ function test-setup() {
|
||||
detect-project
|
||||
|
||||
if [[ ${MULTIZONE:-} == "true" && -n ${E2E_ZONES:-} ]]; then
|
||||
for KUBE_GCE_ZONE in ${E2E_ZONES}
|
||||
do
|
||||
for KUBE_GCE_ZONE in ${E2E_ZONES}; do
|
||||
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
|
||||
done
|
||||
@ -2092,15 +2091,14 @@ function test-teardown() {
|
||||
"${NODE_TAG}-${INSTANCE_PREFIX}-http-alt" \
|
||||
"${NODE_TAG}-${INSTANCE_PREFIX}-nodeports"
|
||||
if [[ ${MULTIZONE:-} == "true" && -n ${E2E_ZONES:-} ]]; then
|
||||
local zones=( ${E2E_ZONES} )
|
||||
# tear them down in reverse order, finally tearing down the master too.
|
||||
for ((zone_num=${#zones[@]}-1; zone_num>0; zone_num--))
|
||||
do
|
||||
KUBE_GCE_ZONE="${zones[zone_num]}" KUBE_USE_EXISTING_MASTER="true" "${KUBE_ROOT}/cluster/kube-down.sh"
|
||||
done
|
||||
KUBE_GCE_ZONE="${zones[0]}" KUBE_USE_EXISTING_MASTER="false" "${KUBE_ROOT}/cluster/kube-down.sh"
|
||||
local zones=( ${E2E_ZONES} )
|
||||
# tear them down in reverse order, finally tearing down the master too.
|
||||
for ((zone_num=${#zones[@]}-1; zone_num>0; zone_num--)); do
|
||||
KUBE_GCE_ZONE="${zones[zone_num]}" KUBE_USE_EXISTING_MASTER="true" "${KUBE_ROOT}/cluster/kube-down.sh"
|
||||
done
|
||||
KUBE_GCE_ZONE="${zones[0]}" KUBE_USE_EXISTING_MASTER="false" "${KUBE_ROOT}/cluster/kube-down.sh"
|
||||
else
|
||||
"${KUBE_ROOT}/cluster/kube-down.sh"
|
||||
"${KUBE_ROOT}/cluster/kube-down.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,7 @@ import (
|
||||
|
||||
func addMasterReplica(zone string) error {
|
||||
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")
|
||||
framework.Logf("%s", v)
|
||||
_, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-grow-cluster.sh"), zone, "true", "true", "false")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -42,8 +41,7 @@ func addMasterReplica(zone string) error {
|
||||
|
||||
func removeMasterReplica(zone string) error {
|
||||
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")
|
||||
framework.Logf("%s", v)
|
||||
_, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-shrink-cluster.sh"), zone, "true", "false", "false")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -52,8 +50,7 @@ func removeMasterReplica(zone string) error {
|
||||
|
||||
func addWorkerNodes(zone string) error {
|
||||
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")
|
||||
framework.Logf("%s", v)
|
||||
_, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-grow-cluster.sh"), zone, "true", "false", "true")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -62,8 +59,7 @@ func addWorkerNodes(zone string) error {
|
||||
|
||||
func removeWorkerNodes(zone string) error {
|
||||
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")
|
||||
framework.Logf("%s", v)
|
||||
_, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-shrink-cluster.sh"), zone, "true", "true", "true")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -82,7 +78,7 @@ func createNewRC(c clientset.Interface, ns string, name 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)
|
||||
if string(region) == "" {
|
||||
framework.Failf("Region not found; zone: %s", zone)
|
||||
@ -92,7 +88,7 @@ func findRegionForZone(zone string) string {
|
||||
|
||||
func findZonesForRegion(region string) []string {
|
||||
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)
|
||||
zones := strings.Split(string(output), "\n")
|
||||
return zones
|
||||
|
Loading…
Reference in New Issue
Block a user