Commit Graph

236 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
ee1ff4866e Merge pull request #134479 from pohly/dra-device-taint-no-execute-toleration-fix
DRA device taints: fix toleration of NoExecute
2025-10-10 00:47:00 -07:00
Patrick Ohly
6f51446802 DRA device taints: fix toleration of NoExecute
As usual, consumers of an allocated claim react to the information stored in
the status. In this case, the scheduler did not copy the tolerations into the
status and as a result a pod with a toleration for NoExecute got scheduled and
then immediately evicted.

Some additional logging gets added to make the handling easier to track in the
eviction controller. Example YAMLs allow reproducing the use case manually.
2025-10-08 13:13:47 +02:00
Patrick Ohly
f95d531b0a DRA: CRUD conformance tests
Promoting real tests turned out to be harder than expected (should be rewritten
to be self-contained, additional reviews, etc.).

They would not achieve 100% endpoint+operation coverage because real tests only
use some of the operations. Therefore each API type has to be covered with
CRUD-style tests which only exercise the apiserver, then maybe additional
functional tests can be added later (depending on time and motivation).

The machinery for testing different API types is meant to be reusable, so it
gets added in the new e2e/framework/conformance helper package.
2025-10-02 17:43:33 +02:00
Patrick Ohly
545526cfe0 DRA E2E: only check ResourceClaims in the test namespace
That was the original intent, but the implementation then ended up checking
ResourceClaims in all namespaces. Depending on timing this was merely
misleading (showing ResourceClaim changes from a different test running in
parallel), but with upcoming CRUD tests which intentionally set an allocation
result without a finalizer it breaks the non-CRUD tests when they check the
those CRUD ResourceClaims.
2025-10-02 16:07:48 +02:00
Alay Patel
8a03067211 fix resource claims deallocation for extended resource when pod is completed
Signed-off-by: Alay Patel <alayp@nvidia.com>
2025-09-29 15:15:40 -04:00
yliao
79f8d1b1c5 fixed bug such that implicit extended resource name can always be used,
no matter the explicit extendedResourceName field in device class is set or not.
2025-09-10 14:10:40 +00:00
Patrick Ohly
8a95e8a71c DRA E2E: clean up class creation for extended resource tests
The initial testing of DRAExtendedResource changed the common setup for all
tests so that each test runs with seven DeviceClasses. This is unnecessary and
confusing, for example when looking at the endpoint stats for the simple
conformance test ("Are the stats correct? The test should only create one
class.").

This update changes it so that each test which needs more than the default
class explicitly creates those itself. For clarity, the special -1 index gets a
name and naming of the DeviceClasses gets updated to keep the default class
simple (no additional suffix).

Using the same "example.com/resource0" in tests which run in parallel might
explain https://github.com/kubernetes/kubernetes/issues/133653. This gets
replaced with extended resource names based on the driver name, which is unique
in each parallel test.
2025-08-22 18:12:34 +02:00
Kubernetes Prow Robot
5568780ca3 Merge pull request #133562 from nojnhuh/dra-e2e-slice-controller-flake
DRA: wait for stats to converge in "creates slices" e2e test
2025-08-19 04:21:36 -07:00
Jon Huhn
bf6c86b562 DRA: wait for stats to converge in "creates slices" e2e test 2025-08-15 01:02:44 -05:00
yliao
edfa9a5bd2 added WithFlaky() to the device plugin test case: supports extended resources together with ResourceClaim 2025-08-13 17:57:33 +00:00
yliao
b796918986 reduced numPods to 5 from 10 to fix flaky test (supports reusing resources) due to timeout. 2025-08-06 07:42:31 +00:00
Sunyanan Choochotkaew
7f052afaef KEP 5075: implement scheduler
Signed-off-by: Sunyanan Choochotkaew <sunyanan.choochotkaew1@ibm.com>
2025-07-30 09:52:49 +09:00
yliao
23d6f73e72 extended resource backed by DRA: test 2025-07-29 18:55:28 +00:00
Kubernetes Prow Robot
a493bafd02 Merge pull request #133156 from ritazh/draadminaccess-update-flake
DRAAdminAccess: move metrics test from e2e to integration
2025-07-25 13:40:27 -07:00
Patrick Ohly
40a90df3b3 DRA E2E: remove stress test
The test needs to schedule 256 pods at once, which only works with three
nodes (default limit is 100, but could also be lower). It's also a stress test
which flaked recently.

For now it gets removed without a replacement. A similar integration test is in
development, but too big (needs some infrastructure changes in
test/integration/dra) to add during code freeze.
2025-07-25 12:45:01 +02:00
John-Paul Sassine
b7de71f9ce feat(kubelet): Add ResourceHealthStatus for DRA pods
This change introduces the ability for the Kubelet to monitor and report
the health of devices allocated via Dynamic Resource Allocation (DRA).
This addresses a key part of KEP-4680 by providing visibility into
device failures, which helps users and controllers diagnose pod failures.

The implementation includes:
- A new `v1alpha1.NodeHealth` gRPC service with a `WatchResources`
  stream that DRA plugins can optionally implement.
- A health information cache within the Kubelet's DRA manager to track
  the last known health of each device and handle plugin disconnections.
- An asynchronous update mechanism that triggers a pod sync when a
  device's health changes.
- A new `allocatedResourcesStatus` field in `v1.ContainerStatus` to
  expose the device health information to users via the Pod API.

Update vendor

KEP-4680: Fix lint, boilerplate, and codegen issues

Add another e2e test, add TODO for KEP4680 & update test infra helpers

Add Feature Gate e2e test

Fixing presubmits

Fix var names, feature gating, and nits

Fix DRA Health gRPC API according to review feedback
2025-07-24 23:23:18 +00:00
Rita Zhang
c15a54f8c0 draadminaccess: move metrics test from e2e to integration
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>
2025-07-24 14:08:14 -07:00
Patrick Ohly
c954e13255 Revert "DRAAdminAccess: add upgrade downgrade test" 2025-07-24 14:04:08 +02:00
Patrick Ohly
24de875ceb DRA: graduate DynamicResourceAllocation feature to GA
It hasn't been on-by-default before, therefore it does not get locked to the
new default on yet. This has some impact on the scheduler configuration
because the plugin is now enabled by default.

Because the feature is now GA, it doesn't need to be a label on E2E tests,
which wouldn't be possible anyway once it gets removed entirely.
2025-07-24 08:33:56 +02:00
Patrick Ohly
5c4f81743c DRA: use v1 API
As before when adding v1beta2, DRA drivers built using the
k8s.io/dynamic-resource-allocation helper packages remain compatible with all
Kubernetes release >= 1.32. The helper code picks whatever API version is
enabled from v1beta1/v1beta2/v1.

However, the control plane now depends on v1, so a cluster configuration where
only v1beta1 or v1beta2 are enabled without the v1 won't work.
2025-07-24 08:33:45 +02:00
Kubernetes Prow Robot
051dd70772 Merge pull request #133149 from ritazh/draadminaccess-test
draadminaccess test make it serial
2025-07-23 19:56:55 -07:00
Kubernetes Prow Robot
ca569e152d Merge pull request #132700 from pohly/dra-kubelet-grpc-v1
DRA kubelet: add v1 gRPC
2025-07-23 17:36:26 -07:00
Rita Zhang
61cc6cf807 draadminaccess test make it serial
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>
2025-07-23 09:13:13 -07:00
Kubernetes Prow Robot
49af85d86a Merge pull request #133110 from ritazh/DRAAdminAccess_upgradedowngradetest
DRAAdminAccess: add upgrade downgrade test
2025-07-23 07:08:28 -07:00
Patrick Ohly
f6061605fb DRA E2E: run multi-node control plane tests also with two nodes
The tests should work also with only two nodes, which is the minimum required
for conformance testing.
2025-07-23 09:12:46 +02:00
Patrick Ohly
f0e2920898 DRA E2E: simplify "control plane" test names
There's no need to clarify how many nodes are used in the test because the
overall test names are still unique without that (verified with go test -v
./test/e2e -args -list-tests | grep -w DRA | wc -l).
2025-07-23 09:10:45 +02:00
Patrick Ohly
603751ee80 DRA E2E: remove redundant test
"must be possible for the driver to update the ResourceClaim.Status.Devices
once allocated" was also run as kubelet test although it only checks the
control plane.

Before:
    [sig-node] [DRA] [FeatureGate:DynamicResourceAllocation] [Beta] [Feature:OffByDefault] control plane with single node [ConformanceCandidate] must be possible for the driver to update the ResourceClaim.Status.Devices once allocated [FeatureGate:DRAResourceClaimDeviceStatus] [Beta]
    [sig-node] [DRA] [FeatureGate:DynamicResourceAllocation] [Beta] [Feature:OffByDefault] kubelet [Feature:DynamicResourceAllocation] on single node must be possible for the driver to update the ResourceClaim.Status.Devices once allocated [FeatureGate:DRAResourceClaimDeviceStatus] [Beta]

After:
    [sig-node] [DRA] [FeatureGate:DynamicResourceAllocation] [Beta] [Feature:OffByDefault] control plane with single node [ConformanceCandidate] must be possible for the driver to update the ResourceClaim.Status.Devices once allocated [FeatureGate:DRAResourceClaimDeviceStatus] [Beta]
2025-07-23 09:10:45 +02:00
Rita Zhang
216f7485bd DRAAdminAccess: add upgrade downgrade test
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>
2025-07-22 11:54:34 -07:00
Patrick Ohly
78bf3410c8 DRA E2E: revisit conformance classification of tests
All of these tests already ran successfully in
https://testgrid.k8s.io/sig-release-master-informing#kind-master-beta&include-filter-by-regex=DRA
and thus can get promoted to a conformance tests once DRA is GA.

The "control plane truncates the name of a generated resource claim" was marked
as depending on a recent kubelet incorrectly.

Removal of the feature label fixes b84271a779.

Removal of KubeletMinVersion for control plane tests depends on running only
kubelet tests in the kubelet version skew jobs.
2025-07-22 09:21:58 +02:00
Kubernetes Prow Robot
8e12e795d0 Merge pull request #133076 from pohly/dra-client-conversion-fix
DRA: fix conversion of watch
2025-07-20 12:52:29 -07:00
Rita Zhang
b84271a779 DRAAdminAccess: add e2e
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>
2025-07-19 21:54:47 -07:00
Patrick Ohly
f77ce8951e DRA: debug output for list/watch client
Upgrade/downgrade testing after the DRA GA graduation gets stuck because the
ResourceSlice controller's informer doesn't pick up that the ResourceSlice got
deleted.

This additional log output shows a List+Watch after a watch got closed due to a
disconnect from the apiserver, so right now everything is working as expected.
2025-07-19 11:38:12 +02:00
Patrick Ohly
f141907ddd DRA kubelet: add v1 gRPC
The API is a direct copy of v1beta1, with v1beta1 replaced by v1.
The interoperability support is the same that was used for v1alpha4.
Adding it "reverts" the removal of the v1alpha4 support in
a57f15e081, except that now v1beta1 is the legacy
API which needs conversion. If kubelet and the plugin both support v1, no
conversion is needed.
2025-07-17 07:56:03 +02:00
Ed Bartosh
fc21d3f37d e2e: DRA: enable test plugin to cancel main context on error
Add a cancelMainContext field to ExamplePlugin and options. This
function allows the plugin to cancel an upper-level context when a
background error occurs. The HandleError method now calls this
function if it is set.

This enables DRA drivers to perform a graceful shutdown when a fatal
background error triggers context cancellation.
2025-07-16 15:49:41 +03:00
Ed Bartosh
1981c985b1 e2e: DRA: support test and public options
Refactor StartPlugin and related test helpers to accept a variadic
list of options of any type, allowing both public and test-specific
options to be passed.
2025-07-16 15:49:41 +03:00
Patrick Ohly
d44b737447 DRA: handle grpc.Server.Serve failures
Added an errHandler callback to startGRPCServer for handling errors.
Replaced direct logging of server failures with calls to the
provided error handler. This change ensures that errors are surfaced
and handled consistently.

Co-authored-by: Ed Bartosh <eduard.bartosh@intel.com>
2025-07-16 15:49:32 +03:00
Patrick Ohly
c8ca9249ac DRA integration: add upgrade/downgrade testing with local-up-cluster.sh
The test brings up the cluster and uses that power to run through
an upgrade/downgrade scenario. Version skew testing (running tests while the cluster
is partially up- or downgraded) could be added.

The new helper code for managing the cluster is written so that it could be
used both in an integration test and an E2E
test. https://github.com/kubernetes/kubernetes/pull/122481 could make that a
bit easier in an E2E test, but is not absolutely required.

In contrast to running on a normal cluster, pods need no privileges.
Instead, the caller has to make sure that the test itself can write
into system directories used by the cluster.
2025-07-15 12:54:40 +02:00
Patrick Ohly
60e9316c0c DRA E2E: refactor helper code
The helper code is useful for a separate Ginkgo suite for upgrade/downgrade
testing. We don't want to import test/e2e/dra there because that would also
define additional tests.
2025-07-15 12:54:40 +02:00
Patrick Ohly
2e3228e2ca DRA E2E: support deploying driver on localhost
If we know that the test binary shares the filesystem with the cluster (for
example, when using local-up-cluster.sh), then we can avoid the whole
complicated portproxy solution and work directly with the paths on the
host.

Only works with suitable permissions! /var/lib/kubelet/plugins,
/var/lib/kubelet/plugin_registry, and /var/run/cdi must be writable.

portproxy remains the default because it automatically gains sufficient
permissions also when combined with local-up-cluster.sh.
2025-07-15 12:52:27 +02:00
Patrick Ohly
f381d73724 DRA E2E: retry exec of hostpathplugin
We can recover from exec failing, the portproxy code already retries port
forwarding.
2025-07-15 12:52:27 +02:00
Patrick Ohly
c2080e7e45 DRA E2E: support using ktesting
This is a DRA-specific stop-gap solution for using the E2E framework together
with ktesting. Long-term this should better land in the E2E framework itself.
2025-07-15 12:52:27 +02:00
Patrick Ohly
5721c927e6 DRA E2E: increase verbosity of resource claim controller
Can be done via -vmodule, albeit not precisely because other controllers
also have a controller.go file.
2025-07-15 12:52:26 +02:00
Patrick Ohly
af249fb2e9 DRA E2E: test mixture of extended resources + ResourceClaim
This shows that a device plugin and DRA driver can be used together on the same
node.
2025-07-14 18:13:27 +02:00
Patrick Ohly
2dd07e9242 DRA E2E: ResourceSlice Controller test flake
There was one flake:

  expected pod to be pod is scheduled, got instead:
     ...
     status:
          conditions:
          - lastProbeTime: null
            lastTransitionTime: "2025-07-06T12:08:54Z"
            message: 'running "DynamicResources" filter plugin: pool network-attached is invalid:
              duplicate device name dev-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0000'

The root cause was that the test produced device names which were unique within
their slice, but not within the pool. This didn't matter for the test itself,
but for tests running concurrently of after it, because those slices were also
not cleaned up properly.

Timing in pull-kubernetes-e2e-gce also was different.
2025-07-09 15:56:06 +02:00
Patrick Ohly
ad0b2bf4f5 DRA E2E: serialize costly test
After enabling more tests in 00dd610c93,
periodic ci-kind-dra-all became unstable, with random flakes at the time when
the "supports sharing a claim sequentially". Probably the cluster became
overwhelmed by the number of pods which wanted to run in parallel. Running this
tests in the serial phase of a Ginkgo run should fix this.
2025-07-02 18:11:46 +02:00
Patrick Ohly
00dd610c93 DRA E2E: run some tests without feature label
Tests which only exercise the control plane don't need DRA drivers on the nodes
and thus can run in any cluster where the API and feature gate is
enabled. Eventually they can become conformance tests.

The actual test cases follow the same pattern and in some cases are run twice,
once for "control plane" testing and once for "kubelet" testing. The difference
is that in "control plane" mode, the driver's don't get deployed and pods are
only expected to get scheduled instead of starting to run.
2025-06-27 21:15:50 +02:00
Jon Huhn
8454093f09 DRA: add e2e test with initContainer using external claim 2025-06-19 15:19:00 -05:00
Kubernetes Prow Robot
bd44685ead Merge pull request #132317 from pohly/dra-kubelet-version-skew-labels
DRA E2E: label tests which need a certain minimum kubelet, II
2025-06-16 00:39:02 -07:00
Jon Huhn
fae2fdd052 DRA: wrap e2e finalizer update in retry 2025-06-15 23:49:43 -05:00
Patrick Ohly
233a0aeedb DRA E2E: label tests which need a certain minimum kubelet, II
Commit 71b2f32d70 missed one test which needs the
"kubelet >= 1.33" label because that test didn't run in the canary
presubmit. It's now failing in the ci-kind-dra-n-2 job.
2025-06-15 13:04:25 +02:00