Setup e2e_node to support testing on ARM64

* Enable dockerized build with --use-dockerized-build=true
* Build and create test artifacts for ARM64 with --target-build-arch=arm64
* Prepull multi-arch ready container image
* Download ARM64 binaries/packages if running on ARM64 machine
This commit is contained in:
Ike Ma
2023-03-30 17:01:38 +00:00
parent 6d09ab86c2
commit e21cf9a54e
7 changed files with 57 additions and 9 deletions

View File

@@ -21,16 +21,16 @@ import (
"path/filepath"
"k8s.io/klog/v2"
"k8s.io/kubernetes/test/e2e_node/builder"
)
// utils.go contains functions used across test suites.
const (
cniVersion = "v1.2.0"
cniArch = "amd64"
cniDirectory = "cni/bin" // The CNI tarball places binaries under directory under "cni/bin".
cniConfDirectory = "cni/net.d"
cniURL = "https://storage.googleapis.com/k8s-artifacts-cni/release/" + cniVersion + "/" + "cni-plugins-linux-" + cniArch + "-" + cniVersion + ".tgz"
)
const cniConfig = `{
@@ -60,14 +60,25 @@ providers:
- "*.pkg.dev"
defaultCacheDuration: 1m`
func getCNIURL() string {
cniArch := "amd64"
if builder.IsTargetArchArm64() {
cniArch = "arm64"
}
cniURL := fmt.Sprintf("https://storage.googleapis.com/k8s-artifacts-cni/release/%s/cni-plugins-linux-%s-%s.tgz", cniVersion, cniArch, cniVersion)
return cniURL
}
// Install the cni plugin and add basic bridge configuration to the
// configuration directory.
func setupCNI(host, workspace string) error {
klog.V(2).Infof("Install CNI on %q", host)
cniPath := filepath.Join(workspace, cniDirectory)
klog.V(2).Infof("Install CNI on path %q", cniPath)
cmd := getSSHCommand(" ; ",
fmt.Sprintf("mkdir -p %s", cniPath),
fmt.Sprintf("curl -s -L %s | tar -xz -C %s", cniURL, cniPath),
fmt.Sprintf("curl -s -L %s | tar -xz -C %s", getCNIURL(), cniPath),
)
if output, err := SSH(host, "sh", "-c", cmd); err != nil {
return fmt.Errorf("failed to install cni plugin on %q: %v output: %q", host, err, output)