From 0ac86d13e3b43ab9441fb6d594a35b5024da9611 Mon Sep 17 00:00:00 2001 From: Peter Rifel Date: Fri, 1 Jan 2021 01:08:33 -0600 Subject: [PATCH] Support a --kubernetes-version flag that is passed to `kops create cluster` --- Makefile | 1 + tests/e2e/kubetest2-kops/deployer/common.go | 5 +++++ tests/e2e/kubetest2-kops/deployer/deployer.go | 2 ++ tests/e2e/kubetest2-kops/deployer/up.go | 2 ++ 4 files changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 8d3bd229d7..a88492eb84 100644 --- a/Makefile +++ b/Makefile @@ -197,6 +197,7 @@ test-e2e: --build --up --down \ --cloud-provider=aws \ --kops-binary-path=/home/prow/go/src/k8s.io/kops/bazel-bin/cmd/kops/linux-amd64/kops \ + --kubernetes-version=v1.19.4 \ --test=ginkgo \ -- \ --test-package-version=v1.19.4 \ diff --git a/tests/e2e/kubetest2-kops/deployer/common.go b/tests/e2e/kubetest2-kops/deployer/common.go index fa49308800..1a29bb61b7 100644 --- a/tests/e2e/kubetest2-kops/deployer/common.go +++ b/tests/e2e/kubetest2-kops/deployer/common.go @@ -50,6 +50,11 @@ func (d *deployer) initialize() error { return fmt.Errorf("init failed to check up flags: %v", err) } } + if d.commonOptions.ShouldUp() || d.commonOptions.ShouldTest() { + if d.KubernetesVersion == "" { + return errors.New("missing required --kubernetes-version flag") + } + } return nil } diff --git a/tests/e2e/kubetest2-kops/deployer/deployer.go b/tests/e2e/kubetest2-kops/deployer/deployer.go index 416a1ff2bc..5dfd4fdafa 100644 --- a/tests/e2e/kubetest2-kops/deployer/deployer.go +++ b/tests/e2e/kubetest2-kops/deployer/deployer.go @@ -47,6 +47,8 @@ type deployer struct { KopsBinaryPath string `flag:"kops-binary-path" desc:"The path to kops executable used for testing"` StateStore string `flag:"-"` + KubernetesVersion string `flag:"kubernetes-version" desc:"The kubernetes version to use in the cluster"` + SSHPrivateKeyPath string `flag:"ssh-private-key" desc:"The path to the private key used for SSH access to instances"` SSHPublicKeyPath string `flag:"ssh-public-key" desc:"The path to the public key passed to the cloud provider"` SSHUser []string `flag:"ssh-user" desc:"The SSH users to use for SSH access to instances"` diff --git a/tests/e2e/kubetest2-kops/deployer/up.go b/tests/e2e/kubetest2-kops/deployer/up.go index 28798ec825..33cf1145c7 100644 --- a/tests/e2e/kubetest2-kops/deployer/up.go +++ b/tests/e2e/kubetest2-kops/deployer/up.go @@ -47,6 +47,7 @@ func (d *deployer) Up() error { "--name", d.ClusterName, "--admin-access", publicIP, "--cloud", d.CloudProvider, + "--kubernetes-version", d.KubernetesVersion, "--master-count", "1", "--master-size", "c5.large", "--master-volume-size", "48", @@ -57,6 +58,7 @@ func (d *deployer) Up() error { "--zones", strings.Join(zones, ","), "--yes", } + klog.Info(strings.Join(args, " ")) cmd := exec.Command(args[0], args[1:]...) cmd.SetEnv(d.env()...)