Commit Graph

1568 Commits

Author SHA1 Message Date
mansikulkarni96
b9f6013c12 fix: handle socket file detection on Windows
Cherry-picked 4060ee60c1
Update socket file detection logic to use os.Stat as per upstream
Go fix for golang/go#33357. This resolves
the issue where socket files could not be properly identified on
Windows systems.
2025-02-21 18:02:28 -05:00
Mark Rossetti
569eb41f23 fixing k8s.io/kubernetes/pkg/kubelet/cm/memorymanager unit tests on Windows
Signed-off-by: Mark Rossetti <marosset@microsoft.com>
2025-02-12 15:27:58 -08:00
Kubernetes Prow Robot
cd2959b798 Merge pull request #127525 from scott-grimes/patch-1
fix: pods meeting qualifications for static placement when cpu-manager-policy=static should not have cfs quota enforcement
2025-02-12 12:02:21 -08:00
Scott Grimes
1c5170ff52 disable cfs quota when exclusive cpus allocated per static cpu policy requirements 2025-02-11 13:42:30 -05:00
Kubernetes Prow Robot
39f1c90ac0 Merge pull request #129735 from swatisehgal/device-mgr-logs-improvements
Device Manager logging improvements
2025-02-07 07:11:56 -08:00
Kubernetes Prow Robot
20b12ad5c3 Merge pull request #129685 from swatisehgal/cpu-mgr-logs-improvements
CPU Manager logging improvements
2025-02-07 03:50:02 -08:00
Kubernetes Prow Robot
e094e5e89c Merge pull request #129684 from swatisehgal/mm-mgr-logs-improvements
Memory Manager logging improvements
2025-02-07 03:49:55 -08:00
Swati Sehgal
ecd67e2537 node: memory-mgr: Adhere to the message style guidelines
Ensure that the log messages adhere to the message style guildelines
as captured [here](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#message-style-guidelines).

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 18:53:08 +00:00
Swati Sehgal
f449697457 node: device-mgr: Adhere to the message style guidelines
Ensure that the log messages adhere to the message style guildelines
as captured [here](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#message-style-guidelines).

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 18:13:10 +00:00
Swati Sehgal
40c86d8e06 node: device-mgr: Ensure consistent use of named arguments
Throughout the devicemanager codebase the named argument to represent
resource for logging pupose is `resourceName` as opposed to `resource`.
The latter can only be seen in topology_hints.go files. To ensure consistency
with the rest of the codebase and also because we want to adhere to the
recommendations in the Kubernetes documentation about named arguments:
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments
we update the key from `resource` to `resourceName`.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 17:22:24 +00:00
Swati Sehgal
19e406a357 node: device-mgr: Update klog.Infof(..., err) to klog.ErrorS(err,...)
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 17:21:53 +00:00
Swati Sehgal
9cd041156f node: device-mgr: Add logs in the happy path
We have reasonable amount of logs when things go wrong.
While debugging, it can be useful to have logs to indicate that
things have gone as expected.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 17:21:53 +00:00
Swati Sehgal
a585bd74c4 node: device-mgr: Keep log level consistent across all gRPC calls
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 17:21:53 +00:00
Swati Sehgal
4b613ae96f node: device-mgr: Bump log level for expected skips
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 17:21:53 +00:00
Swati Sehgal
584e224b43 node: device-mgr: Add metadata to logs
Ensure that if possible, we provide sufficient metadata
inclusing pod name and UID to allow filtering by pod name or its
UID.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 17:21:49 +00:00
Swati Sehgal
a10b3c3555 node: memory-mgr: Add logs when memory allocation is skipped due to QoS
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 16:42:19 +00:00
Swati Sehgal
6240febf4c node:memory-mgr: Add logs on the happy path
We have reasonable amount of logs when things go wrong.
While debugging, it can be useful to have logs to indicate that
things have gone as expected especially when it comes to
important events like successful startup of memory manager
and successful allocation of resources.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 16:41:34 +00:00
Swati Sehgal
ee7f2616c6 node: memory-mgr: Update klog.Infof(..., err) to klog.ErrorS(err,...)
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 16:41:02 +00:00
Swati Sehgal
07d83acce5 node: memory-mgr: Update log levels and add logs to capture state update
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 16:41:02 +00:00
Swati Sehgal
34fd61a3ef node: memory-mgr: Add metadata to logs
Ensure that whereever possible, we provide sufficient metadata
inclusing pod name and UID to allow filtering by pod name or its
UID.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 16:40:56 +00:00
Swati Sehgal
7997c93cfd node: cpu-mgr: Adhere to the message style guidelines
Ensure that the log messages adhere to the message style guildelines
as captured [here](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#message-style-guidelines).

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 16:30:02 +00:00
Swati Sehgal
ca2c46a273 node: cpu-mgr: Add logs when CPU allocation is skipped
CPU Allocation is skipped in CPU Manager with static policy
in case the pod doesn't belong to Guaranteed QoS or the CPUs
requested are not integral.

We add logs to capture these skips.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 16:26:40 +00:00
Swati Sehgal
01a546fe53 node: cpu-mgr: Add logs on the happy path
While debugging, it can be useful to have logs to indicate that
things have gone as expected especially when it comes to
important events like successful startup of CPU manager
and successful allocation of resources.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-02-06 16:25:07 +00:00
Kubernetes Prow Robot
72d74869e9 Merge pull request #129114 from bart0sh/PR167-fix-DRA-registration-test
kubelet: fix DRA registration test
2025-02-05 14:38:26 -08:00
Kubernetes Prow Robot
0634e21fb5 Merge pull request #128367 from vivzbansal/sidecar-2
[FG:InPlacePodVerticalScaling] Implement resize for sidecar containers
2025-02-05 14:38:15 -08:00
Francesco Romani
e766b04ade node: cm: use maps.Clone instead of reinvent it
As pointed out in https://github.com/kubernetes/kubernetes/pull/128657#discussion_r1832973928

Signed-off-by: Francesco Romani <fromani@redhat.com>
2025-01-30 14:45:04 +01:00
vivzbansal
d1fac494f4 resolve merge conflicts 2025-01-27 19:42:13 +00:00
Kubernetes Prow Robot
28ad751946 Merge pull request #128727 from Tal-or/memorymanager_cleanup
memmanager:cleanup: drop `Experimental` prefix
2025-01-23 14:15:20 -08:00
Swati Sehgal
c56426bd9f node: device-mgr: Update klog.Infof(..., err) to klog.ErrorS(err,...)
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-01-21 16:21:16 +00:00
Swati Sehgal
f8596d6d28 node: device-mgr: Change ErrorS(nil, ...) to InfoS
Ensure consistency across resource managers and update
ErrorS(nil, ...) to InfoS. Similar changes have been
proposed in CPU Manager and Memory Manager.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-01-21 16:21:09 +00:00
Swati Sehgal
110868691b node: cpu-mgr: Update klog.Infof(..., err) to klog.ErrorS(err,...)
We are trying to ensure consistency across resource managers when
it comes to logging. While working on logging improvements for
memory manager, it was identified that some parts of code base
is still using klog.InfoS(..., err) instead of klog.ErrorS(err,...).
This change is addressing this in CPU Manager.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-01-17 10:06:19 +00:00
Swati Sehgal
1714fbfa75 node: memory-mgr: Change ErrorS(nil, ...) to InfoS
Ensure consistency across resource managers and update
ErrorS(nil, ...) to InfoS.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-01-16 08:32:42 +00:00
Francesco Romani
8221e28e4d Add ffromani as approver for kubelet resource managers and their tests
Signed-off-by: Francesco Romani <fromani@redhat.com>
2025-01-14 13:18:40 +01:00
Ed Bartosh
804f8c7584 kubelet: fix DRA registration test
Set expected slice fields in the reactor function instead of
test cleanup instead of doing it in the test cleanup.

This should fix the test failure caused by kubelet calling reactor function
before the test cleanup sets the deleteCollectionForDriver variable.
2024-12-09 20:58:47 +02:00
Patrick Ohly
8a908e0c0b remove import doc comments
The "// import <path>" comment has been superseded by Go modules.
We don't have to remove them, but doing so has some advantages:

- They are used inconsistently, which is confusing.
- We can then also remove the (currently broken) hack/update-vanity-imports.sh.
- Last but not least, it would be a first step towards avoiding the k8s.io domain.

This commit was generated with
   sed -i -e 's;^package \(.*\) // import.*;package \1;' $(git grep -l '^package.*// import' | grep -v 'vendor/')

Everything was included, except for
   package labels // import k8s.io/kubernetes/pkg/util/labels
because that package is marked as "read-only".
2024-12-02 16:59:34 +01:00
Tim Allclair
8342d39956 Equate CPU limits below the minimum effective limit (10m) 2024-11-12 17:23:17 -08:00
Talor Itzhak
dc258e65ac memmanager:cleanup: drop Experimental prefix
Since MemoryManager goes GA, we should drop the
`Experimental` prefix from the its fields.

Signed-off-by: Talor Itzhak <titzhak@redhat.com>
2024-11-12 09:45:17 +02:00
Tim Allclair
9df464fee7 Generate ContainerManager mocks 2024-11-11 12:04:36 -08:00
Kubernetes Prow Robot
c25f5eefe4 Merge pull request #128407 from ndixita/pod-level-resources
[PodLevelResources] Pod Level Resources Feature Alpha
2024-11-08 07:10:50 +00:00
ndixita
5ea57fb3b4 cgroup configuration changes:
1. Pod cgrooup configured to use resources from pod spec if feature is enabled and resources are set at pod-level
2. Container cgroup limits defaulted to pod-level limits is container limits are not set
2024-11-08 03:00:54 +00:00
Kubernetes Prow Robot
210f129bb0 Merge pull request #128676 from vivzbansal/sidecar-3
Refactor: Move IsRestartableInitContainer to common utility package
2024-11-08 02:21:50 +00:00
Mark Rossetti
3c9380c449 Memory manager support for Windows nodes (#128560) 2024-11-07 23:32:49 +00:00
vivzbansal
763e810fb5 refactor code to add sidecar container support in IPPR 2024-11-07 21:20:48 +00:00
Kubernetes Prow Robot
847be85000 Merge pull request #128657 from ffromani/unshare-containermap-among-managers
node: cm: don't share containerMap instances between managers
2024-11-07 19:45:20 +00:00
Francesco Romani
2a99bfc3d1 node: cm: don't share containerMap instances between managers
Since the GA graduation of memory manager in https://github.com/kubernetes/kubernetes/pull/128517
we are sharing the initial container map across managers.

The intention of this sharing was not to actually share a data
structure, but
1. save the relatively expensive relisting from runtime
2. have all the managers share a consistent view - even though the
   chance for misalignement tend to be tiny.

The unwanted side effect though is now all the managers race
to modify a data shared, not thread safe data structure.

The fix is to clone (deepcopy) the computed map when passing it
to each manager. This restores the old semantic of the code.

This issue brings the topic of possibly managers go out of sync
since each of them maintain a private view of the world.
This risk is real, yet this is how the code worked for
most of the lifetime, so the plan is to look at this and evaluate
possible improvements later on.

Signed-off-by: Francesco Romani <fromani@redhat.com>
2024-11-07 16:02:55 +01:00
Kubernetes Prow Robot
33c64b380a Merge pull request #128646 from pohly/dra-kubelet-separate-beta-api
DRA kubelet: separate beta and alpha gRPC APIs
2024-11-07 14:57:45 +00:00
Sergey Kanzhelev
631c5f9c82 call cancel on plugin that is replaced by another plugin with the same name 2024-11-07 07:36:25 +00:00
Patrick Ohly
9261a182bb DRA kubelet: separate beta and alpha gRPC APIs
Reusing types from the alpha in the beta made it possible to provide and use
both versions without conversion. The downside was that removal of the alpha
would have been harder, if not impossible. DRA drivers could continue to
use the alpha types and provided the beta interface automatically.

Now the two versions are completely separate gRPC APIs, although in practice
there are no differences besides the name. Support for the alpha API in kubelet
is provided via automatically generated conversion and manually written
interface wrappers.

Those are provided as part of the v1alpha4 package. The advantage of having all
of that in a central place is that it'll be easier to remove when no longer
needed.
2024-11-07 07:42:40 +01:00
Kubernetes Prow Robot
e273349f3a Merge pull request #127511 from pohly/dra-1.32-api
DRA 1.32 API: promotion to beta
2024-11-06 13:13:29 +00:00
Patrick Ohly
a1b8e9d3a7 DRA kubelet: increase plugin test coverage
Deleting slices was not covered to begin with and the recent registration
changes also could have been covered better. Now coverage is at 91%.
2024-11-06 13:03:20 +01:00