Commit graph

1631 commits

Author SHA1 Message Date
Yashasvi Misra
87e157cce8 top command documentation enhancement (#136825)
* top command documentation enhancement

* Added FAQ details

Kubernetes-commit: 1132a4e4efd80d50b9ef17e1ec479c2d73979f25
2026-03-19 20:03:52 +00:00
Carlos Eduardo Arango Gutierrez
767a91111a kubectl: Add ResourceSlices to describe node with O(1) query
Add a Node-Exclusive ResourceSlices section to `kubectl describe node`
that displays DRA ResourceSlices assigned exclusively to the node.

Key design decisions per reviewer feedback:

1. Uses indexed field selector (spec.nodeName) for O(1) query performance
   instead of fetching all slices cluster-wide. This is critical for
   large clusters with thousands of ResourceSlices.

2. Shows only node-exclusive slices (where spec.NodeName == thisNode).
   Does NOT show AllNodes, NodeSelector, or PerDeviceNodeSelection slices
   as these could number in the thousands and aren't node-specific.

3. Aggregates by driver/pool instead of listing individual slices:
   - Shows: Driver, Pool, Slices count, Devices count
   - More concise and useful output

4. Caps output at 10 pools with "...and X more pools" message,
   following the existing formatEndpointSlices pattern.

Example output:
  Node-Exclusive ResourceSlices:
    Driver              Pool        Slices  Devices
    ------              ----        ------  -------
    nvidia.com/gpu      gpu-pool    2       8
    intel.com/qat       qat-pool    1       4

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>

Kubernetes-commit: 4c4014304202b0721509c2ec129035884bcd3770
2026-02-04 12:47:29 +01:00
Predrag Knezevic
c04eeb90aa kubectl explain: render externalDocs from OpenAPI v3 schemas
CRD authors can set the externalDocs field in their [OpenAPI v3
schemas](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/)
 to reference external documentation for their custom resources. However, kubectl explain
did not surface this information to users.

Render externalDocs metadata in the plaintext output of kubectl
explain. When a schema or field includes an externalDocs section, it
is now displayed as:

```
    EXTERNAL DOCS:
        <description>
        URL: <url>
```

This appears after the DESCRIPTION block for top-level resources and
after the field description for individual fields. The section is
omitted in short mode and when externalDocs is absent.

Kubernetes-commit: 7d855871267a3a9698af2862c79ebb7d4d2ec308
2026-02-11 13:01:38 +01:00
Davanum Srinivas
e67d906fc9 kubectl/drain: widen namespace termination retry timeout
TestEvictDuringNamespaceTerminating intentionally exercises the retry path
but only allows 10ms of total time. The production loop sleeps, refreshes
state, and retries under that same deadline, so a single retry plus
scheduler jitter is enough to exhaust the budget under -race or on busy
CI workers.

Keep the retry interval small so the test still covers the retry behavior,
but widen the overall timeout so the assertion measures semantics instead
of machine speed.

Tested:
go test -race ./staging/src/k8s.io/kubectl/pkg/drain -run TestEvictDuringNamespaceTerminating -count=100

Kubernetes-commit: 77f8d7c2a9571dd9a76ee1be8b234a4dddd2ad35
2026-03-14 10:11:26 -04:00
ndixita
4765ab4034 Setting UseStatusResources when fetching total pod requests and limits
Kubernetes-commit: 97f00d18eebca2ee3f69531db3142177b981f240
2026-03-12 22:32:43 +00:00
Konrad Kaim
0baa87b5bf feat: extract resource under describe to a separate variable
Kubernetes-commit: 93755d411b324db8f1f2b35e8132dc7f6330d35a
2026-03-13 09:03:33 +00:00
Davanum Srinivas
30e6509a72 staging: extract CRI streaming modules with client-go compatibility
Extract streaming code into dedicated staging modules while keeping stable
compatibility APIs for external client-go consumers.

This commit:
- adds `k8s.io/cri-streaming` for CRI exec/attach/portforward server code
- adds `k8s.io/streaming` as the canonical home for shared transport
  primitives (`httpstream`, `spdy`, `wsstream`, runtime helpers)
- switches in-tree transport consumers to `k8s.io/streaming`
- removes in-tree kubelet CRI streaming package
- preserves NO_PROXY/no_proxy CIDR handling in extracted SPDY proxier logic
- adds deprecated `k8s.io/apimachinery/pkg/util/httpstream` compatibility
  wrappers (`httpstream`, `spdy`, `wsstream`) backed by `k8s.io/streaming`
- restores exported client-go SPDY/portforward API signatures to
  apimachinery `httpstream` types for downstream compatibility
- adds streaming-native client-go adapters/constructors so in-tree callers
  can use `k8s.io/streaming` without changing external compatibility APIs
- deduplicates SPDY-over-websocket dial negotiation shared by compat and
  streaming tunneling dialers
- logs dropped unknown stream types in `RemoveStreams` adapter fallbacks to
  improve compatibility-path debuggability
- adds integration coverage for the streaming-upgrader-to-client-go-compat
  adapter path against a real cri-streaming exec endpoint
- clarifies kubectl streaming import aliasing to avoid `httpstream` package
  ambiguity
- updates tests, import restrictions, publishing metadata, and vendor/module
  metadata for the new staging modules

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 1ee1ff97fb7f9755a44d29bee0c80d2ccbed68dc
2026-02-28 19:40:07 -05:00
Brian Pursley
b7be88fba8 Check wait condition type cast to avoid potential panic
Kubernetes-commit: 37257404a56bfe609b43d9969933a2d9d478a5d7
2026-03-05 18:41:52 -05:00
Peter Engelbert
cce0d1aef0 Add credential pluginkubectl kuberc set options (#137300)
* Add <...> kuberc set --section=credentialplugin

The requirement that the `--command` option be provided is no longer
valid; a solution will need to be found.

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

* Remove required mark on `--command` flag

Move the validation logic to the Validate() function

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

* Remove requirement for `--command`

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

* Add cmd test cases for kuberc

- Verify all error messages added/changed by this PR
- Verify changes are effected by at least one valid `kubectl kuberc
  set` invocation with --section=credentialplugin

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

* Add unit tests for --section=credentialplugin

Additionally:
- Update allowlist-entry validation logic to check for empty string in
  value of k/v pairs
- Update kuberc cmd test with this case as well

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

* Address linter complaints

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

* Update staging/src/k8s.io/kubectl/pkg/cmd/kuberc/set.go

Co-authored-by: Maciej Szulik <soltysh@gmail.com>

* Add two new test cases

Additionally:
- update error message when policy is invalid
- use utilerrors.NewAggregate instead of custom code
- add --section=credentialplugin example to cli help
- fix copypasted doc comments
- use more descriptive variable names in for loops
- avoid confusion due to variable shadowing
- fix capitalization typo
- check both validate and run errors in credentialplugin tests

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

* Improve cli help for policy flag

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

---------

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
Co-authored-by: Maciej Szulik <soltysh@gmail.com>

Kubernetes-commit: b4220f8b08949c115258abed0398512bf54ffc48
2026-03-12 13:19:41 -04:00
Rodrigo Campos
79ce958f42 staging/testdata: Remove UserNamespacesSupport reference
This is just a sed to remove the old data from the text fixtures too.

While two files are clearly test data given that they include testdata
in their name, these two is not so obvious but are also test data:

	* openapi/swagger-with-shared-parameters.json: is referenced in "staging/src/k8s.io/cli-runtime/pkg/resource/query_param_verifier_test.go",
          in particular in this part: ´filepath.Join("..", "..", "artifacts", "openapi", "swagger-with-shared-parameters.json")´

	* batch.k8s.io_v1.json: is in
	  `staging/src/k8s.io/kubectl/pkg/explain/v2/templates/plaintext_test.go`,
          in a "//go:embed batch.k8s.io_v1.json".

Signed-off-by: Rodrigo Campos <rodrigo@amutable.com>

Kubernetes-commit: 8d0f80e4ed87658c0e05b9db0690927547be6ad5
2026-02-13 16:04:51 +01:00
Mark Liu
b902e43892 Skip events for multi-object kubectl describe
Default ShowEvents=false when describing multiple objects and
the user has not explicitly set --show-events. Single-object
describe unchanged. Applied in both Run() and
DescribeMatchingResources() using a value copy of
DescriberSettings.

Signed-off-by: Mark Liu <mark@prove.com.au>

Kubernetes-commit: 20696e1f896b4fb013248fdb919a55e6eea75eef
2026-02-20 08:45:54 +11:00
Paco Xu
7ee58d717a kubectl: only print default cotnainer if there are multi containers
Kubernetes-commit: ec58d1865dfb4bf4cd7fc66225a84085469aeeed
2026-03-10 13:08:31 +08:00
Antoni Zawodny
21c691a386 Create Workload API v1alpha2 (#136976)
* Drop WorkloadRef field and introduce SchedulingGroup field in Pod API

* Introduce v1alpha2 Workload and PodGroup APIs, drop v1alpha1 Workload API

Co-authored-by: yongruilin <yongrlin@outlook.com>

* Run hack/update-codegen.sh

* Adjust kube-scheduler code and integration tests to v1alpha2 API

* Drop v1alpha1 scheduling API group and run make update

---------

Co-authored-by: yongruilin <yongrlin@outlook.com>

Kubernetes-commit: 3f094dc228318b89f1fef313543b960e35ca6e3e
2026-03-10 05:43:54 +00:00
Nikhil
ad4e7654ea Remove deprecated PodRequestsAndLimits from kubectl/pkg/util/resource (#137442)
* Remove deprecated PodRequestsAndLimits from kubectl/pkg/util/resource

The PodRequestsAndLimits function was deprecated in favor of
k8s.io/component-helpers/resource.PodRequests and PodLimits,
which also support pod-level resources. There are no remaining
consumers in kubectl.

This removal includes the unexported helpers: podRequests,
podLimits, determineContainerReqs, max, addResourceList, and
maxResourceList.

* Remove test for deleted max helper function

Kubernetes-commit: e026a9482a167bec567f16f87efe9df4c09dbb06
2026-03-09 19:53:31 +05:30
Arda Güçlü
e85e61d17e Reflect expected replica count to the output of kubectl scale
Kubernetes-commit: ccd53e4eebb9e5b4daaaf7d125e4434517d887af
2026-02-11 15:12:44 +03:00
Mujib Ahasan
c2d82b2690 kubectl: add additional command suggestFor for describe and get
Signed-off-by: Mujib Ahasan <ahasanmujib8@gmail.com>

Kubernetes-commit: 3cd3f378610f0e56d75fdeae23a8141cc8934059
2026-03-08 02:49:37 +05:30
Mads Jensen
3a2bf51acc Lint: Activate modernize/forvar rule in golangci-lint.
Kubernetes-commit: dd32d7c324b97d259b99c1464802d9e3ca706a94
2026-03-05 00:11:40 +01:00
Brian Pursley
6360299e8c Use provided context in RunLogsContext
Kubernetes-commit: 7a3c7ebcfd47b8f96fb591c37a4f633581290de6
2026-03-05 20:12:01 -05:00
Brian Pursley
23bb2d4ace Use context when waiting for conditions
Kubernetes-commit: ede65f357b5974b9ea402e611952f4a15816fdec
2026-03-05 20:39:24 -05:00
Maciej Szulik
23ac98253b De-ducplicate and clean logic in FindOrDefaultContainerByName
Signed-off-by: Maciej Szulik <soltysh@gmail.com>

Kubernetes-commit: bb744ec97bd03a2115d45578468e796a557536b9
2026-03-04 11:44:25 +01:00
Jordan Liggitt
2c7989e5e7 Fix vet error
Kubernetes-commit: 45900a1debee388738f299c0a001ed01e8b25208
2026-02-17 16:42:55 -05:00
Nikhil
3bc887ac93 kubectl describe: migrate to component-helpers resource package and add pod-level resources test (#137394)
* kubectl describe: migrate to component-helpers resource package and add pod-level resources test

Refactor describe.go to use k8s.io/component-helpers/resource package for pod resource
calculations. This migration enables proper support for pod-level resources feature.

Changes:
- Import resourcehelper from k8s.io/component-helpers/resource
- Replace PodRequestsAndLimits() with separate PodRequests() and PodLimits() calls

Add TestDescribeNodeWithPodLevelResources to verify describeNodeResource works correctly
when pods have pod-level resources (Spec.Resources) configured.

Signed-off-by: KunWuLuan <kunwuluan@gmail.com>

* address review feedback: verify computed values in test and deprecate PodRequestsAndLimits

---------

Signed-off-by: KunWuLuan <kunwuluan@gmail.com>
Co-authored-by: KunWuLuan <kunwuluan@gmail.com>

Kubernetes-commit: 63080a762b383dbac02c44b3755e15543132d44e
2026-03-05 17:14:32 +00:00
Arda Güçlü
c236e6d598 kubectl wait: Support multiple conditions (#136855)
* kubectl wait: Support multiple conditions

* Error out when --for is not passed

* Add examples for AND'ing and OR'ing multiple conditions

Kubernetes-commit: d37765936d2b29beede5c9a8872ccd63e2811b00
2026-03-04 21:00:27 +03:00
Mujib Ahasan
58e1f666ef Added remove in suggestFor for delete subcommnad
Signed-off-by: Mujib Ahasan <ahasanmujib8@gmail.com>

Kubernetes-commit: 3d99d70424165eb678bb7082f3e22b2927f4384d
2026-02-27 22:22:04 +05:30
Mujib Ahasan
fa65b49f50 Added SuggestFor to top subcommand
Signed-off-by: Mujib Ahasan <ahasanmujib8@gmail.com>

Kubernetes-commit: e70323ed25ba4e5a68fbdcbd6472270a1dbc6d0c
2026-02-27 16:42:19 +05:30
杨军10092085
a324deac7b Add --detach-keys for kubectl attach command
Kubernetes-commit: ee02a8ab32b2f25c034d76464b3909fd59a132b7
2025-10-31 14:57:46 +08:00
kfess
6ab6928019 cleanup: remove suggestfor from wait command (#137266)
* feature: remove suggestfor from wait command

* fix test case

Kubernetes-commit: 7ea5b88209020a07cc96717c6e8cb622feebdd4a
2026-03-04 23:38:27 +09:00
Arda Güçlü
67b78e8df1 List containers when given container is not found
Kubernetes-commit: 94047f3cfb7ef497995ccbc27df17254bdb8401d
2026-02-12 09:47:30 +03:00
kita456
5c8ce0c6fd Add timezone to kubectl describe cronjob output
Kubernetes-commit: c5b066bcc9ea83ccc7249422dd5eb26c5d02c3e4
2026-01-31 19:43:12 +09:00
Yosri Barhoumi
e0444cfa19 Fix example in kubectl create configmap
Signed-off-by: Yosri Barhoumi <med.yosri.brh@gmail.com>

Kubernetes-commit: d7c1072e4fd398e1ebee85a5e41ec4d8598b7d78
2026-02-03 01:49:10 +01:00
olalekan odukoya
c72d4565fb add warning when kubectl rollout undo is used on apply-managed resources
Signed-off-by: olalekan odukoya <odukoyaonline@gmail.com>

Kubernetes-commit: fbe6f7f9f25a8198199af9bd75aba9d45e994b36
2026-02-17 03:05:25 +01:00
Peter Engelbert
aea8c6a8d8 Fix Deprecation message in doc comment
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

Kubernetes-commit: 71a7aeaff0f57dc53067c32f418f06c98cbbe7ee
2026-02-26 16:30:03 -05:00
Peter Engelbert
f336bc1fb3 Improve AllowlistEntry conversion logic
Allow both `Name` and `Command` when the values are identical, but not
when they differ.

Additionally:
- Add unit test verifying the above
- Add `omitempty` json tag to `Name` and `Command` fields in `AllowlistEntry` struct
- Run openapi codegen
- Remove year from boilerplate comments

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

Kubernetes-commit: e3642120630421d3d0756908fa4661a7d13c3aa4
2026-02-26 16:10:08 -05:00
Peter Engelbert
b81eec6548 Run openapi codegen
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

Kubernetes-commit: 64c0d51314257389603bf2166a1c6675a153e336
2026-02-26 15:18:34 -05:00
Peter Engelbert
93c05e4e7a Update doc comment
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

Kubernetes-commit: cede69d55800204a59640104f31417ebb4e2d563
2026-02-26 13:46:47 -05:00
Peter Engelbert
f92446bc60 Update kuberc plugin policy tests
* Add test to ensure error when both `name` and `command` are supplied
* Add test to ensure autoconversion of `name` to `command`
* Change the rest of the `name` fields to `command` since `name` is
  deprecated

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

Kubernetes-commit: 8203f2b53f6070bf16e21941033b64c15c24b23b
2026-02-26 13:40:30 -05:00
Peter Engelbert
c3cd307a41 Rename AllowlistEntry clientcmd.Name to Command
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

Kubernetes-commit: 505b937babc9ab0061ed346ec0278a3a605664ac
2026-02-26 13:27:46 -05:00
Peter Engelbert
578e4fc63e Update conversion func for AllowlistEntry
Convert `Name` to `Command` where necessary, and error if both are
provided.

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

Kubernetes-commit: cabfc886386f5a3f90a85f3ec0b597e17621862d
2026-02-26 13:18:18 -05:00
Peter Engelbert
ec8c3695b4 Rename internal AllowlistEntry field to Command
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>

Kubernetes-commit: c24c1e8c2e6e35835489c6b250e5dc61684409cd
2026-02-26 12:52:05 -05:00
Stephen Kitt
2e358d6313 Deprecate obsolete slice utility functions
... and update users to use standard library functions.

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: d42d1e3d1f73ac2975b89f9482c2ecfaeeed13f6
2025-07-15 09:02:48 +02:00
koba1t
f613e8cfbf Update kubectl kustomize to kyaml/v0.21.1, cmd/config/v0.21.1, api/v0.21.1, kustomize/v5.8.1
Kubernetes-commit: 656c0893a891c3065f5e85ab077f2eee891b33a0
2026-02-10 04:00:25 +09:00
kita456
f082187cdc Fix kubectl plugin list overshadow detection on Windows
Kubernetes-commit: 7bb838e50b5b878b19151bd03cb3e20bf8746740
2026-02-02 22:09:05 +09:00
olalekan odukoya
e366288460 add show-secret flag to the diff command
Signed-off-by: olalekan odukoya <odukoyaonline@gmail.com>

Kubernetes-commit: 03060174b8e040b9cb086c7e4d613c082c34e1e8
2026-02-13 22:48:12 +01:00
olalekan odukoya
d9dc040ca9 fix cli throwing an error when trying to follow logs for pod while still initializing
Signed-off-by: olalekan odukoya <odukoyaonline@gmail.com>

Kubernetes-commit: 5b3b05921f68116e8c96697766f7298d27b5a142
2026-01-22 00:51:44 +01:00
Mads Jensen
07471296e7 Fixes under staging.
Kubernetes-commit: ae8838f58a5859c33f2443b7df8a4bc525fde95b
2026-02-06 22:44:34 +01:00
Austin Abro
749aa3b298 feat(wait): introduce waitOptions.RunWaitContext() (#136781)
* run wait with context

Signed-off-by: Austin Abro <austinabro321@gmail.com>

* delete other comment

Signed-off-by: Austin Abro <austinabro321@gmail.com>

---------

Signed-off-by: Austin Abro <austinabro321@gmail.com>

Kubernetes-commit: 598922db7562f628fb51ef1db6d3ccb6003369a4
2026-02-07 00:40:56 +00:00
Tim Allclair
beafecea32 Use quantity.Sign() instead of quantity.Cmp(zeroQuantity)
Kubernetes-commit: e8b7c959c9bacabb14100f871ffe19a02a7a1528
2026-02-04 10:38:23 -08:00
HirazawaUi
456c00e8c7 Lock the DisableNodeKubeProxyVersion feature gate to be enabled by default.
Kubernetes-commit: 9703ce508fa0da17da10f0905af9982eb1e08a09
2026-02-04 20:53:10 +08:00
0x5457
a691d93fd8 Fix missing namespace flag in attach reattach message
Kubernetes-commit: c7ba4bbcf86cb6d520348e02a0ac4af5d7622501
2025-12-19 00:01:10 +08:00
Arda Güçlü
10d2309a74 Promote kubectl kuberc commands to beta
Kubernetes-commit: 4e47d34a0d2d7d420f2bf511a28b86da88e54213
2026-01-30 09:23:14 +03:00