Sitelet https://github.com/kubernetes/kops/commit/327e9608331f2028ce495745783697e56d698c84
Skip to content

Commit 327e960

Browse files
committed
TEMP: strip --zones from --create-args to exercise random zones
Force every kubetest2-kops invocation through the randomized zone selection (and its instance-type availability filtering) regardless of what --create-args specifies. To be reverted once CI confirms the random-zone path is healthy.
1 parent 853f979 commit 327e960

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

‎tests/e2e/kubetest2-kops/deployer/common.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ func (d *deployer) initialize() error {
5151
}
5252
}
5353

54+
// TEMPORARY: drop any --zones flag from --create-args so that every
55+
// kubetest2-kops invocation goes through the randomized zone selection
56+
// (and its instance-type availability filtering). Revert once we have
57+
// confirmed CI is healthy with the random-zone path.
58+
if stripped := stripZonesFlag(d.CreateArgs); stripped != d.CreateArgs {
59+
klog.Infof("dropping --zones flag from --create-args: %q -> %q", d.CreateArgs, stripped)
60+
d.CreateArgs = stripped
61+
}
62+
5463
var err error
5564
d.zones, err = d.getZones()
5665
if err != nil {

‎tests/e2e/kubetest2-kops/deployer/up.go‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,32 @@ func extractZones(args string) []string {
435435
return strings.Split(zonesValue, ",")
436436
}
437437

438+
// stripZonesFlag removes any "--zones=..." or "--zones ..." tokens from a
439+
// space-separated argument string. TEMPORARY: paired with the
440+
// d.CreateArgs rewrite in initialize() to force every kubetest2-kops
441+
// invocation through the randomized zone selection.
442+
func stripZonesFlag(args string) string {
443+
if args == "" {
444+
return args
445+
}
446+
fields := strings.Fields(args)
447+
out := make([]string, 0, len(fields))
448+
for i := 0; i < len(fields); i++ {
449+
f := fields[i]
450+
if f == "--zones" {
451+
if i+1 < len(fields) {
452+
i++
453+
}
454+
continue
455+
}
456+
if strings.HasPrefix(f, "--zones=") {
457+
continue
458+
}
459+
out = append(out, f)
460+
}
461+
return strings.Join(out, " ")
462+
}
463+
438464
func (d *deployer) getZones() ([]string, error) {
439465
if d.CreateArgs != "" {
440466
zones := extractZones(d.CreateArgs)

0 commit comments

Comments
 (0)