143 Commits

Author SHA1 Message Date
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
HaoJie Liu
b058565f65 fix: add pod info to the error log
Signed-off-by: HaoJie Liu <liuhaojie@beyondcent.com>
2022-07-19 14:17:33 +08:00
Gunju Kim
eb4cd9ab4e Check taint/toleration before accepting pods, except for static pods 2022-02-10 19:39:26 +09:00
Kubernetes Prow Robot
0dcd6eaa0d Merge pull request #103934 from boenn/tainttoleration
De-duplicate predicate (known as filter now) logic shared in kubelet and scheduler
2022-02-09 16:53:46 -08:00
cyclinder
07999dac70 Clean up dockershim flags in the kubelet
Signed-off-by: cyclinder <qifeng.guo@daocloud.io>
Co-authored-by: Ciprian Hacman <ciprian@hakman.dev>
Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
2022-01-14 16:02:50 +02:00
boenn
cec2aae1e5 rebase master 2021-11-25 11:21:12 +08:00
ravisantoshgudimetla
889d45d3fb [kubelet] Reject pods with OS field mismatch
Once kubernetes#104613 and kubernetes#104693
merge, we'll have OS field in pod spec. Kubelet should start rejecting pods
where pod.Spec.OS and node's OS(using runtime.GOOS) won't match
2021-11-08 19:18:15 -05:00
ravisantoshgudimetla
21c5c2ec5c [kubelet][podadmission]: Validate and reject pods with mismatching labels 2021-11-05 18:47:43 -04:00
Tim Hockin
11a25bfeb6 De-share the Handler struct in core API (#105979)
* De-share the Handler struct in core API

An upcoming PR adds a handler that only applies on one of these paths.
Having fields that don't work seems bad.

This never should have been shared.  Lifecycle hooks are like a "write"
while probes are more like a "read". HTTPGet and TCPSocket don't really
make sense as lifecycle hooks (but I can't take that back). When we add
gRPC, it is EXPLICITLY a health check (defined by gRPC) not an arbitrary
RPC - so a probe makes sense but a hook does not.

In the future I can also see adding lifecycle hooks that don't make
sense as probes.  E.g. 'sleep' is a common lifecycle request. The only
option is `exec`, which requires having a sleep binary in your image.

* Run update scripts
2021-10-29 13:15:11 -07:00
Mike Dame
5a77ebe28b Scheduler: remove pkg/features dependency from NodeResources plugins 2021-05-18 08:59:02 -04:00
Kubernetes Prow Robot
9fc32e57fb Merge pull request #101364 from markusthoemmes/consistent-kubelet-log
Consistently use log.KObj to format pods in logs
2021-05-03 17:21:11 -07:00
Jan Chaloupka
7286f9712a pkg/scheduler: drop Resource.ResourceList() method
The method is used only for testing purposes. Given Resource data type
exposes all its fields, any invoker of ResourceList that is still
using the method outside of kubernetes/kubernetes can still either
copy paste the original implementation or implement a custom method
that's converting resources into proper Quantity data type.

Given the hugepage resource is a scalar resource, it's sufficient
the underlying code under fit_test.go to take into account any
extended resources. For predicate_test.go, the hugepage
resource does not play any role as the General predicates test cases
does not set any scaler resource at all.

Additionally, by removing ResourceList method, pkg/scheduler/framework
can get rid of dependency on k8s.io/kubernetes/pkg/apis/core/v1/helper.
2021-04-28 16:26:33 +02:00
Markus Thömmes
168b6cf8a1 Consistently use log.KObj to format pods in logs 2021-04-22 12:14:44 +02:00
Kubernetes Prow Robot
5779fec3c4 Merge pull request #99959 from AliceZhang2016/nodeaffinity-cleanup
Move nodeaffinity helpers to component-helpers package
2021-04-21 17:03:53 -07:00
Kubernetes Prow Robot
bebb932bdf Merge pull request #99479 from mengjiao-liu/migrate_to_structured_logs
Migrate `pkg/kubelet/lifecycle,oom` to structured logging
2021-03-11 17:28:33 -08:00
mengjiao.liu
e557f61784 Migrate pkg/kubelet/lifecycle,oom to structured logging
Co-authored-by: Elana Hashman <ehashman@users.noreply.github.com>
2021-03-11 13:36:48 +08:00
Mengxue Zhang
bdda9728e7 move nodeaffinity helpers to component-helpers package 2021-03-10 20:19:25 +00:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
Aldo Culquicondor
3ce145787a Add AddedAffinity to the NodeAffinityArgs
And use it in Filter and Score.

Change-Id: I173d8f2d5578762e9873181d5b44ea30b6dbbbc2
2020-11-09 15:19:15 -05:00