Commit Graph

161 Commits

Author SHA1 Message Date
yliao
e02f0e2ba5 added unit test case to ensure implicit DRA extended resource is handled properly during pod admission at kubelet 2026-01-10 16:57:08 +00:00
Ed Bartosh
882cd02253 test: Add extended resource handling test coverage
Add unit test cases for extended resource handling in kubelet lifecycle
predicates and scheduler admission checks for resources backed up by
DRA and Device plugins.
2026-01-02 16:08:57 +02:00
Ed Bartosh
c2361491f5 Fix extended resource handling for DRA-backed resources
In kubelet admission:
   - Remove extended resources from pod requirements if they are either
     backed by DRA or not present in node's allocatable resources

In scheduler (fit.go):
   - Remove fallback logic that delegated all resources to DRA when
     draManager is nil

These changes ensure that:
- DRA-backed extended resources are properly handled during pod admission
- DevicePlugin-backed extended resources still follow standard admission rules
2026-01-02 16:08:49 +02:00
Patrick Ohly
ad79e479c2 build: remove deprecated '// +build' tag
This has been replaced by `//build:...` for a long time now.

Removal of the old build tag was automated with:

    for i in $(git grep -l '^// +build' | grep -v -e '^vendor/'); do if ! grep -q '^// Code generated' "$i"; then sed -i -e '/^\/\/ +build/d' "$i"; fi; done
2025-12-18 12:16:21 +01:00
Heba
aceb89debc KEP-5471: Extend tolerations operators (#134665)
* Add numeric operations to tolerations

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* code review feedback

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* add default feature gate

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* Add integration tests

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* Add toleration value validation

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* Add validate options for new operators

Signed-off-by: helayoty <heelayot@microsoft.com>

* Remove log

Signed-off-by: helayoty <heelayot@microsoft.com>

* Update feature gate check

Signed-off-by: helayoty <heelayot@microsoft.com>

* emove IsValidNumericString func

Signed-off-by: helayoty <heelayot@microsoft.com>

* Implement IsDecimalInteger

Signed-off-by: helayoty <heelayot@microsoft.com>

* code review feedback

Signed-off-by: helayoty <heelayot@microsoft.com>

* Add logs to v1/toleration

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
Signed-off-by: helayoty <heelayot@microsoft.com>

* Update integration tests and address code review feedback

Signed-off-by: helayoty <heelayot@microsoft.com>

* Add feature gate to the scheduler framework

Signed-off-by: helayoty <heelayot@microsoft.com>

* Remove extra test

Signed-off-by: helayoty <heelayot@microsoft.com>

* Fix integration test

Signed-off-by: helayoty <heelayot@microsoft.com>

* pass feature gate via TolerationsTolerateTaint

Signed-off-by: helayoty <heelayot@microsoft.com>

---------

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
Signed-off-by: helayoty <heelayot@microsoft.com>
2025-11-10 12:42:54 -08:00
Praveen Krishna
c30b75b008 feat: Implement node declared features reporting and validation.
* Reports node declared features in Node.Status.DeclaredFeatures.
* Add kubelet admission handler to check pod required features and match with node declared features on pod creation.
* Checks node declared features on pod updates and emits events if the node does not
  satisfy the pod's feature requirements.
* Adds API validation for node object.
2025-11-06 00:51:39 +00:00
Kubernetes Prow Robot
c5ef945f37 Merge pull request #134445 from natasha41575/kubelet_node_cache
kubelet: synchronously fetch node and retry on NodeAffinity admission errors
2025-11-04 12:52:04 -08:00
Natasha Sarkar
5cdb983c2e fetch node synchronously on node affinity failure 2025-11-04 16:24:14 +00:00
Tim Allclair
8fc9921294 Delete dead code 2025-10-21 20:49:42 -07:00
yliao
34a64db2c7 extended resource backed by DRA: implementation 2025-07-29 18:55:21 +00:00
Kubernetes Prow Robot
9adc49ffd4 Merge pull request #133046 from toVersus/reject-windows-in-api-server
[PodLevelResources] Add validation for Windows OS
2025-07-23 19:56:33 -07:00
Anna Song
c2b26617be Check OS for PodLevelResources in kubelet
Reject pods with PodLevelResources running on Windows nodes
at kubelet admission phase
2025-07-23 07:08:21 +09:00
zhangzhifei16
911df655d3 chore: migrate kubelet lifecycle to contextual logging. 2025-07-22 10:14:42 +08:00
Kubernetes Prow Robot
ade9b7746a Merge pull request #132595 from AxeZhan/ga3960
Graduate PodLifecycleSleepAction to GA
2025-07-19 13:22:39 -07:00
Ed Bartosh
4bc2ad6eea migrate pkg/kubelet/preemption to contextual logging 2025-07-17 10:16:03 +03:00
AxeZhan
dcbed2fbdc Graduate PodLifecycleSleepAction to GA 2025-07-02 09:37:14 +08:00
Shingo Omura
c6d6e0414c KEP-3619: rename variable in TestPodAdmissionBasedOnSupplementalGroupsPolicy 2025-03-20 13:46:04 +09:00
Shingo Omura
2a0e51825b KEP-3619: kubelet now rejects Pods with SupplementalGroupsPolicy=Strict on Nodes not supported this feature. 2025-03-20 13:45:22 +09:00
Gunju Kim
0bee0bcaa7 Promote SidecarContainers feature to GA 2025-02-02 17:45:36 +09: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
vivzbansal
763e810fb5 refactor code to add sidecar container support in IPPR 2024-11-07 21:20:48 +00:00
Kevin Hannon
350b0d2b93 Revert "Graduate PodLifecycleSleepAction to GA" 2024-11-06 16:29:19 -05:00
Anish Shah
d4f05fdda5 Introduce a metric to track kubelet admission failure. 2024-11-06 00:07:17 -08:00
AxeZhan
200a61b6b9 Graduate PodLifecycleSleepAction to GA 2024-11-02 11:05:36 +08:00
Kubernetes Prow Robot
ec8015daac Merge pull request #124273 from panoswoo/fix/124255
Remove missing extended resources from init containers
2024-07-19 15:29:53 -07:00
Ahmet Alp Balkan
4d3f5cdc82 kubelet: Add description for failed predicate Events
**Problem:** When a Pod fails to run due to kubelet-side admission checks, the
v1.Event objects emitted looks like these:

    Reason="NodeAffinity" Message="Predicate NodeAffinity failed"
    Reason="NodeName" Message="Predicate NodeName failed"
    Reason="NodePorts" Message="Predicate NodePorts failed"

**Solution:** Expose human-readable predicate description in the failure
so that kubelet submits an Event with this description, such as:

    Reason="NodeAffinity" Message="Predicate NodeAffinity failed: node(s) didn't match Pod's node affinity/selector"
    Reason="NodeName" Message="Predicate NodeName failed: node(s) didn't match the requested node name"
    Reason="NodePorts" Message="Predicate NodePorts failed: node(s) didn't have free ports for the requested pod ports"
2024-06-13 15:12:56 -07:00
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00
Panos Woo
fbb975b147 Remove missing extended resources from init containers
Signed-off-by: Panos Woo <panoswoo@outlook.com>
2024-04-12 14:14:18 +00:00
Tim Hockin
467d5d745c Get rid of unused API type NodeResources 2024-03-01 15:13:50 -08:00
AxeZhan
c74ec3df09 graduate PodLifecycleSleepAction to beta 2024-02-19 19:40:52 +08:00
carlory
55c5db172e lock GA feature-gate ConsistentHTTPGetHandlers to default 2024-01-04 15:12:08 +08:00
Kubernetes Prow Robot
39697a9f3b Merge pull request #120782 from PI-Victor/fix/refactor_port_resolver_test
kubelet/lifecycle handlers: refactor port resolver
2023-10-19 04:03:26 +02:00
Kubernetes Prow Robot
3cb3e8b7dc Merge pull request #116892 from SataQiu/fix-kubelet-20230323
kubelet: perform the admission checks that preemption will not help first to avoid meaningless pod eviction
2023-10-19 02:47:50 +02:00
AxeZhan
3a96afdfef implementation 2023-10-15 13:57:48 +08:00
Victor Palade
ed76c371df kubelet/lifecycle handlers: refactor port resolver
Changes the three test cases for port resolver test to a table test
instead.

Signed-off-by: Victor Palade <victor@cloudflavor.io>
2023-09-20 20:25:17 +02:00
git-jxj
a5b3a4b738 cleanup: Update deprecated FromInt to FromInt32 (#119858)
* redo commit

* apply suggestions from liggitt

* update Parse function based on suggestions
2023-08-16 09:33:01 -07:00
Gunju Kim
b94fa250c2 Sidecar: Implement lifecycle of the restartable init container
- Implement `computeInitContainerActions` to sets the actions for the
  init containers, including those with `RestartPolicyAlways`.
- Allow StartupProbe on the restartable init containers.
- Update PodPhase considering the restartable init containers.
- Update PodInitialized status and status manager considering the
  restartable init containers.

Co-authored-by: Matthias Bertschy <matthias.bertschy@gmail.com>
2023-07-08 07:26:12 +09:00
Stephen Kitt
0ee9f1b7a7 kubelet: replace intstr.FromInt with intstr.FromInt32
This touches cases where FromInt() is used on numeric constants, or
values which are already int32s, or int variables which are defined
close by and can be changed to int32s with little impact.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-05-01 09:17:35 +02:00
SataQiu
18c86efeea kubelet: perform the admission checks that preemption will not help first to avoid meaningless pod eviction 2023-03-23 23:45:19 +08:00
Jordan Liggitt
78cb3862f1 Fix indentation/spacing in comments to render correctly in godoc 2022-12-17 23:27:38 -05:00
David Ashpole
64af1adace Second attempt: Plumb context to Kubelet CRI calls (#113591)
* plumb context from CRI calls through kubelet

* clean up extra timeouts

* try fixing incorrectly cancelled context
2022-11-05 06:02:13 -07:00
Antonio Ojea
9c2b333925 Revert "plumb context from CRI calls through kubelet"
This reverts commit f43b4f1b95.
2022-11-02 13:37:23 +00:00
David Ashpole
f43b4f1b95 plumb context from CRI calls through kubelet 2022-10-28 02:55:28 +00:00
Jordan Liggitt
a5d785fae8 Record metric for lifecycle fallback to http 2022-10-19 14:45:25 -04:00
Jordan Liggitt
122b43037e Record event for lifecycle fallback to http 2022-10-19 14:11:36 -04:00
Billie Cleek
dfaaa144ab fallback to http when lifecycle handler request should have been https 2022-10-19 09:51:52 -07:00
Jason Simmons
5a6acf85fa Align lifecycle handlers and probes
Align the behavior of HTTP-based lifecycle handlers and HTTP-based
probers, converging on the probers implementation. This fixes multiple
deficiencies in the current implementation of lifecycle handlers
surrounding what functionality is available.

The functionality is gated by the features.ConsistentHTTPGetHandlers feature gate.
2022-10-19 09:51:52 -07:00
inosato
3b95d3b076 Remove ioutil in kubelet and its tests
Signed-off-by: inosato <si17_21@yahoo.co.jp>
2022-07-30 12:35:26 +09:00
Kubernetes Prow Robot
6a71632f65 Merge pull request #111239 from HecarimV/fix-22071914
fix: add pod info to the error log
2022-07-29 13:17:50 -07:00
Davanum Srinivas
a9593d634c Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00