mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
e2e.go / kops: Add --kops-kubernetes-version
This adds a flag to override the version we're deploying with kops for e2es. (The kops experience is disconnected from the actual source tree we're running tests from, which is similar to GKE.)
This commit is contained in:
parent
d26b4ca285
commit
ca58119af7
14
hack/e2e.go
14
hack/e2e.go
@ -56,6 +56,7 @@ var (
|
||||
kopsCluster = flag.String("kops-cluster", "", "(kops only) Cluster name. Must be set for kops.")
|
||||
kopsState = flag.String("kops-state", os.Getenv("KOPS_STATE_STORE"), "(kops only) s3:// path to kops state store. Must be set. (This flag defaults to $KOPS_STATE_STORE, and overrides it if set.)")
|
||||
kopsSSHKey = flag.String("kops-ssh-key", os.Getenv("AWS_SSH_KEY"), "(kops only) Path to ssh key-pair for each node. (Defaults to $AWS_SSH_KEY or '~/.ssh/kube_aws_rsa'.)")
|
||||
kopsKubeVersion = flag.String("kops-kubernetes-version", "", "(kops only) If set, the version of Kubernetes to deploy (can be a URL to a GCS path where the release is stored) (Defaults to kops default, latest stable release.).")
|
||||
kopsZones = flag.String("kops-zones", "us-west-2a", "(kops AWS only) AWS zones for kops deployment, comma delimited.")
|
||||
kopsNodes = flag.Int("kops-nodes", 2, "(kops only) Number of nodes to create.")
|
||||
|
||||
@ -393,6 +394,7 @@ func (b bash) Down() error {
|
||||
|
||||
type kops struct {
|
||||
path string
|
||||
kubeVersion string
|
||||
sshKey string
|
||||
zones []string
|
||||
nodes int
|
||||
@ -454,6 +456,7 @@ func NewKops() (*kops, error) {
|
||||
}
|
||||
return &kops{
|
||||
path: *kopsPath,
|
||||
kubeVersion: *kopsKubeVersion,
|
||||
sshKey: sshKey + ".pub", // kops only needs the public key, e2es need the private key.
|
||||
zones: zones,
|
||||
nodes: *kopsNodes,
|
||||
@ -463,12 +466,17 @@ func NewKops() (*kops, error) {
|
||||
}
|
||||
|
||||
func (k kops) Up() error {
|
||||
if err := finishRunning("kops config", exec.Command(
|
||||
k.path, "create", "cluster",
|
||||
createArgs := []string{
|
||||
"create", "cluster",
|
||||
"--name", k.cluster,
|
||||
"--ssh-public-key", k.sshKey,
|
||||
"--node-count", strconv.Itoa(k.nodes),
|
||||
"--zones", strings.Join(k.zones, ","))); err != nil {
|
||||
"--zones", strings.Join(k.zones, ","),
|
||||
}
|
||||
if k.kubeVersion != "" {
|
||||
createArgs = append(createArgs, "--kubernetes-version", k.kubeVersion)
|
||||
}
|
||||
if err := finishRunning("kops config", exec.Command(k.path, createArgs...)); err != nil {
|
||||
return fmt.Errorf("kops configuration failed: %v", err)
|
||||
}
|
||||
if err := finishRunning("kops update", exec.Command(k.path, "update", "cluster", k.cluster, "--yes")); err != nil {
|
||||
|
@ -275,6 +275,7 @@ k8s-build-output
|
||||
keep-gogoproto
|
||||
km-path
|
||||
kops-cluster
|
||||
kops-kubernetes-version
|
||||
kops-nodes
|
||||
kops-ssh-key
|
||||
kops-state
|
||||
|
Loading…
Reference in New Issue
Block a user