426 Commits
Author SHA1 Message Date
kubernetes-prow[bot] ff68f33551 Merge pull request #142619 from soltysh/kuberc_stable
KEP-3104: promote kuberc to stable
2026-10-09 13:44:02 +00:00
Maciej Szulik b67ff063f1 kuberc: switch to using v1 types
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2026-10-08 18:04:14 +02:00
0xff-dev 3bd5634d28 kubectl: keep a multi-line event message inside its table row
`kubectl events` writes each event as one tab-separated row into a
tabwriter, passing the message through unchanged. A tabwriter ends a row
at a line break, so an event whose message spans several lines is printed
as extra lines that belong to no event and carry no columns, which breaks
the table.

Event messages are routinely multi-line: an exec probe failure embeds the
probe command's output verbatim, so any probe that prints more than one
line produces one.

The table printer behind `kubectl get events` already cuts a cell at its
first break character and appends "...". Do the same in the events command
so both render the same event the same way.

Signed-off-by: Shuang Zhang <stevenshuang521@gmail.com>
2026-10-08 18:10:53 +08:00
kfess fd6a639dde add kuberc set integration test 2026-10-02 18:24:15 +09:00
Maciej Szulik 6758edd18f Add a wait for 2 ReplicaSets to show up in test-cmd
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2026-08-13 17:41:05 +02:00
Slim Shady 5b78cd6ad0 kubectl explain: add --max-depth flag (#138809) 2026-07-09 16:32:31 +00:00
Kubernetes Prow Robot 47f9904374 Merge pull request #137543 from kfess/bugfix/disable-eviction-dry-run
Fix: kubectl drain --disable-eviction --dry-run=server hanging indefinitely
2026-05-05 15:12:30 +05:30
Brian Pursley ff0454f50e kubectl: set KUBECTL_PATH environment variable during plugin execution (#138694)
* kubectl: set KUBECTL_PATH environment variable during plugin execution

* Add integration tests to verify that KUBECTL_PATH environment variable is set for plugins.

* Make sure plugin integration tests use $TEMP_PATH as path and make test assertions flexible enough to handle platform differences in how os.Executable() returns either a symlink or the actual binary location.
2026-05-05 13:02:22 +05:30
kfess 54fa811dfd apply review comment 2026-04-30 13:59:58 +09:00
Maciej Szulik 05db06745f Wait a bit after creating CRD
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2026-04-24 13:34:30 +02:00
Maciej Szulik e7ad4d65fe Remove generators from kubectl run
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2026-04-23 15:36:17 +02:00
hunshcnandMaciej Szulik b528be0a56 kubectl: strict check for exec command (#138214)
* kubectl: strict check for exec command

Fix https://github.com/kubernetes/kubectl/issues/1745

The current implementation doesn't properly check for arguments between
the resource name and the dash separator. This can lead to unexpected
behavior when using commands like 'kubectl exec -it pod-0 bash -- run.sh',
which should raise an error but doesn't.

This fix ensures that when a dash separator (--) is used, there are no
extra arguments between the resource name and the dash.

- Only allow argsLenAtDash == 0 or == 1 (exactly one arg before --)
- Add test for extra args between pod and --
- Add test for flag-like args without dash separator

* test: add kubectl exec container flag coverage

* Apply suggestion from @soltysh

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

---------

Co-authored-by: Maciej Szulik <soltysh@gmail.com>
2026-04-23 06:07:14 +05:30
Takehiro Ogura 37be90f295 Update po, mo files for kubectl Japanese translation (#131176)
* Update Japanese translation for kubectl

* Update test for kubectl help

* apply kubernetes translations rules https://kubernetes.io/ja/docs/contribute/localization/#basic-policy

* Update kubectl help test string

* rebuild kubectl mo file

* fix k8s specific terms to original one
2026-04-23 02:18:41 +05:30
Lubomir I. Ivanov bc2179d882 pause: fix version drift in various files
The latest pause version is 3.10.2 but due to the introduction
of the PATCH level version to the pause image (previously was
only MAJOR.MINOR), various files have remained on an older
version. Either 3.10 or 3.10.1. Our validation with
build/dependencies.yaml ./hack/verify-external-dependencies.sh
did not account for that.
2026-04-03 16:11:09 +02:00
Peter EngelbertandMaciej Szulik b4220f8b08 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>
2026-03-12 22:49:41 +05:30
Kubernetes Prow Robot 63d25f42db Merge pull request #136945 from ardaguclu/fix-kubectl-scale
Reflect expected replica count to the output of kubectl scale
2026-03-09 19:53:22 +05:30
Arda Güçlü d37765936d 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
2026-03-04 23:30:27 +05:30
kfess 7ea5b88209 cleanup: remove suggestfor from wait command (#137266)
* feature: remove suggestfor from wait command

* fix test case
2026-03-04 20:08:27 +05:30
Arda Güçlü 94047f3cfb List containers when given container is not found 2026-02-12 09:47:30 +03:00
Arda Güçlü ccd53e4eeb Reflect expected replica count to the output of kubectl scale 2026-02-11 17:44:36 +03:00
Arda Güçlü 4e47d34a0d Promote kubectl kuberc commands to beta 2026-01-30 09:23:14 +03:00
mochizuki875 8e420e0b3a make general profile default 2025-12-24 15:35:31 +00:00
Peter Engelbert fab280950d Add client-go credential plugin to kuberc
Remove reference to internal types in kuberc types

* Remove unserialized types from public APIs

Also remove defaulting

* Don't do conversion gen for plugin policy types

Because the plugin policy types are explicitly allowed to be empty, they
should not affect conversion. The autogenerated conversion functions for
the `Preference` type will leave those fields empty.

* Remove defaulting tests

Comments and simplifications (h/t jordan liggitt)

Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
2025-11-09 14:24:53 -05:00
Arda Güçlü 9cad3f8787 Introduce kuberc view/set commands under kubectl alpha (#135003)
* Introduce kuberc view/set commands under kubectl alpha

* Apply requested changes

* Apply requested changes
2025-11-05 01:48:59 -08:00
Arda Güçlü 9113013eb8 Introduce --as-user-extra persistent flag in kubectl (#134378)
* Introduce --as-user-extra as persistent flag

* Add integration test to verify the behavior

* Update flag type to string slice
2025-11-04 07:14:09 -08:00
Arda Güçlü c13c581459 Add given namespace in dryrun=client output of HPA 2025-11-03 18:35:45 +03:00
Maciej Szulik f82a139dc0 Promote KUBECTL_COMMAND_HEADERS to stable
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-10-28 18:17:32 +01:00
Maciej Szulik 167ccbc8ec Improve cmd tests for kubectl events
kube::test::if_has_string and kube::test::if_has_not_string only match
the first argument, and don't allow regular expressions, so we need to
split the checks into separate buckets, ensuring they are strictly tied
to this particular test.

Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-10-24 16:37:03 +02:00
Ondra Kupka d03fab555f kubectl config set-context: Add -n flag
This is simply a shorthand for --namespace as with other commands.
2025-10-06 11:31:26 +02:00
杨军10092085 9fb1ef4dd0 fix kubectl exec command in cmd test 2025-09-02 20:04:46 +08:00
Jordan Liggitt 0c91e28360 Clean up service account print and describe 2025-08-05 17:51:10 -04:00
ArkaSaha30 621482d68b update pause version to 3.10.1
This commit will update the pause version to 3.10.1 as per thread: https://kubernetes.slack.com/archives/CJH2GBF7Y/p1741674313893029

Signed-off-by: ArkaSaha30 <arkasaha30@gmail.com>
2025-07-09 16:38:14 +05:30
Maciej Szulik 690790257f Add test verifying KUBECTL_KUBERC can be turned on and off
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-06-17 11:47:17 +02:00
Arda Güçlü b0370c483a Promote kuberc to beta
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-05-23 10:56:59 +02:00
Maciej Szulik 8cf5e8db78 Deprecate kubeconfig's preference field in favor of kuberc
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-05-20 13:31:57 +02:00
Maciej Szulik e3f3da5e79 Swap KUBECTL_COMMAND_HEADERS to use the proper feature gate mechanism
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-05-08 19:11:36 +02:00
Arda Güçlü 6cca37b36f Add integration test for log verbosity 2025-05-08 16:47:35 +02:00
Keita Mochizuki 07a275437f kubectl debug: Display a warning message that the debug container's capabilities may not work with a non-root user (#127696)
* Add warning message about capabilities of debug container

* fix1

* fix2

* fix3
2025-03-19 00:50:30 -07:00
Arda Güçlü c7a90b670c Introduce kuberc as new flag to customize defaulting and define aliases in kubectl (#125230) 2025-02-11 12:05:58 -08:00
Patrick Ohly a85f489b28 client-go/transport: structured, contextual logging
The revised logging emits one log entry at the start of
round-tripping ("Request") and another at the end ("Response"). This avoids the
risk that related output gets interleaved by other output.

No API changes are necessary. A contextual logger is picked up from the context
of the request that is being handled. The verbosity level of that logger is
checked to determine what is supposed to be logged. This enables reducing log
details on a by-request basis by storing a `logger.V(1)` in the context of the
request.

As before, logging only gets injected into request processing at -v6 or higher,
so normally there is no additional overhead.
2025-01-27 09:45:04 +01:00
Omer Aplatony 0cc9262200 kubectl: fix wait --for=create to work correctly with label selectors (#128662)
* kubectl: fix wait --for=create to work correctly with label selectors

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

* Add unit test

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

* add integration test

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

* Increase wait time to 40 seconds

Signed-off-by: Omer Aplatony <omerap12@gmail.com>

---------

Signed-off-by: Omer Aplatony <omerap12@gmail.com>
2024-12-12 02:57:28 +00:00
googs1025 573f0d4538 flake(kubectl): fix run_kubectl_request_timeout_tests in integration test 2024-10-16 20:44:25 +08:00
David Eads 55ba8b2cbb add --subresource to kubectl apply 2024-10-02 13:28:29 -04:00
Maciej Szulik fad6c424ac wait: don't lowercase condition in --for argument 2024-08-12 16:59:17 +02:00
Kubernetes Prow Robot 37f733a657 Merge pull request #125868 from soltysh/wait_for
Add --for=create option to kubectl wait
2024-07-11 05:03:17 -07:00
Kubernetes Prow Robot c20aa764d7 Merge pull request #125333 from ardaguclu/kep-4292-beta
KEP-4292: Preparations to promote custom profiling in kubectl debug
2024-07-11 05:03:03 -07:00
Maciej Szulik aaf1fb50f3 Add --for=create option to kubectl wait 2024-07-08 14:07:26 +02:00
HirazawaUi c29a19610a add tests 2024-06-26 01:07:24 +08:00
Kubernetes Prow Robot da479a82eb Merge pull request #125630 from liggitt/rollback-wait
Revert kubectl wait regression
2024-06-21 11:21:01 -07:00
Arda Güçlü 6f4e97e905 Remove deprecated kubectl exec command execution without dash (#125437)
* Remove deprecated kubectl exec command execution without dash

* Use command execution with dash in kubectl exec

* Modify unit tests to only use command after dash
2024-06-21 09:22:55 -07:00