Commit Graph

3342 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
b07d0f852d Merge pull request #135168 from pohly/e2e-node-registry-flake
E2E node: temporarily disable flaky "pull from private registry"
2025-11-05 23:42:51 -08:00
Patrick Ohly
1499524e8e E2E node: temporarily disable flaky "pull from private registry"
This considerably impacts the ability to merge PRs right now because it fails
in the merge-blocking pull-kubernetes-node-e2e-containerd. Attempts to fix
it seem to be incomplete and need further
discussion (https://github.com/kubernetes/kubernetes/pull/135142),
so let's instead disable the test in the job.
2025-11-06 07:48:42 +01:00
HirazawaUi
192d93f7cb add e2e tests for static pod and standalone mode 2025-11-06 09:18:23 +08:00
Kubernetes Prow Robot
0452b0aec7 Merge pull request #134746 from HirazawaUi/fix-restart-kubelet-1
KEP-4781: Restarting kubelet does not change pod status
2025-11-05 01:48:52 -08:00
Kubernetes Prow Robot
dec78c833d Merge pull request #135094 from stlaz/fix-node-conformance-failures
Fix failures in node-e2e image pull tests
2025-11-04 14:32:11 -08:00
Kubernetes Prow Robot
934c34435a Merge pull request #134875 from Jpsassine/jpsassine-dra-health-fix
Fix bug in reporting health for templated and renamed DRA claims
2025-11-04 12:52:11 -08:00
Stanislav Láznička
a275785bd4 node conformance e2e: log fake registry creds on test failure 2025-11-04 17:26:40 +01:00
Stanislav Láznička
fba24a8e71 node-conformance-e2e: finite wait for pod status
Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
2025-11-04 17:26:35 +01:00
John-Paul Sassine
1e8fc543cc Fix report health for templated and renamed DRA claims
The Kubelet's DRA manager was failing to report device health status in a pod's status for certain types of resource claims. The logic incorrectly assumed that the claim name used within the container's spec (`container.resources.claims[*].name`) was the same as the metadata name of the actual ResourceClaim object.

This assumption is false in two key scenarios:
1.  When a claim is generated from a `ResourceClaimTemplate`, Kubernetes creates a `ResourceClaim` object with a randomized suffix in its name.
2.  When a user defines a pre-existing claim in `pod.spec.resourceClaims`, they can provide a local name that differs from the actual `ResourceClaim` object's name.

In both cases, the code would fail to find the claim's information in its internal cache, resulting in the health status not being populated, as reported in issue #134482.

This fix corrects the logic by using `pod.Status.ResourceClaimStatuses` as the authoritative map to look up the actual, generated name of the `ResourceClaim` object. This ensures that both templated and renamed claims are resolved correctly before their health status is retrieved from the cache.

Additionally, this change introduces a new node e2e test that specifically covers templated and renamed claims to prevent future regressions.
2025-11-03 22:56:32 +00:00
Kubernetes Prow Robot
4e8499740e Merge pull request #134985 from swatisehgal/node-cm-ctx-logging-migration
node: cm: migrate container manager to contextual logging
2025-11-03 09:34:12 -08:00
HirazawaUi
acdf891478 add e2e tests 2025-11-01 12:55:01 +08:00
Swati Sehgal
f2d075ea65 Address review comments
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-10-31 17:41:34 +00:00
Swati Sehgal
05f67d834a node: cm: migrate container manager to contextual logging
This commit migrates the container manager package to use
contextual logging.

This follows the contextual logging migration pattern where:
- Logger is passed from the boundary down to implementations
- klog.TODO() is used at call sites where context is not yet available
- Functions with context.Context extract logger via klog.FromContext(ctx)
- klog.InfoS/ErrorS/V().InfoS calls are replaced with logger.Info/Error/V().Info
- Sub-managers receive proper logger context from their callers

Some call sites still use klog.TODO() as placeholders, with TODO
comments indicating these will be replaced with proper contextual loggers
as the migration continues upward through the call stack.

Test/fake implementations use klog.Background() which is the appropriate
choice for test code where no real context is available.

Mock file updates (pkg/kubelet/cm/testing/mocks.go) were done manually
due to mockery tool incompatibility with Go 1.25 and will be committed
separately with an explanation.

Key changes:

1. PodContainerManager and ContainerManager interface updates:
   - PodContainerManager.EnsureExists: add logger parameter
   - PodContainerManager.Destroy: add logger parameter
   - PodContainerManager.ReduceCPULimits: add logger parameter
   - PodContainerManager.SetPodCgroupConfig: add logger parameter
   - ContainerManager.UpdateQOSCgroups: add logger parameter
   - Update all implementations (Linux, Windows, stub, noop, fake)

2. Helper function updates:
   - GetKubeletContainer: add logger parameter (Linux and unsupported platforms)
   - Update cmd/kubelet/app/server.go to pass logger to GetKubeletContainer
   - Comment out type assertion in helpers.go due to signature change

3. Cgroup manager contextual logging:
   - CgroupManager interface methods updated to accept logger:
     * Destroy: add logger parameter
     * ReduceCPULimits: add logger parameter
     * SetCgroupConfig: add logger parameter
   - Update cgroupCommon and unsupportedCgroupManager implementations
   - Migrate klog.InfoS/V().InfoS calls to logger.Info/V().Info

4. Container manager implementation updates:
   - Extract logger from context in NewContainerManager() and Start()
   - Pass logger to sub-managers (deviceManager, topologyManager)
   - Update DRA manager initialization to use logger from context
   - Migrate klog.InfoS/ErrorS to logger.Info/Error throughout

5. Call sites updated with TODO comments:
   - pkg/kubelet/kubelet.go: UpdateQOSCgroups, EnsureExists
   - pkg/kubelet/kubelet_pods.go: UpdateQOSCgroups, ReduceCPULimits, Destroy
   - pkg/kubelet/kuberuntime/kuberuntime_manager.go: SetPodCgroupConfig
   - pkg/kubelet/kuberuntime/kuberuntime_manager_test.go: test expectations

Most call sites currently use klog.TODO() as placeholders, with TODO
comments indicating these will be replaced with proper contextual loggers
as the migration continues upward through the call stack.

Test/fake implementations use klog.Background() which is the appropriate
choice for test code where no real context is available.

Mock file updates (pkg/kubelet/cm/testing/mocks.go) were done manually
due to mockery tool incompatibility with Go 1.25 and will be committed
separately with an explanation.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-10-30 18:34:03 +00:00
Kubernetes Prow Robot
34988e758d Merge pull request #134453 from stlaz/node-conformance-e2e
Fix node conformance tests with fake registry
2025-10-30 07:48:06 -07:00
Stanislav Láznička
428be46ba2 node conformance e2e: move registry cleanup to ginkgo.DeferCleanup
Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
2025-10-30 15:00:57 +01:00
Stanislav Láznička
842cd0ea77 node conformance e2e: don't recreate test container on an error
Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
2025-10-29 13:18:07 +01:00
Stanislav Láznička
135b46974a e2e registry: have SetupRegistry() return registry address 2025-10-29 13:18:06 +01:00
Stanislav Láznička
fc81e22735 fix Node Conformance Container Runtime test with fake registry
Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
2025-10-29 13:17:03 +01:00
Kubernetes Prow Robot
036e624317 Merge pull request #134918 from mariafromano-25/cleanup-sidecar-feature
SidecarContainer feature to Node Conformance
2025-10-28 15:22:08 -07:00
Kubernetes Prow Robot
7be689fcd6 Merge pull request #134816 from swatisehgal/device-plugin-e2e-flakiness-2
node: e2e: update podresources check post fix of kubernetes#119423
2025-10-28 07:49:42 -07:00
Stanislav Láznička
a3f242676c Revert "remove failing test that depends on expired credential, remove credential, add TODOs"
This reverts commit 8ace0fb89f.
2025-10-28 14:23:54 +01:00
Maria Romano Silva
86bfcd5eec oopsie missed two, should fix failing tests 2025-10-28 01:26:32 +00:00
Maria Romano Silva
a277269159 updating sidecar feature to node conformance 2025-10-27 23:43:43 +00:00
Kubernetes Prow Robot
6207429cd5 Merge pull request #134303 from eun2ce/cleanup-sig-node-e2e-features
Remove redundant KubeletPSI feature label from sig-node e2e test
2025-10-27 12:31:35 -07:00
eun2ce
b2571fe170 Add WithNodeConformance to KubeletPSI test context
- Add framework.WithNodeConformance() to indicate test doesn't require special environment
- This addresses reviewer feedback on PR #134303
2025-10-25 20:22:59 +09:00
Swati Sehgal
1e3a6e18d0 node: e2e: update podresources check post fix of kubernetes#119423
With kubernetes/kubernetes#132028 merged, pods in terminal states are no longer
reported by the podresources API. The previous test logic accounted for the old
behavior where even failed pods appeared in the API response (tracked under k/k
issue #119423). As a result, we used to expect the failed test pod to be present in the
response but with an empty device set.

This change updates the test to reflect the new, correct behavior:
1. The failed test pod should no longer appear in the podresources API response.
2. The test now asserts absence of the failed pod rather than checking for an empty device assignment.

This simplifies the test logic and aligns expectations with the current upstream
behavior of the podresources API.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-10-23 14:12:21 +01:00
Kubernetes Prow Robot
905d72b9bb Merge pull request #134757 from neolit123/1.35-fix-e2e-test-hostname-override
/test: use a different image for hostname override e2e tests
2025-10-22 17:38:45 -07:00
Lubomir I. Ivanov
804708df53 /test: use a different image for hostname override e2e tests
As discovered in ticket 134737 `hostname` is buggy on busybox
due to the musl backend that it uses. something in the /etc/hosts
that k8s generates trips its parser and it doesn't work properly
in the ipv6 tests.

To workaround that use an image that has a glibc backend,
so that the hostname command works.
2025-10-22 15:07:01 +02:00
Swati Sehgal
13511897bd node: e2e: extend wait for resources exported by sample device plugin
In the device plugin node reboot e2e test, the test previously waited a
short period for the resources exported by the sample device plugin to
appear on the local node. On slower test nodes, the plugin may take
longer to register, causing flakes where the expected devices are not
yet available.

This change increases the polling duration to 2 minutes, ensuring the test
waits long enough for the expected device capacity and allocatable resources
to appear, improving test stability.

This commit also updates the assertion message to be more explicit making
failures clearer and improving test reliability.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-10-21 13:59:17 +01:00
Swati Sehgal
c2e1fdeb7a node: e2e: Ensure device plugin pod is Running/Ready before registration
In the device plugin node reboot e2e test, the registration trigger
(control file deletion) was being executed immediately after pod creation.
This could create a race condition: the device plugin container might not
be fully running, causing the test to flake when devices were not reported
as available on the node.

This change explicitly waits for the sample device plugin pod to reach the
Running/Ready state before deleting the registration control file. This
ensures that the device plugin is ready to register its devices with the
kubelet, eliminating a possible source of test flakiness.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-10-21 13:41:30 +01:00
Kubernetes Prow Robot
031f4d541a Merge pull request #133072 from AadiDev005/fix-sidecar-startup-probe
Fix startup probe worker termination for sidecar containers
2025-10-20 12:26:37 -07:00
Kubernetes Prow Robot
e34f01402f Merge pull request #134703 from pohly/e2e-fix-test-name-uniqueness
e2e: find and fix reuse of test names
2025-10-18 15:38:07 -07:00
eun2ce
d07b769418 Replace feature label with WithFeatureGate for KubeletPSI test
- Remove feature.KubeletPSI label as it may be redundant for categorization
- Add framework.WithFeatureGate(features.KubeletPSI) for proper feature gate checking
- Remove redundant utilfeature.DefaultFeatureGate.Enabled check in BeforeEach

This addresses the cleanup goal in issue #134172 to replace feature labels
with feature gates where appropriate.
2025-10-18 15:45:04 +09:00
Kubernetes Prow Robot
b067e45290 Merge pull request #134695 from kannon92/procmount-usernamespace
usernamespace and procmount are tightly coupled. Disable them together
2025-10-17 21:56:40 -07:00
Kubernetes Prow Robot
1f34c16772 Merge pull request #134690 from haircommander/gc-conformance
test: move kubelet GC tests to node conformance
2025-10-17 19:00:40 -07:00
Kubernetes Prow Robot
9dcfb3d04b Merge pull request #133373 from AkihiroSuda/carry-133278
[Carry 133278] kubelet: Don't ignore idsPerPod config #133278
2025-10-17 15:40:43 -07:00
Kevin Hannon
03c7962d17 usernamespace and procmount are tightly coupled. Disable them together 2025-10-17 16:40:45 -04:00
Patrick Ohly
d0a2a0d22e e2e: find and fix reuse of test names
This reports and fixes for test/e2e:

    ERROR: E2E suite initialization was faulty, these errors must be fixed:
    ERROR: apimachinery/mutatingadmissionpolicy.go:184: full test name is not unique: "[sig-api-machinery] MutatingAdmissionPolicy [Privileged:ClusterAdmin] [Feature:MutatingAdmissionPolicy] [FeatureGate:MutatingAdmissionPolicy] [Beta] [Feature:OffByDefault] should support MutatingAdmissionPolicy API operations" (/nvme/gopath/src/k8s.io/kubernetes/test/e2e/apimachinery/mutatingadmissionpolicy.go:184, /nvme/gopath/src/k8s.io/kubernetes/test/e2e/apimachinery/mutatingadmissionpolicy.go:606)
    ERROR: apimachinery/mutatingadmissionpolicy.go:412: full test name is not unique: "[sig-api-machinery] MutatingAdmissionPolicy [Privileged:ClusterAdmin] [Feature:MutatingAdmissionPolicy] [FeatureGate:MutatingAdmissionPolicy] [Beta] [Feature:OffByDefault] should support MutatingAdmissionPolicyBinding API operations" (/nvme/gopath/src/k8s.io/kubernetes/test/e2e/apimachinery/mutatingadmissionpolicy.go:412, /nvme/gopath/src/k8s.io/kubernetes/test/e2e/apimachinery/mutatingadmissionpolicy.go:834)
    ERROR: common/node/pod_level_resources.go:250: full test name is not unique: "[sig-node] Pod Level Resources [Serial] [Feature:PodLevelResources] [FeatureGate:PodLevelResources] [Beta] Guaranteed QoS pod with container resources" (/nvme/gopath/src/k8s.io/kubernetes/test/e2e/common/node/pod_level_resources.go:250 (2x))
    ERROR: dra/dra.go:1899: full test name is not unique: "[sig-node] [DRA] kubelet [Feature:DynamicResourceAllocation] [FeatureGate:DRAConsumableCapacity] [Alpha] [Feature:OffByDefault] [FeatureGate:DynamicResourceAllocation] must allow multiple allocations and consume capacity [KubeletMinVersion:1.34]" (/nvme/gopath/src/k8s.io/kubernetes/test/e2e/dra/dra.go:1899 (2x))
    ERROR: storage/testsuites/volume_group_snapshottable.go:173: full test name is not unique: "[sig-storage] CSI Volumes [Driver: csi-hostpath] [Testpattern:  (delete policy)] volumegroupsnapshottable [Feature:volumegroupsnapshot] VolumeGroupSnapshottable  should create snapshots for multiple volumes in a pod" (/nvme/gopath/src/k8s.io/kubernetes/test/e2e/storage/testsuites/volume_group_snapshottable.go:173 (2x))
    ERROR: storage/testsuites/volume_group_snapshottable.go:173: full test name is not unique: "[sig-storage] CSI Volumes [Driver: pd.csi.storage.gke.io] [Serial] [Testpattern:  (delete policy)] volumegroupsnapshottable [Feature:volumegroupsnapshot] VolumeGroupSnapshottable  should create snapshots for multiple volumes in a pod" (/nvme/gopath/src/k8s.io/kubernetes/test/e2e/storage/testsuites/volume_group_snapshottable.go:173 (2x))

And for test/e2e_node:

    ERROR: cpu_manager_test.go:1622: full test name is not unique: "[sig-node] CPU Manager [Serial] [Feature:CPUManager] when checking the CFS quota management should disable for guaranteed pod with exclusive CPUs assigned" (/nvme/gopath/src/k8s.io/kubernetes/test/e2e_node/cpu_manager_test.go:1622, /nvme/gopath/src/k8s.io/kubernetes/test/e2e_node/cpu_manager_test.go:1642)
    ERROR: eviction_test.go:800: full test name is not unique: "[sig-node] LocalStorageCapacityIsolationFSQuotaMonitoring [Slow] [Serial] [Disruptive] [Feature:LocalStorageCapacityIsolationQuota] [Feature:LSCIQuotaMonitoring] [Feature:UserNamespacesSupport] when we run containers that should cause use quotas for LSCI monitoring (quotas enabled: true)  should eventually evict all of the correct pods" (/nvme/gopath/src/k8s.io/kubernetes/test/e2e_node/eviction_test.go:800 (2x))
2025-10-17 20:19:52 +02:00
Peter Hunt
70a8babb09 test: move kubelet GC tests to node conformance
and drop the feature.GarbageCollect, as it's not needed anymore

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2025-10-17 13:32:46 -04:00
Rodrigo Campos
2a488616bf tests/e2e_node: Add test for userNamespaces.idsPerPod
Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-10-15 19:49:38 +09:00
Karthik Bhat
ebc4768ff3 Increase time out for verifying metrics 2025-10-09 15:22:16 +05:30
Kubernetes Prow Robot
da05e3ccc7 Merge pull request #134369 from rbiamru/add-nodeconformance-mirror-pod
test/e2e_node: mark MirrorPod update tests as [NodeConformance]
2025-10-06 11:21:08 -07:00
Kubernetes Prow Robot
f74a7458d9 Merge pull request #134173 from toVersus/test/deflake-sidecar-e2e
deflake e2e: ensure pod with sidecars restarts in correct order after node reboot
2025-10-06 11:21:00 -07:00
HirazawaUi
f9a893be37 Fix incorrect error messages 2025-10-06 00:42:21 +08:00
rbiamru
6e574cabdd test/e2e_node: mark MirrorPod update tests as [NodeConformance] 2025-10-01 21:54:21 -04:00
Ciprian Hacman
2b3f1877be Update NPD to v1.34.0 2025-09-27 19:57:47 +03:00
Tsubasa Nagasawa
bc7ea997a0 deflake e2e: ensure pod with sidecars restarts in correct order after node reboot
Signed-off-by: Tsubasa Nagasawa <toversus2357@gmail.com>
Co-authored-by: Hironori Shiina <shiina.hironori@gmail.com>
2025-09-24 07:36:56 +09:00
Kubernetes Prow Robot
faf249a3f0 Merge pull request #134166 from pohly/dra-e2e-node-registrar-cleanup
DRA E2E node: fix cleanup of tests using separate registrar
2025-09-20 01:58:12 -07:00
Patrick Ohly
343a5db965 DRA E2E node: fix cleanup of tests using separate registrar
8fed05c5b7 fixed the cleanup of tests which start
registrar and service in a single call. But tests which first started the
registrar and then the service separately still had the problem:

- registrar is started with test context
- pods remain running at end of test
- registrar stops because of test context cancellation
- pods remain pending despite deletion because the driver gets
  unregistered (timing dependent, so this may have flaked)

The fix is to also clean up the registrar after the test, in reverse startup
order.
2025-09-19 18:47:21 +02:00
Ed Bartosh
871f87eaec e2e_node: test DRA plugin gRPC connection reuse
Added e2e_node test to verify that the Kubelet establishes only
a single gRPC connection with the DRA plugin for all service calls
during the plugin lifecycle.
The test uses a custom listener to count accepted connections and
asserts that only one connection is used for NodePrepareResources,
NodeUnprepareResources, and NodeWatchResources calls.
2025-09-17 19:15:01 +03:00