Support a --kubernetes-version flag that is passed to `kops create cluster`

This commit is contained in:
Peter Rifel 2021-01-01 01:08:33 -06:00
parent 1c96e826d9
commit 0ac86d13e3
No known key found for this signature in database
GPG Key ID: BC6469E5B16DB2B6
4 changed files with 10 additions and 0 deletions

View File

@ -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 \

View File

@ -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
}

View File

@ -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"`

View File

@ -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()...)