diff --git a/Makefile b/Makefile index 44b7dc405a3c0..fefad63965d41 100644 --- a/Makefile +++ b/Makefile @@ -266,7 +266,7 @@ gcs-publish-ci: gsutil version-dist-ci @echo "== Uploading kops ==" gsutil -h "Cache-Control:private, max-age=0, no-transform" -m cp -n -r ${UPLOAD}/kops/* ${GCS_LOCATION} echo "VERSION: ${VERSION}" - echo "${GCS_URL}/${VERSION}" > ${UPLOAD}/${LATEST_FILE} + echo "${GCS_URL}${VERSION}" > ${UPLOAD}/${LATEST_FILE} gsutil -h "Cache-Control:private, max-age=0, no-transform" cp ${UPLOAD}/${LATEST_FILE} ${GCS_LOCATION} .PHONY: gen-cli-docs diff --git a/tests/e2e/kubetest2-kops/deployer/common.go b/tests/e2e/kubetest2-kops/deployer/common.go index 5135b53a6b78b..041fa8ad4ff52 100644 --- a/tests/e2e/kubetest2-kops/deployer/common.go +++ b/tests/e2e/kubetest2-kops/deployer/common.go @@ -20,14 +20,12 @@ import ( "errors" "fmt" "os" - "path" "path/filepath" "strings" "time" "k8s.io/klog/v2" "k8s.io/kops/tests/e2e/kubetest2-kops/gce" - "k8s.io/kops/tests/e2e/pkg/kops" "k8s.io/kops/tests/e2e/pkg/target" "k8s.io/kops/tests/e2e/pkg/util" "sigs.k8s.io/kubetest2/pkg/boskos" @@ -51,14 +49,6 @@ func (d *deployer) initialize() error { return fmt.Errorf("init failed to check up flags: %v", err) } } - if d.KopsVersionMarker != "" { - d.KopsBinaryPath = path.Join(d.commonOptions.RunDir(), "kops") - baseURL, err := kops.DownloadKops(d.KopsVersionMarker, d.KopsBinaryPath) - if err != nil { - return fmt.Errorf("init failed to download kops from url: %v", err) - } - d.KopsBaseURL = baseURL - } switch d.CloudProvider { case "aws": diff --git a/tests/e2e/kubetest2-kops/deployer/up.go b/tests/e2e/kubetest2-kops/deployer/up.go index 604060e4d7a04..e5aeb3d4d6785 100644 --- a/tests/e2e/kubetest2-kops/deployer/up.go +++ b/tests/e2e/kubetest2-kops/deployer/up.go @@ -20,6 +20,7 @@ import ( "errors" "fmt" osexec "os/exec" + "path" "strings" "time" @@ -41,6 +42,17 @@ func (d *deployer) Up() error { return err } + // kops is fetched when --up is called instead of init to support a scenario where k/k is being built + // and a kops build is not ready yet + if d.KopsVersionMarker != "" { + d.KopsBinaryPath = path.Join(d.commonOptions.RunDir(), "kops") + baseURL, err := kops.DownloadKops(d.KopsVersionMarker, d.KopsBinaryPath) + if err != nil { + return fmt.Errorf("init failed to download kops from url: %v", err) + } + d.KopsBaseURL = baseURL + } + if d.terraform == nil { klog.Info("Cleaning up any leaked resources from previous cluster") // Intentionally ignore errors: @@ -118,6 +130,7 @@ func (d *deployer) createCluster(zones []string, adminAccess string, yes bool) e "--kubernetes-version", d.KubernetesVersion, "--ssh-public-key", d.SSHPublicKeyPath, "--set", "cluster.spec.nodePortAccess=0.0.0.0/0", + "--set", `spec.containerd.configAdditions="plugins.""io.containerd.grpc.v1.cri"".containerd.runtimes.test-handler.runtime_type=""io.containerd.runc.v2"""`, } if yes { args = append(args, "--yes") diff --git a/tests/e2e/pkg/kops/state.go b/tests/e2e/pkg/kops/state.go index e5b14fb115ebe..5b799f7e2af79 100644 --- a/tests/e2e/pkg/kops/state.go +++ b/tests/e2e/pkg/kops/state.go @@ -25,6 +25,7 @@ import ( "k8s.io/klog/v2" api "k8s.io/kops/pkg/apis/kops/v1alpha2" + "k8s.io/kops/pkg/cloudinstances" "sigs.k8s.io/kubetest2/pkg/exec" ) @@ -61,6 +62,28 @@ func GetCluster(kopsBinary, clusterName string, env []string) (*api.Cluster, err return cluster, nil } +// GetCluster will retrieve the specified Cluster from the state store. +func GetInstances(kopsBinary, clusterName string, env []string) ([]*cloudinstances.CloudInstance, error) { + args := []string{ + kopsBinary, "get", "instances", "--name", clusterName, "-ojson", + } + c := exec.Command(args[0], args[1:]...) + c.SetEnv(env...) + var stdout bytes.Buffer + c.SetStdout(&stdout) + var stderr bytes.Buffer + c.SetStderr(&stderr) + if err := c.Run(); err != nil { + klog.Warningf("failed to run %s; stderr=%s", strings.Join(args, " "), stderr.String()) + return nil, fmt.Errorf("error querying instances from %s: %w", strings.Join(args, " "), err) + } + var instances []*cloudinstances.CloudInstance + if err := json.Unmarshal(stdout.Bytes(), &instances); err != nil { + return nil, fmt.Errorf("error parsing instance groups json: %w", err) + } + return instances, nil +} + // GetInstanceGroups will retrieve the instance groups for the specified Cluster from the state store. func GetInstanceGroups(kopsBinary, clusterName string, env []string) ([]*api.InstanceGroup, error) { args := []string{