mirror of
https://github.com/lingble/talos.git
synced 2025-11-02 05:28:09 +00:00
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 <git@frezbo.dev>
This commit is contained in:
@@ -519,7 +519,7 @@ func (suite *ExtensionsSuiteQEMU) mdADMArrayExists() bool {
|
||||
// TestExtensionsZFS verifies zfs is working, udev rules work and the pool is mounted on reboot.
|
||||
func (suite *ExtensionsSuiteQEMU) TestExtensionsZFS() {
|
||||
node := suite.RandomDiscoveredNodeInternalIP(machine.TypeWorker)
|
||||
suite.AssertServicesRunning(suite.ctx, node, map[string]string{"ext-zpool-importer": "Finished"})
|
||||
suite.AssertServicesRunning(suite.ctx, node, map[string]string{"ext-zfs-service": "Running"})
|
||||
|
||||
userDisks, err := suite.UserDisks(suite.ctx, node)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
@@ -35,7 +35,7 @@ func (suite *UserNamespaceSuite) SuiteName() string {
|
||||
|
||||
// TestUserNamespace verifies that a pod with user namespace works.
|
||||
//
|
||||
//nolint:gocyclo
|
||||
//nolint:gocyclo,cyclop
|
||||
func (suite *UserNamespaceSuite) TestUserNamespace() {
|
||||
if suite.Cluster == nil {
|
||||
suite.T().Skip("without full cluster state reaching out to the node IP is not reliable")
|
||||
@@ -64,6 +64,38 @@ func (suite *UserNamespaceSuite) TestUserNamespace() {
|
||||
suite.T().Skip("skipping test since user namespace is disabled")
|
||||
}
|
||||
|
||||
controlPlaneNode := suite.RandomDiscoveredNodeInternalIP(machine.TypeControlPlane)
|
||||
|
||||
controlPlaneNodeCtx := client.WithNode(ctx, controlPlaneNode)
|
||||
|
||||
controlPlaneNodeConfig, err := suite.ReadConfigFromNode(controlPlaneNodeCtx)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
if controlPlaneNodeConfig.Cluster().APIServer().ExtraArgs() == nil {
|
||||
suite.T().Skip("skipping test since no api server extra args found")
|
||||
} else {
|
||||
if featureGates, ok := controlPlaneNodeConfig.Cluster().APIServer().ExtraArgs()["feature-gates"]; ok {
|
||||
if !strings.Contains(featureGates, "UserNamespacesSupport=true") {
|
||||
suite.T().Skip("skipping test since user namespace feature gate is not enabled for kube-apiserver")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
workerNodeConfig, err := suite.ReadConfigFromNode(client.WithNode(ctx, node))
|
||||
suite.Require().NoError(err)
|
||||
|
||||
if workerNodeConfig.Machine().Kubelet().ExtraConfig() == nil {
|
||||
suite.T().Skip("skipping test since no kubelet extra config found")
|
||||
} else {
|
||||
if featureGates, ok := workerNodeConfig.Machine().Kubelet().ExtraConfig()["featureGates"]; ok {
|
||||
if fg, ok := featureGates.(map[string]string); ok {
|
||||
if val, ok := fg["UserNamespacesSupport"]; !ok || val != "true" {
|
||||
suite.T().Skip("skipping test since user namespace feature gate is not enabled for kubelet")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
usernamespacePodManifest := suite.ParseManifests(userNamespacePodSpec)
|
||||
|
||||
suite.T().Cleanup(func() {
|
||||
|
||||
Reference in New Issue
Block a user