1075 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
26045b2fab Merge pull request #132642 from yuanwang04/restart-rules
Implement container restart policy rules
2025-07-24 16:44:51 -07:00
Kubernetes Prow Robot
63011fe547 Merge pull request #132277 from KevinTMtz/pod-level-resources-eviction-manager
[PodLevelResources] Pod Level Resources Eviction Manager
2025-07-24 16:44:34 -07:00
Kevin Torres
13b122b6ff Unit tests for pod level resources eviction manager 2025-07-24 17:07:09 +00:00
Kevin Torres
9a3ca05f6b Use pod level resources for eviction manager 2025-07-24 17:07:05 +00:00
Yuan Wang
af595a44ae Add container restart rules to API 2025-07-24 16:49:52 +00:00
Natasha Sarkar
8996e81fc8 fix unit tests 2025-07-21 16:46:07 +00:00
Tsubasa Nagasawa
0ad351281b Cleanup duplicate function to get port number from named port
Currently, the function to translate named port to port number is
located in two places (pod utils and endpointslice lib).
When fixing the bug in restartable init containers, one part of the code
was fixed, but the other part was not, leaving the bug unresolved.
To prevent such partial fixes in the future, we will make the function
in the endpointslice lib public and remove the other part of the code
from pod utils. Then consume the endpointslice lib in k/k.

Signed-off-by: Tsubasa Nagasawa <toversus2357@gmail.com>
2025-07-05 10:03:30 +09:00
Natasha Sarkar
7d85134cae improve unit test coverage for pod observedGeneration 2025-06-25 17:18:07 +00:00
Filip Křepinský
bdfa8839be calculateStatus should use the same now time point for each pod
make IsPodAvailable time check inclusive
2025-06-14 18:39:15 +02:00
Kubernetes Prow Robot
b587977f7c Merge pull request #131445 from natasha41575/renameObservedGenHelperFns
update godoc for and rename observedGeneration helpers
2025-05-14 11:39:19 -07:00
Natasha Sarkar
92359cdc69 update godoc for and rename observedGeneration helpers 2025-04-24 16:05:01 +00:00
Tim Allclair
5928fc0e60 Add ContainerIter utility for ranging over pod containers 2025-04-11 13:36:37 -07:00
Natasha Sarkar
4c2be4bdde kubelet sets observedGeneration in conditions 2025-03-18 15:43:24 +00:00
Natasha Sarkar
af9ac325b1 controller sets observedGeneration on pod conditions 2025-03-10 16:37:55 +00:00
Natasha Sarkar
40e7d88f02 Kubelet sets pod.status.observedGeneration behind FG 2025-03-06 22:31:04 +00:00
vivzbansal
cf8ee421f1 Updated the comment of IsRestartableInitContainer(...) 2024-11-07 22:14:22 +00:00
vivzbansal
763e810fb5 refactor code to add sidecar container support in IPPR 2024-11-07 21:20:48 +00:00
AxeZhan
2ffb568540 rename functions 2024-10-25 12:53:24 +08:00
AxeZhan
9fe847482d move functions 2024-10-25 10:45:28 +08:00
joey
6bce72a794 fix eps named ports does not work in sidecar(initContainer with restartPolicy=Always)
Signed-off-by: joey <zchengjoey@gmail.com>
2024-10-11 17:53:17 +08:00
Kubernetes Prow Robot
f9a57ba82d Merge pull request #126760 from ncdc/ncdc/emeritus
Move ncdc to emeritus
2024-09-20 21:01:58 +01:00
Andy Goldstein
0e228be96f Use emeritus_*
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2024-08-22 17:48:27 -04:00
Andy Goldstein
3ab816dcab Move ncdc to emeritus
I am moving myself to emeritus as I am now firmly on the end-user side
of things.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2024-08-17 13:06:45 -04:00
Matthieu MOREL
2a7b71fe01 fix: enable testifylint on pkg/api 2024-07-19 22:40:33 +00:00
Kubernetes Prow Robot
745a364422 Merge pull request #120866 from bzsuni/cleanup/sets/api
use generic Set in api
2024-01-22 18:20:48 +01:00
Kubernetes Prow Robot
c73ab5162b Merge pull request #116507 from sourcelliu/podrequest
Improve performance of method PodRequests
2023-10-26 15:58:16 +02:00
bzsuni
aa9b2b1696 use generic Set in api
Signed-off-by: bzsuni <bingzhe.sun@daocloud.io>
2023-09-25 19:04:08 +08:00
Quan Tian
0fb1f59a88 Improve service unit test failure report
Mark the helper functions with t.Helper() so that if t.Errorf() in these
functions gets called, it will report that the failure occurred on the
line number of the caller of the helper, rather than the line number of
the helper itself, which makes it hard to identify which case causes the
failure.

Signed-off-by: Quan Tian <qtian@vmware.com>
2023-09-01 23:18:45 +08:00
Quan Tian
2b69daa960 Allow specifying ExternalTrafficPolicy for ClusterIP Services with ExternalIPs
When defining a ClusterIP Service, we can specify externalIP, and the
traffic policy of externalIP is subject to externalTrafficPolicy.
However, the policy can't be set when type is not NodePort or
LoadBalancer, and will default to Cluster when kube-proxy processes the
Service.

This commit updates the defaulting and validation of Service to allow
specifying ExternalTrafficPolicy for ClusterIP Services with
ExternalIPs.

Signed-off-by: Quan Tian <qtian@vmware.com>
2023-08-30 23:56:47 +08:00
Todd Neal
ea1eb7f8f7 implement sidecar resource calculation 2023-07-08 07:26:13 +09:00
Daniel Smith
1ffe3f467e lavalamp is taking a long break 2023-05-11 16:43:38 +00:00
Stephen Kitt
4911e9de4a api: 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:16:15 +02:00
Kubernetes Prow Robot
f5401624ee Merge pull request #117171 from brianpursley/kubectl-1110-tests
Add unit tests showing the effect of unlimited containers when calculating pod limits
2023-04-11 21:17:35 -07:00
Kubernetes Prow Robot
d0fc9d16ce Merge pull request #114800 from haoruan/feature-8976-spew-sprintf-refactor
Capture spew.Sprintf() with all our favorite config into a util func
2023-04-11 15:34:57 -07:00
Brian Pursley
b04ca79445 Add unit tests showing the effect of unlimited containers when calculating pod limits.
This behavior is surprising to some users (see kubectl issues #1110 and #1385), who expect that an unlimited container will result in an unlimited pod, but that is not how PodLimits() works, as it ignores any containers that do not specify limits when calculating the pod limits.

This commit adds unit tests that confirm this behavior.
2023-04-08 18:55:45 -04:00
Hao Ruan
f638e2849f replaced spew.Sprintf with a util pretty print function 2023-03-27 09:24:22 +08:00
mantuliu
08a69d6341 Improve performance of method PodRequests
Signed-off-by: mantuliu <240951888@qq.com>
2023-03-12 16:29:56 +08:00
vinay kulkarni
d011cc4d87 Fix up after rebasing on top of dedup pod resource req calculation PR 2023-03-10 15:21:56 +00:00
Todd Neal
4096c9209c dedupe pod resource request calculation 2023-03-09 17:15:53 -06:00
Vinay Kulkarni
76962b0fa7 In-place Pod Vertical Scaling - API changes
1. Define ContainerResizePolicy and add it to Container struct.
 2. Add ResourcesAllocated and Resources fields to ContainerStatus struct.
 3. Define ResourcesResizeStatus and add it to PodStatus struct.
 4. Add InPlacePodVerticalScaling feature gate and drop disabled fields.
 5. ResizePolicy validation & defaulting and Resources mutability for CPU/Memory.
 6. Various fixes from code review feedback (originally committed on Apr 12, 2022)
KEP: /enhancements/keps/sig-node/1287-in-place-update-pod-resources
2023-02-24 17:18:04 +00:00
Tim Hockin
d0e2b06850 ServiceExternalTrafficPolicyType: s/Type//
Rename ServiceExternalTrafficPolicyType => ServiceExternalTrafficPolicy
2022-12-11 13:48:27 -08:00
Dipankar Das
54ddcdce21 Code Refactoring of Pod under pkg/api (#112085)
* Code Refactoring

- added some function comments
- spelling errors

Signed-off-by: Dipankar Das <dipankardas0115@gmail.com>

* Some typo fix in resource under pkg/api/v1

Signed-off-by: Dipankar Das <dipankardas0115@gmail.com>

* Grammer corrections in api/v1/pod

Signed-off-by: Dipankar Das <dipankardas0115@gmail.com>

* Function description changes in pkg/api/v1

- pod
- resource

Signed-off-by: Dipankar Das <dipankardas0115@gmail.com>

Signed-off-by: Dipankar Das <dipankardas0115@gmail.com>
2022-09-26 09:20:08 -07:00
Sergey Kanzhelev
ad7199a9da remove podOverhead feature gate as a feature is now GA since 1.24 2022-09-19 19:25:16 +00:00
jinxu
0064010cdd Promote Local storage capacity isolation feature to GA
This change is to promote local storage capacity isolation feature to GA

At the same time, to allow rootless system disable this feature due to
unable to get root fs, this change introduced a new kubelet config
"localStorageCapacityIsolation". By default it is set to true. For
rootless systems, they can set this configuration to false to disable
the feature. Once it is set, user cannot set ephemeral-storage
request/limit because capacity and allocatable will not be set.

Change-Id: I48a52e737c6a09e9131454db6ad31247b56c000a
2022-08-02 23:45:48 -07:00
Lee Verberne
d238e67ba6 Remove EphemeralContainers feature-gate checks 2022-07-26 02:55:30 +02:00
0xff-dev
729bd22e24 clean up unused function 'GetServiceHealthCheckPathPort' 2022-07-06 16:15:14 +08:00
21kyu
df168d5b5c Change reflect.Ptr to reflect.Pointer 2022-06-26 01:23:43 +09:00
David Porter
7811d84fef kubelet: Mark ready condition as false explicitly for terminal pods
Terminal pods may continue to report a ready condition of true because
there is a delay in reconciling the ready condition of the containers
from the runtime with the pod status. It should be invalid for kubelet
to report a terminal phase with a true ready condition. To fix the
issue, explicitly override the ready condition to false for terminal
pods during status updates.

Signed-off-by: David Porter <david@porter.me>
2022-06-08 16:19:16 -07:00
Antonio Ojea
d16d23e0c7 add pod util to verify pod is terminal
pods on phase succeeded or failed are guaranteed to have all containers
stopped and to not ever regress
2022-05-27 06:42:39 +02:00
Humble Chirammal
c74b393771 csi: add nodeExpandSecret support for CSI client
CSI spec 1.5 enhanced the spec to add optional secrets field to
NodeExpandVolumeRequest. This commit adds NodeExpandSecret to the
CSI PV source and also derive the expansion secret in csiclient to
send it out as part of the nodeexpand request.

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
Signed-off-by: zhucan <zhucan.k8s@gmail.com>
2022-04-05 11:36:23 +08:00