diff --git a/test/e2e/apimachinery/resource_quota.go b/test/e2e/apimachinery/resource_quota.go index 26c7c1f3d0b..91c32839906 100644 --- a/test/e2e/apimachinery/resource_quota.go +++ b/test/e2e/apimachinery/resource_quota.go @@ -502,7 +502,7 @@ var _ = SIGDescribe("ResourceQuota", func() { Delete the ResourceClaim. Deletion MUST succeed and resource usage count against the ResourceClaim object MUST be released from ResourceQuotaStatus of the ResourceQuota. [NotConformancePromotable] alpha feature */ - f.It("should create a ResourceQuota and capture the life of a ResourceClaim", feature.DynamicResourceAllocation, func(ctx context.Context) { + f.It("should create a ResourceQuota and capture the life of a ResourceClaim", f.WithFeatureGate(features.DynamicResourceAllocation), f.WithLabel("DRA"), func(ctx context.Context) { ginkgo.By("Counting existing ResourceQuota") c, err := countResourceQuota(ctx, f.ClientSet, f.Namespace.Name) framework.ExpectNoError(err) diff --git a/test/e2e/dra/dra.go b/test/e2e/dra/dra.go index e89c747c446..765c8008834 100644 --- a/test/e2e/dra/dra.go +++ b/test/e2e/dra/dra.go @@ -78,7 +78,11 @@ func perNode(maxAllocations int, nodes *Nodes) func() Resources { } } -var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, framework.WithFeatureGate(features.DynamicResourceAllocation), func() { +// TODO: remove feature.DynamicResourceAllocation here and add it only for those tests +// which really need node-level support for DRA. +// +// The "DRA" label is used to select tests related to DRA in a Ginkgo label filter. +var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), feature.DynamicResourceAllocation, framework.WithFeatureGate(features.DynamicResourceAllocation), func() { f := framework.NewDefaultFramework("dra") // The driver containers have to run with sufficient privileges to @@ -403,7 +407,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, }).WithTimeout(f.Timeouts.PodDelete).Should(gomega.HaveField("Status.Allocation", (*resourceapi.AllocationResult)(nil))) }) - f.It("must be possible for the driver to update the ResourceClaim.Status.Devices once allocated", feature.DRAResourceClaimDeviceStatus, framework.WithFeatureGate(features.DRAResourceClaimDeviceStatus), framework.WithFeatureGate(features.DynamicResourceAllocation), func(ctx context.Context) { + f.It("must be possible for the driver to update the ResourceClaim.Status.Devices once allocated", f.WithFeatureGate(features.DRAResourceClaimDeviceStatus), func(ctx context.Context) { pod := b.podExternal() claim := b.externalClaim() b.create(ctx, claim, pod) @@ -891,7 +895,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, b2 := newBuilder(f, driver2) b2.classParameters = driver2Params - f.It("selects the first subrequest that can be satisfied", feature.DRAPrioritizedList, func(ctx context.Context) { + f.It("selects the first subrequest that can be satisfied", f.WithFeatureGate(features.DRAPrioritizedList), func(ctx context.Context) { name := "external-multiclaim" params := `{"a":"b"}` claim := &resourceapi.ResourceClaim{ @@ -963,7 +967,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, gomega.Expect(results[1].Request).To(gomega.Equal("request-1/sub-request-2")) }) - f.It("uses the config for the selected subrequest", feature.DRAPrioritizedList, func(ctx context.Context) { + f.It("uses the config for the selected subrequest", f.WithFeatureGate(features.DRAPrioritizedList), func(ctx context.Context) { name := "external-multiclaim" parentReqParams, parentReqEnv := `{"a":"b"}`, []string{"user_a", "b"} subReq1Params := `{"c":"d"}` @@ -1045,7 +1049,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, b1.testPod(ctx, f, pod, expectedEnv...) }) - f.It("chooses the correct subrequest subject to constraints", feature.DRAPrioritizedList, func(ctx context.Context) { + f.It("chooses the correct subrequest subject to constraints", f.WithFeatureGate(features.DRAPrioritizedList), func(ctx context.Context) { name := "external-multiclaim" params := `{"a":"b"}` claim := &resourceapi.ResourceClaim{ @@ -1131,7 +1135,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, gomega.Expect(results[1].Request).To(gomega.Equal("request-2")) }) - f.It("filters config correctly for multiple devices", feature.DRAPrioritizedList, func(ctx context.Context) { + f.It("filters config correctly for multiple devices", f.WithFeatureGate(features.DRAPrioritizedList), func(ctx context.Context) { name := "external-multiclaim" req1Params, req1Env := `{"a":"b"}`, []string{"user_a", "b"} req1subReq1Params, _ := `{"c":"d"}`, []string{"user_d", "d"} @@ -1286,7 +1290,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, b.testPod(ctx, f, pod, expectedEnv...) }) - f.It("supports requests with alternatives", feature.DRAPrioritizedList, func(ctx context.Context) { + f.It("supports requests with alternatives", f.WithFeatureGate(features.DRAPrioritizedList), func(ctx context.Context) { claimName := "external-multiclaim" parameters, _ := b.parametersEnv() claim := &resourceapi.ResourceClaim{ @@ -1368,7 +1372,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, v1beta2Tests() }) - framework.Context("with device taints", feature.DRADeviceTaints, framework.WithFeatureGate(features.DRADeviceTaints), func() { + framework.Context("with device taints", f.WithFeatureGate(features.DRADeviceTaints), func() { nodes := NewNodes(f, 1, 1) driver := NewDriver(f, nodes, func() Resources { return Resources{ @@ -1547,7 +1551,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, driver := NewDriver(f, nodes, networkResources) b := newBuilder(f, driver) - f.It("validate ResourceClaimTemplate and ResourceClaim for admin access", feature.DRAAdminAccess, framework.WithFeatureGate(features.DRAAdminAccess), framework.WithFeatureGate(features.DynamicResourceAllocation), func(ctx context.Context) { + f.It("validate ResourceClaimTemplate and ResourceClaim for admin access", f.WithFeatureGate(features.DRAAdminAccess), func(ctx context.Context) { // Attempt to create claim and claim template with admin access. Must fail eventually. claim := b.externalClaim() claim.Spec.Devices.Requests[0].Exactly.AdminAccess = ptr.To(true) @@ -1651,7 +1655,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, }).Should(gomega.MatchError(gomega.ContainSubstring("exceeded quota: object-count, requested: count/resourceclaims.resource.k8s.io=1, used: count/resourceclaims.resource.k8s.io=1, limited: count/resourceclaims.resource.k8s.io=1")), "creating second claim not allowed") }) - f.It("DaemonSet with admin access", feature.DRAAdminAccess, framework.WithFeatureGate(features.DRAAdminAccess), framework.WithFeatureGate(features.DynamicResourceAllocation), func(ctx context.Context) { + f.It("DaemonSet with admin access", f.WithFeatureGate(features.DRAAdminAccess), func(ctx context.Context) { // Ensure namespace has the dra admin label. _, err := b.f.ClientSet.CoreV1().Namespaces().Apply(ctx, applyv1.Namespace(b.f.Namespace.Name).WithLabels(map[string]string{"resource.k8s.io/admin-access": "true"}), diff --git a/test/e2e/feature/feature.go b/test/e2e/feature/feature.go index 5087e691db6..86caa4e5cee 100644 --- a/test/e2e/feature/feature.go +++ b/test/e2e/feature/feature.go @@ -101,64 +101,23 @@ var ( // TODO: document the feature (owning SIG, when to use this feature for a test) Downgrade = framework.WithFeature(framework.ValidFeatures.Add("Downgrade")) - // owning-sig: sig-node - // kep: https://kep.k8s.io/4817 - // test-infra jobs: - // - "dra-alpha" in https://testgrid.k8s.io/sig-node-dynamic-resource-allocation - // - // This label is used for tests which need: - // - the DynamicResourceAllocation *and* DRAResourceClaimDeviceStatus feature gates - DRAResourceClaimDeviceStatus = framework.WithFeature(framework.ValidFeatures.Add("DRAResourceClaimDeviceStatus")) - - // owning-sig: sig-node - // kep: https://kep.k8s.io/4381 - // test-infra jobs: - // - "dra-alpha" in https://testgrid.k8s.io/sig-node-dynamic-resource-allocation - // - // This label is used for tests which need: - // - the DynamicResourceAllocation *and* DRAAdminAccess feature gates - // - the resource.k8s.io API group - // - a container runtime where support for CDI (https://github.com/cncf-tags/container-device-interface) - // is enabled such that passing CDI device IDs through CRI fields is supported - DRAAdminAccess = framework.WithFeature(framework.ValidFeatures.Add("DRAAdminAccess")) - - // owning-sig: sig-scheduling - // kep: https://kep.k8s.io/5055 - // test-infra jobs: - // - "ci-kind-dra-all" in https://testgrid.k8s.io/sig-node-dynamic-resource-allocation - // - // This label is used for tests which need: - // - the DynamicResourceAllocation *and* DRADeviceTaints feature gates - // - the resource.k8s.io API group, including version v1alpha3 - DRADeviceTaints = framework.WithFeature(framework.ValidFeatures.Add("DRADeviceTaints")) - // TODO: document the feature (owning SIG, when to use this feature for a test) // OWNER: sig-node // Testing downward API huge pages DownwardAPIHugePages = framework.WithFeature(framework.ValidFeatures.Add("DownwardAPIHugePages")) - // owning-sig: sig-scheduling - // kep: https://kep.k8s.io/4816 - // test-infra jobs: - // - "ci-kind-dra-all" in https://testgrid.k8s.io/sig-node-dynamic-resource-allocation - // - // This label is used for tests which need: - // - the DynamicResourceAllocation *and* DRAPrioritizedList feature gates - // - the resource.k8s.io API group - // - a container runtime where support for CDI (https://github.com/cncf-tags/container-device-interface) - // is enabled such that passing CDI device IDs through CRI fields is supported - DRAPrioritizedList = framework.WithFeature(framework.ValidFeatures.Add("DRAPrioritizedList")) - // owning-sig: sig-node // kep: https://kep.k8s.io/4381 // test-infra jobs: - // - the non-"classic-dra" jobs in https://testgrid.k8s.io/sig-node-dynamic-resource-allocation + // - https://testgrid.k8s.io/sig-node-dynamic-resource-allocation // - // This label is used for tests which need: - // - *only* the DynamicResourceAllocation feature gate - // - the resource.k8s.io API group + // This feature label is used for tests which need: + // - kubelet support for plugins with the "usual" paths under /var/lib/kubelet // - a container runtime where support for CDI (https://github.com/cncf-tags/container-device-interface) // is enabled such that passing CDI device IDs through CRI fields is supported + // + // In addition, tests must be labeled with framework.WithFeatureGate to document + // their dependency on specific feature gates and the corresponding API groups. DynamicResourceAllocation = framework.WithFeature(framework.ValidFeatures.Add("DynamicResourceAllocation")) // owning-sig: sig-node diff --git a/test/e2e_node/dra_test.go b/test/e2e_node/dra_test.go index b4937bcac9c..ece7a894b15 100644 --- a/test/e2e_node/dra_test.go +++ b/test/e2e_node/dra_test.go @@ -48,6 +48,7 @@ import ( admissionapi "k8s.io/pod-security-admission/api" "k8s.io/utils/ptr" + "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/test/e2e/feature" "k8s.io/kubernetes/test/e2e/framework" e2epod "k8s.io/kubernetes/test/e2e/framework/pod" @@ -80,7 +81,9 @@ const ( retryTestTimeout = kubeletRetryPeriod + 30*time.Second ) -var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation, func() { +// Tests depend on container runtime support for CDI and the DRA feature gate. +// The "DRA" label is used to select tests related to DRA in a Ginkgo label filter. +var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), feature.DynamicResourceAllocation, framework.WithFeatureGate(features.DynamicResourceAllocation), func() { f := framework.NewDefaultFramework("dra-node") f.NamespacePodSecurityLevel = admissionapi.LevelBaseline