Skip to content

Commit fb72e4b

Browse files
committed
fix(ci): skip test if UserNamespacesSupport feature gate is not set
We should not just rely on the sysctl, also confirm that `UserNamespacesSupport=true` feature gate is set for apiserver, so that the tests gets skipped if only sysctl is set. Signed-off-by: Noel Georgi <[email protected]>
1 parent 11380f9 commit fb72e4b

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

internal/integration/api/extensions_qemu.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ func (suite *ExtensionsSuiteQEMU) mdADMArrayExists() bool {
519519
// TestExtensionsZFS verifies zfs is working, udev rules work and the pool is mounted on reboot.
520520
func (suite *ExtensionsSuiteQEMU) TestExtensionsZFS() {
521521
node := suite.RandomDiscoveredNodeInternalIP(machine.TypeWorker)
522-
suite.AssertServicesRunning(suite.ctx, node, map[string]string{"ext-zpool-importer": "Finished"})
522+
suite.AssertServicesRunning(suite.ctx, node, map[string]string{"ext-zfs-service": "Running"})
523523

524524
userDisks, err := suite.UserDisks(suite.ctx, node)
525525
suite.Require().NoError(err)

internal/integration/k8s/usernamespace.go

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (suite *UserNamespaceSuite) SuiteName() string {
3535

3636
// TestUserNamespace verifies that a pod with user namespace works.
3737
//
38-
//nolint:gocyclo
38+
//nolint:gocyclo,cyclop
3939
func (suite *UserNamespaceSuite) TestUserNamespace() {
4040
if suite.Cluster == nil {
4141
suite.T().Skip("without full cluster state reaching out to the node IP is not reliable")
@@ -64,6 +64,38 @@ func (suite *UserNamespaceSuite) TestUserNamespace() {
6464
suite.T().Skip("skipping test since user namespace is disabled")
6565
}
6666

67+
controlPlaneNode := suite.RandomDiscoveredNodeInternalIP(machine.TypeControlPlane)
68+
69+
controlPlaneNodeCtx := client.WithNode(ctx, controlPlaneNode)
70+
71+
controlPlaneNodeConfig, err := suite.ReadConfigFromNode(controlPlaneNodeCtx)
72+
suite.Require().NoError(err)
73+
74+
if controlPlaneNodeConfig.Cluster().APIServer().ExtraArgs() == nil {
75+
suite.T().Skip("skipping test since no api server extra args found")
76+
} else {
77+
if featureGates, ok := controlPlaneNodeConfig.Cluster().APIServer().ExtraArgs()["feature-gates"]; ok {
78+
if !strings.Contains(featureGates, "UserNamespacesSupport=true") {
79+
suite.T().Skip("skipping test since user namespace feature gate is not enabled for kube-apiserver")
80+
}
81+
}
82+
}
83+
84+
workerNodeConfig, err := suite.ReadConfigFromNode(client.WithNode(ctx, node))
85+
suite.Require().NoError(err)
86+
87+
if workerNodeConfig.Machine().Kubelet().ExtraConfig() == nil {
88+
suite.T().Skip("skipping test since no kubelet extra config found")
89+
} else {
90+
if featureGates, ok := workerNodeConfig.Machine().Kubelet().ExtraConfig()["featureGates"]; ok {
91+
if fg, ok := featureGates.(map[string]string); ok {
92+
if val, ok := fg["UserNamespacesSupport"]; !ok || val != "true" {
93+
suite.T().Skip("skipping test since user namespace feature gate is not enabled for kubelet")
94+
}
95+
}
96+
}
97+
}
98+
6799
usernamespacePodManifest := suite.ParseManifests(userNamespacePodSpec)
68100

69101
suite.T().Cleanup(func() {

0 commit comments

Comments
 (0)