diff --git a/test/e2e/framework/skipper/skipper.go b/test/e2e/framework/skipper/skipper.go index 01c99f908ae..ff0dec92f77 100644 --- a/test/e2e/framework/skipper/skipper.go +++ b/test/e2e/framework/skipper/skipper.go @@ -213,6 +213,13 @@ func SkipUnlessNodeOSDistroIs(supportedNodeOsDistros ...string) { } } +// SkipUnlessNodeOSArchIs skips if the node OS distro is not included in the supportedNodeOsArchs. +func SkipUnlessNodeOSArchIs(supportedNodeOsArchs ...string) { + if !framework.NodeOSArchIs(supportedNodeOsArchs...) { + skipInternalf(1, "Only supported for node OS arch %v (not %s)", supportedNodeOsArchs, framework.TestContext.NodeOSArch) + } +} + // SkipIfNodeOSDistroIs skips if the node OS distro is included in the unsupportedNodeOsDistros. func SkipIfNodeOSDistroIs(unsupportedNodeOsDistros ...string) { if framework.NodeOSDistroIs(unsupportedNodeOsDistros...) { diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index ddca9d4cc11..b0a8a9f97ab 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -116,6 +116,7 @@ type TestContextType struct { ImageServiceEndpoint string MasterOSDistro string NodeOSDistro string + NodeOSArch string VerifyServiceAccount bool DeleteNamespace bool DeleteNamespaceOnFailure bool @@ -324,6 +325,7 @@ func RegisterClusterFlags(flags *flag.FlagSet) { flags.StringVar(&TestContext.Prefix, "prefix", "e2e", "A prefix to be added to cloud resources created during testing.") flags.StringVar(&TestContext.MasterOSDistro, "master-os-distro", "debian", "The OS distribution of cluster master (debian, ubuntu, gci, coreos, or custom).") flags.StringVar(&TestContext.NodeOSDistro, "node-os-distro", "debian", "The OS distribution of cluster VM instances (debian, ubuntu, gci, coreos, or custom).") + flags.StringVar(&TestContext.NodeOSArch, "node-os-arch", "amd64", "The OS architecture of cluster VM instances (amd64, arm64, or custom).") flags.StringVar(&TestContext.ClusterDNSDomain, "dns-domain", "cluster.local", "The DNS Domain of the cluster.") // TODO: Flags per provider? Rename gce-project/gce-zone? diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index 1a777315063..2f8376d8e07 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -203,6 +203,16 @@ func NodeOSDistroIs(supportedNodeOsDistros ...string) bool { return false } +// NodeOSArchIs returns true if the node OS arch is included in the supportedNodeOsArchs. Otherwise false. +func NodeOSArchIs(supportedNodeOsArchs ...string) bool { + for _, arch := range supportedNodeOsArchs { + if strings.EqualFold(arch, TestContext.NodeOSArch) { + return true + } + } + return false +} + // DeleteNamespaces deletes all namespaces that match the given delete and skip filters. // Filter is by simple strings.Contains; first skip filter, then delete filter. // Returns the list of deleted namespaces or an error. diff --git a/test/e2e/kubectl/BUILD b/test/e2e/kubectl/BUILD index 22170f4ef67..362d887da74 100644 --- a/test/e2e/kubectl/BUILD +++ b/test/e2e/kubectl/BUILD @@ -39,6 +39,7 @@ go_library( "//test/e2e/framework/node:go_default_library", "//test/e2e/framework/pod:go_default_library", "//test/e2e/framework/service:go_default_library", + "//test/e2e/framework/skipper:go_default_library", "//test/e2e/framework/testfiles:go_default_library", "//test/e2e/framework/websocket:go_default_library", "//test/e2e/scheduling:go_default_library",