DRA: add DRAControlPlaneController feature gate for "classic DRA"

In the API, the effect of the feature gate is that alpha fields get dropped on
create. They get preserved during updates if already set. The
PodSchedulingContext registration is *not* restricted by the feature gate.
This enables deleting stale PodSchedulingContext objects after disabling
the feature gate.

The scheduler checks the new feature gate before setting up an informer for
PodSchedulingContext objects and when deciding whether it can schedule a
pod. If any claim depends on a control plane controller, the scheduler bails
out, leading to:

    Status:       Pending
    ...
      Warning  FailedScheduling             73s   default-scheduler  0/1 nodes are available: resourceclaim depends on disabled DRAControlPlaneController feature. no new claims to deallocate, preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.

The rest of the changes prepare for testing the new feature separately from
"structured parameters". The goal is to have base "dra" jobs which just enable
and test those, then "classic-dra" jobs which add DRAControlPlaneController.
This commit is contained in:
Patrick Ohly
2024-07-15 21:05:21 +02:00
parent 599fe605f9
commit 9f36c8d718
16 changed files with 651 additions and 92 deletions

View File

@@ -973,8 +973,8 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation,
})
}
ginkgo.Context("with classic DRA", func() { tests(parameterModeClassicDRA) })
ginkgo.Context("with structured parameters", func() { tests(parameterModeStructured) })
framework.Context("with classic DRA", feature.DRAControlPlaneController, func() { tests(parameterModeClassicDRA) })
framework.Context("with structured parameters", func() { tests(parameterModeStructured) })
// TODO (https://github.com/kubernetes/kubernetes/issues/123699): move most of the test below into `testDriver` so that they get
// executed with different parameters.
@@ -1100,7 +1100,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation,
// The following tests are all about behavior in combination with a
// control-plane DRA driver controller.
ginkgo.Context("cluster with DRA driver controller", func() {
framework.Context("cluster with classic DRA", feature.DRAControlPlaneController, func() {
nodes := NewNodes(f, 1, 4)
// kube-controller-manager can trigger delayed allocation for pods where the

View File

@@ -0,0 +1,45 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
# Enable CDI as described in
# https://github.com/container-orchestrated-devices/container-device-interface#containerd-configuration
- |-
[plugins."io.containerd.grpc.v1.cri"]
enable_cdi = true
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: ClusterConfiguration
scheduler:
extraArgs:
v: "5"
vmodule: "allocator=6,dynamicresources=6" # structured/allocator.go, DRA scheduler plugin
controllerManager:
extraArgs:
v: "5"
apiServer:
extraArgs:
runtime-config: "resource.k8s.io/v1alpha3=true"
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
v: "5"
- role: worker
kubeadmConfigPatches:
- |
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
v: "5"
- role: worker
kubeadmConfigPatches:
- |
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
v: "5"
featureGates:
DynamicResourceAllocation: true
DRAControlPlaneController: true

View File

@@ -94,7 +94,28 @@ var (
// TODO: document the feature (owning SIG, when to use this feature for a test)
Downgrade = framework.WithFeature(framework.ValidFeatures.Add("Downgrade"))
// TODO: document the feature (owning SIG, when to use this feature for a test)
// owning-sig: sig-node
// kep: https://kep.k8s.io/3063
// test-infra jobs:
// - "classic-dra" in https://testgrid.k8s.io/sig-node-dynamic-resource-allocation
//
// This label is used for tests which need:
// - the DynamicResourceAllocation *and* DRAControlPlaneController 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
DRAControlPlaneController = framework.WithFeature(framework.ValidFeatures.Add("DRAControlPlaneController"))
// 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
//
// This label is used for tests which need:
// - *only* the DynamicResourceAllocation feature gate
// - 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
DynamicResourceAllocation = framework.WithFeature(framework.ValidFeatures.Add("DynamicResourceAllocation"))
// TODO: document the feature (owning SIG, when to use this feature for a test)

View File

@@ -658,6 +658,7 @@ func TestNodeEvents(t *testing.T) {
// no standard API for those).
func TestPodSchedulingContextSSA(t *testing.T) {
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DynamicResourceAllocation, true)
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.DRAControlPlaneController, true)
testCtx := testutils.InitTestAPIServer(t, "podschedulingcontext-ssa", nil)
testCtx.DisableEventSink = true

View File

@@ -745,6 +745,7 @@
# and dynamically created ResourceClaim instances for each pod.
- name: SchedulingWithResourceClaimTemplate
featureGates:
DRAControlPlaneController: true
DynamicResourceAllocation: true
# SchedulerQueueingHints: true
workloadTemplate:
@@ -812,6 +813,7 @@
# scheduling via PodSchedulingContext.
- name: SchedulingWithMultipleResourceClaims
featureGates:
DRAControlPlaneController: true
DynamicResourceAllocation: true
# SchedulerQueueingHints: true
workloadTemplate:
@@ -882,7 +884,7 @@
measurePods: 1000
maxClaimsPerNode: 20
# SchedulingWithResourceClaimTemplate uses a ResourceClaimTemplate
# SchedulingWithResourceClaimTemplateStructured uses a ResourceClaimTemplate
# and dynamically creates ResourceClaim instances for each pod.
# The driver uses structured parameters.
- name: SchedulingWithResourceClaimTemplateStructured