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
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
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
* 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
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
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
* 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
* 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
* 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
* 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
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
* 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
Convert `Name` to `Command` where necessary, and error if both are
provided.
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
Kubernetes-commit: cabfc886386f5a3f90a85f3ec0b597e17621862d
... and update users to use standard library functions.
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Kubernetes-commit: d42d1e3d1f73ac2975b89f9482c2ecfaeeed13f6