Skip to content

Commit c2b7aa0

Browse files
authored
Merge pull request kubernetes#93000 from hakman/node-os-arch
Skip arch dependent kubectl test for non AMD64 nodes
2 parents ff33efc + 5d87704 commit c2b7aa0

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

test/e2e/framework/skipper/skipper.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ func SkipUnlessNodeOSDistroIs(supportedNodeOsDistros ...string) {
213213
}
214214
}
215215

216+
// SkipUnlessNodeOSArchIs skips if the node OS distro is not included in the supportedNodeOsArchs.
217+
func SkipUnlessNodeOSArchIs(supportedNodeOsArchs ...string) {
218+
if !framework.NodeOSArchIs(supportedNodeOsArchs...) {
219+
skipInternalf(1, "Only supported for node OS arch %v (not %s)", supportedNodeOsArchs, framework.TestContext.NodeOSArch)
220+
}
221+
}
222+
216223
// SkipIfNodeOSDistroIs skips if the node OS distro is included in the unsupportedNodeOsDistros.
217224
func SkipIfNodeOSDistroIs(unsupportedNodeOsDistros ...string) {
218225
if framework.NodeOSDistroIs(unsupportedNodeOsDistros...) {

test/e2e/framework/test_context.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ type TestContextType struct {
116116
ImageServiceEndpoint string
117117
MasterOSDistro string
118118
NodeOSDistro string
119+
NodeOSArch string
119120
VerifyServiceAccount bool
120121
DeleteNamespace bool
121122
DeleteNamespaceOnFailure bool
@@ -324,6 +325,7 @@ func RegisterClusterFlags(flags *flag.FlagSet) {
324325
flags.StringVar(&TestContext.Prefix, "prefix", "e2e", "A prefix to be added to cloud resources created during testing.")
325326
flags.StringVar(&TestContext.MasterOSDistro, "master-os-distro", "debian", "The OS distribution of cluster master (debian, ubuntu, gci, coreos, or custom).")
326327
flags.StringVar(&TestContext.NodeOSDistro, "node-os-distro", "debian", "The OS distribution of cluster VM instances (debian, ubuntu, gci, coreos, or custom).")
328+
flags.StringVar(&TestContext.NodeOSArch, "node-os-arch", "amd64", "The OS architecture of cluster VM instances (amd64, arm64, or custom).")
327329
flags.StringVar(&TestContext.ClusterDNSDomain, "dns-domain", "cluster.local", "The DNS Domain of the cluster.")
328330

329331
// TODO: Flags per provider? Rename gce-project/gce-zone?

test/e2e/framework/util.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,16 @@ func NodeOSDistroIs(supportedNodeOsDistros ...string) bool {
203203
return false
204204
}
205205

206+
// NodeOSArchIs returns true if the node OS arch is included in the supportedNodeOsArchs. Otherwise false.
207+
func NodeOSArchIs(supportedNodeOsArchs ...string) bool {
208+
for _, arch := range supportedNodeOsArchs {
209+
if strings.EqualFold(arch, TestContext.NodeOSArch) {
210+
return true
211+
}
212+
}
213+
return false
214+
}
215+
206216
// DeleteNamespaces deletes all namespaces that match the given delete and skip filters.
207217
// Filter is by simple strings.Contains; first skip filter, then delete filter.
208218
// Returns the list of deleted namespaces or an error.

test/e2e/kubectl/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ go_library(
3939
"//test/e2e/framework/node:go_default_library",
4040
"//test/e2e/framework/pod:go_default_library",
4141
"//test/e2e/framework/service:go_default_library",
42+
"//test/e2e/framework/skipper:go_default_library",
4243
"//test/e2e/framework/testfiles:go_default_library",
4344
"//test/e2e/framework/websocket:go_default_library",
4445
"//test/e2e/scheduling:go_default_library",

test/e2e/kubectl/kubectl.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import (
6969
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
7070
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
7171
e2eservice "k8s.io/kubernetes/test/e2e/framework/service"
72+
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
7273
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
7374
"k8s.io/kubernetes/test/e2e/scheduling"
7475
testutils "k8s.io/kubernetes/test/utils"
@@ -646,6 +647,10 @@ var _ = SIGDescribe("Kubectl client", func() {
646647
})
647648

648649
ginkgo.It("should handle in-cluster config", func() {
650+
// TODO: Find a way to download and copy the appropriate kubectl binary, or maybe a multi-arch kubectl image
651+
// for now this only works on amd64
652+
e2eskipper.SkipUnlessNodeOSArchIs("amd64")
653+
649654
ginkgo.By("adding rbac permissions")
650655
// grant the view permission widely to allow inspection of the `invalid` namespace and the default namespace
651656
err := e2eauth.BindClusterRole(f.ClientSet.RbacV1(), "view", f.Namespace.Name,

0 commit comments

Comments
 (0)