From 36940bf66571004cf1d38e215d1d369cd30a5c7c Mon Sep 17 00:00:00 2001 From: Peter Rifel Date: Sun, 6 Aug 2023 08:57:03 -0500 Subject: [PATCH] E2E - Dont set --master-count if --control-plane-count is in --create-args Previously we were only not setting --master-count if --master-count was in --create-args. Now we recognize either flag. This fixes E2E jobs that specify --control-plane-count and kops create cluster ends up having both flags --- tests/e2e/kubetest2-kops/deployer/up.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/e2e/kubetest2-kops/deployer/up.go b/tests/e2e/kubetest2-kops/deployer/up.go index c19534984e..2accf227ae 100644 --- a/tests/e2e/kubetest2-kops/deployer/up.go +++ b/tests/e2e/kubetest2-kops/deployer/up.go @@ -134,7 +134,21 @@ func (d *deployer) createCluster(zones []string, adminAccess string, yes bool) e args = append(args, createArgs...) } args = appendIfUnset(args, "--admin-access", adminAccess) - args = appendIfUnset(args, "--master-count", fmt.Sprintf("%d", d.ControlPlaneCount)) + + // Dont set --master-count if either --control-plane-count or --master-count + // has been provided in --create-args + foundCPCount := false + for _, existingArg := range args { + existingKey := strings.Split(existingArg, "=") + if existingKey[0] == "--control-plane-count" || existingKey[0] == "--master-count" { + foundCPCount = true + break + } + } + if !foundCPCount { + args = appendIfUnset(args, "--master-count", fmt.Sprintf("%d", d.ControlPlaneCount)) + } + args = appendIfUnset(args, "--master-volume-size", "48") args = appendIfUnset(args, "--node-count", "4") args = appendIfUnset(args, "--node-volume-size", "48")