Commit Graph

65 Commits

Author SHA1 Message Date
Maciej Szulik 52ec1da081 Add comment describing the feature gate with a link to KEP
Signed-off-by: Maciej Szulik <soltysh@gmail.com>

Kubernetes-commit: 9e3a1b0a9081ab49bbc44c415525dce862eb6a12
2025-05-08 14:43:24 +02:00
Maciej Szulik 307936eb9d Swap KUBECTL_COMMAND_HEADERS to use the proper feature gate mechanism
Signed-off-by: Maciej Szulik <soltysh@gmail.com>

Kubernetes-commit: e3f3da5e795960508089aed08fe7fd9bec0a6db2
2025-05-08 14:09:17 +02:00
Maciej Szulik 90ee929b88 Drop KUBECTL_ENABLE_CMD_SHADOW featgure gat entirely
https://kep.k8s.io/3638 has been promoted to stable back in 1.32 so now
is the right time to drop this feature gate entirely.

Signed-off-by: Maciej Szulik <soltysh@gmail.com>

Kubernetes-commit: d1b5f268b48eda4bb8acdeef52407c27add9e076
2025-05-08 14:05:19 +02:00
Arda Güçlü 5bcd2add11 Drop KUBECTL_DEBUG_CUSTOM_PROFILE feature gate entirely
Kubernetes-commit: 94d043b149b845a4f02f12a3d318df278194d377
2025-05-06 13:00:14 +03:00
Maciej Szulik 7f2f474232 Update kubetl subresource to stable
Signed-off-by: Maciej Szulik <soltysh@gmail.com>

Kubernetes-commit: de984ec9b92bcf6ff17060b1cdecdd8fd948bcbb
2025-02-18 14:28:59 +01:00
Arda Güçlü 2e38fc2204 Introduce kuberc as new flag to customize defaulting and define aliases in kubectl (#125230)
Kubernetes-commit: c7a90b670c40a315bea3667921302675008bc39c
2025-02-12 00:39:09 +00:00
Victor Franzi 40fde549ca docs: `-l/--selector` example for set-based requirements
add an example of set-based requirement when using `-l/--selector` as it's a (less known) filtering capability: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#list-and-watch-filtering

Kubernetes-commit: 8f48a82e6ed9fd19601ad8c32a5f1b55b4299fb0
2024-12-06 12:03:48 +01:00
Arda Güçlü 608a0553d7 Use generic sets rather than deprecated sets.String
Kubernetes-commit: c3f15fd707a092e6cb7d96b84b81ada1f118d759
2024-11-21 13:22:39 +03:00
Anish Shah b22c40d47c kubectl: remove subresource restrictions from all commands
Removing this restrictions will allow us to use these commands with the
new resize subresource.

Kubernetes-commit: e1ca63489f2b788f893ab37a27242ce319e1eaf6
2024-10-31 16:00:52 -07:00
Arda Güçlü 484ede079f KEP-4292: Add e2e test for custom profile in kubectl debug (#127187)
* Remove KUBECTL_DEBUG_CUSTOM_PROFILE env var

* Add e2e test for custom profile in kubectl debug

* Keep feature flag until 1.33

* Update comment

* Simplify tests by relying on test framework functionality

* Rename import alias to better to pass verify-import-alias

Kubernetes-commit: 1caf9a150b794a7c4a17e63a54b902ec0b0be570
2024-10-22 21:48:59 +03:00
Maciej Szulik 80dc149179 Fix spacing in --validate flag description
Kubernetes-commit: 7b0660ec9f572c7b8c964c5447aa9169684f9a2b
2024-10-15 11:16:33 +02:00
Abhishek Kr Srivastav 36d480f43c Fix Go vet errors for master golang
Co-authored-by: Rajalakshmi-Girish <rajalakshmi.girish1@ibm.com>
Co-authored-by: Abhishek Kr Srivastav <Abhishek.kr.srivastav@ibm.com>

Kubernetes-commit: 95860cff1c418ea6f5494e4a6168e7acd1c390ec
2024-09-12 18:15:22 +05:30
Stephen Kitt 713b7e79c0 Use canonical json-patch v4 import
The canonical import for json-patch v4 is
gopkg.in/evanphx/json-patch.v4 (see
https://github.com/evanphx/json-patch/blob/master/README.md#get-it for
reference).

Using the v4-specific path should also reduce the risk of unwanted v5
upgrade attempts, because they won't be offered as automated upgrades
by dependency upgrade management tools, and they won't happen through
indirect dependencies (see
https://github.com/kubernetes/kubernetes/pull/120327 for context).

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

Kubernetes-commit: 5300466a5c8988b479a151ceb77f49dd00065c83
2024-02-16 13:57:24 +01:00
Arda Güçlü 49f3ec973c Add e2e test for kubectl interactive delete
Kubernetes-commit: 7faa8bbac3bbd36a4ee680e6f82460d587186139
2024-01-09 10:12:42 +03:00
Arda Güçlü 14d23cc879 Add custom debug profiles on top of static profiles
This PR adds `custom` flag to let user customizes debug resources.
`custom` flag accepts partial container spec in json format.

Kubernetes-commit: af2dadcb18a0411a0f9aa286c743801efdb81049
2023-09-01 11:46:01 +03:00
Sean Sullivan 858d3a5b72 portforward: tunnel spdy through websockets
Kubernetes-commit: 8b447d8c97e8823b4308eb91cf7d75693e867c61
2024-02-21 08:56:07 +00:00
yulng 4afdc439d1 remove PruneWhitelist, use prune-allowlist instead
Signed-off-by: yulng <wei.yang@daocloud.io>
Signed-off-by: Paco Xu <paco.xu@daocloud.io>

Kubernetes-commit: 06679402e75d001d54770c9ec67cacbf28794009
2023-07-05 11:38:20 +08:00
Jefftree 351ba8bb1c Lazy load OpenAPIV2
Kubernetes-commit: eb32969ab8f3d1455c33a595bba5b3ce4d8a03b8
2023-10-30 15:42:22 -04:00
Jefftree 8c8a04f6d0 Add feature toggle for OpenAPI V3 apply in kubectl
Kubernetes-commit: f23ab829bee7951188d3196c16794cc489d0348c
2023-10-27 01:23:19 -04:00
Sean Sullivan 969a47ceed StreamTranslator and FallbackExecutor for WebSockets
Kubernetes-commit: 168998e87bfd49a1b0bc6402761fafd5ace3bb3b
2023-07-06 21:22:07 -07:00
Maciej Szulik bdf68c0441 Allow using upper and lower case true|false when setting kubectl feature flags
Kubernetes-commit: e74f2d41aabc2c27db6f2a2a005572c8dd332912
2023-10-23 11:40:41 +02:00
Arda Güçlü c2f0957625 KEP-3638: Promote plugin resolution to beta (#120663)
* Promote plugin resolution to beta

* Not use plugin for kubectl create -f command execution

`kubectl create -f` is legitimate command execution and we shouldn't
search plugins if user invokes this.

* Add integration test for plugin resolution for create command

* Reintroduce feature flag to ability to disable it explicitly

Kubernetes-commit: 074a8b00840e85cc95fd83b1825b14ab21ad09c4
2023-10-23 14:41:38 +03:00
Arda Güçlü 55333c0817 KEP-3895: Promote interactive delete to beta
Kubernetes-commit: e8564d6c5bcf5757238176f90318ae0164274af9
2023-09-05 10:40:12 +03:00
Arda Güçlü 042ec77890 Remove KUBECTL_EXPLAIN_OPENAPIV3 environment variable
Since explain openapiv3 has been moved to beta already, there is no
point to having this environment variable.

This PR removes it.

Kubernetes-commit: 4d8f569b037d2979c1d9c5825e5227aadfc8077f
2023-07-13 13:37:03 +03:00
Arda Güçlü 7e050c1e1d kubectl delete: Introduce new interactive flag for interactive deletion (#114530)
Kubernetes-commit: 3267dd9d5294893580538e98c1e410f64583c0cd
2023-07-11 16:05:11 +03:00
Madhav Jivrajani 56c5264e50 kubectl: Change subresource flag to beta
Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

Kubernetes-commit: 9fbd08e075dae2b67386fe2c5283f28272858008
2023-03-14 21:44:32 +05:30
Arda Güçlü d3f76f431e Enable plugin resolution as subcommand for selected builtin commands (#116293)
* Enable plugin resolution as subcommand for selected builtin commands

This PR adds external plugin resolution as subcommand for selected builtin
commands if subcommand does not exist as builtin.

In it's alpha stage, this will only be enabled for create command and
this feature is hidden behind `KUBECTL_ENABLE_CMD_SHADOW` environment variable.

* Rename parameter to exactMatch to better reflect

Kubernetes-commit: a901bb630b5a353898c1b35df582a7faeef160a0
2023-03-09 16:16:01 +03:00
Katrina Verey 530dea246b Introduce CLI for ApplySet-based pruning (#115979)
* Introduce CLI for ApplySet-based pruning

* Address feedback from justinsb

* Fix parent namespace sourcing and restrict types. Increase test coverage.

Kubernetes-commit: 0dd346673c00158247c8232f9e81a308fb741463
2023-02-27 12:20:40 -05:00
Jordan Liggitt 21676edd52 Improve kubectl display of invalid errors
Kubernetes-commit: 6c549d75a8d951ec43ecd5394b2634c1a40e5dd1
2022-08-31 11:49:34 -04:00
Marc Khouzam 7ef2d069b5 Add shell completion for new --subresource flag
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 33b03096f2fb283f00966350d460e6f4198d4df4
2022-03-28 10:23:54 -04:00
xiaopeng a833054047 replace deprecated setoutput
Kubernetes-commit: 48629bcc0588773bc837d1cc69cab8b21a2057e0
2022-04-05 14:04:22 +08:00
Arda Güçlü ec010ddaa3 Remove redundant validateFlag checks
Kubernetes-commit: 5b274249400157028f1d9107b6bbd0686be2c076
2022-06-13 10:06:51 +03:00
Arda Güçlü aa46caeecd Define NoOptDefVal for validate flag
validate flag does not have default value defined when there is no
parameter passed, therefore it tries to use next irrelevant flag.

This PR defines NoOptDefVal for validate flag which is set "strict".

Kubernetes-commit: 0245e74590a658ea911f1e5cacd270960883af2d
2022-05-06 10:25:40 +03:00
Kevin Delgado 61f42e595f add server-side validation support to kubectl
Kubernetes-commit: fe3772890f650f9bcf020b43dc5a51fab0fa17f4
2022-03-09 14:52:32 +00:00
Yuvaraj Kakaraparthi 38487e770c kubectl: add --support to get, patch, edit and replace commands
Co-authored-by: Nikhita Raghunath <nikitaraghunath@gmail.com>

Kubernetes-commit: a5aa858d44651ba48bdce634a39b55be91216614
2021-07-07 08:30:59 -07:00
Patrick Ohly 7c4cfc5d12 enhance and fix log calls
Some of these changes are cosmetic (repeatedly calling klog.V instead of
reusing the result), others address real issues:

- Logging a message only above a certain verbosity threshold without
  recording that verbosity level (if klog.V().Enabled() { klog.Info... }):
  this matters when using a logging backend which records the verbosity
  level.

- Passing a format string with parameters to a logging function that
  doesn't do string formatting.

All of these locations where found by the enhanced logcheck tool from
https://github.com/kubernetes/klog/pull/297.

In some cases it reports false positives, but those can be suppressed with
source code comments.

Kubernetes-commit: edffc700a43e610f641907290a5152ca593bad79
2022-02-16 12:17:47 +01:00
Eddie Zaneski d76986fd7a Change level for klog.Fatal
Signed-off-by: Eddie Zaneski <eddiezane@gmail.com>

Kubernetes-commit: cd71d3f7881f0c66dbd28aec7af7a0ea0e2acf60
2022-02-10 14:43:19 -07:00
ncapps 9f0231784c Update label selector message to clarify that constraints use AND operator
Kubernetes-commit: 62baa0af4c995cdf401339bfb92d6ae172fe5c6d
2022-01-07 17:25:17 +00:00
Aram Peres 22a27cb97d Add label selector in 'kubectl rollout' commands
Kubernetes-commit: 5a5ac86a80464019e3e85d57306156839511d397
2022-01-06 16:53:29 -05:00
Julian V. Modesto 5c9b92b57c Re-introduce removed kubectl --dry-run values.
For 1.23, we removed the kubectl `--dry-run` empty default value (`--dry-run`)
and boolean values (`--dry-run=true` and `--dry-run=false`). This change
required requiring users to specify `--dry-run=client` or `--dry-run=server`
due to a deprecation. This change was made in #105327.

After reconsideration, this change is not worth the churn for users.
It's likely that many users rely on these values for automated and manual use
cases.

This change reverts #105327 and re-introduces the values `--dry-run`,
`--dry-run=true`, and `--dry-run=false`.

Kubernetes-commit: cc4998b2b131ca9906b847600bd5ad3be70eff3a
2021-12-13 15:04:49 -05:00
yylt 0198d9185e Fix edit command
Kubernetes-commit: 2ae37c8046128e0191ec96c8b31361ae894f2330
2021-10-21 20:07:38 +08:00
brianpursley 07f77100fc Add --override-type flag to kubectl run and kubectl expose to allow the choice of using a JSON Patch or Strategic Merge Patch to apply the override to the generated output.
Kubernetes-commit: 0e697e19ac9f73e2efa0e60157730ba8731e3847
2021-11-05 07:10:47 -04:00
Marc Khouzam b111bee570 Complete multiple resource names
This commit teaches the completion function to repeat resource names
when supported by the command. The logic checks if a resource name
has already been specified by the user and does not include it again
when repeating the completion.

For example, the get command can receive multiple pods names, therefore
with this commit we have:
  kubectl get pod pod1 [tab]
will provide completion of pod names again, but not show 'pod1' since
it is already part of the command-line.

The improvement affects the following commands:
- annotate
- apply edit-last-applied
- apply view-last-applied
- autoscale
- delete
- describe
- edit
- expose
- get
- label
- patch
- rollout history
- rollout pause
- rollout restart
- rollout resume
- rollout undo
- scale
- taint

Note that "rollout status" only accepts a single resource name, unlike
the other "rollout ..." commands; this required the creation of a
special completion function that did not repeat just for that case.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Kubernetes-commit: 7aa5cb40316dbeb970250ee0835fbd597fd19a20
2021-10-15 15:36:09 -04:00
Julian V. Modesto f9ab824bc9 Remove deprecated kubectl --dry-run values.
The boolean values for --dry-run have been deprecated for removal since
1.18, more than 2 releases.

The default value for --dry-run with the flag set and unspecified has
been deprecated for removal since 1.18, more than 2 releases.

Both values are now removed in this change. Any kubectl --dry-run
usage no longer accepts --dry-run=(true|false) boolean values and usage
now requires that a value of (client|server|none) is specified.

Kubernetes-commit: e0b7a85ee5b5d546bec2dc0e8cbf5cd4c0c684d8
2021-09-28 10:03:20 -04:00
BLasan 9072d8b375 Remove AddGeneratorFlag function
Kubernetes-commit: 9c8335b65a4527ea3a07687e4a7a8ba5ebd72041
2021-04-13 23:58:24 +05:30
Katrina Verey 086cadbf87 Create helper for adding chunk-size flag to commands
Kubernetes-commit: f8097c6ceeb16461861c74d4fc5dd0bcd36ebeaf
2021-03-19 08:30:49 -07:00
Katrina Verey 9348b0acca Extract DefaultChunkSize constant
Kubernetes-commit: 222e2c5ef897f4d47831b8d822cab09c000037c2
2021-03-10 12:21:25 -08:00
mengjiao.liu a0af655b7a kubectl default container behavior
Kubernetes-commit: 88e530117ff3fff29e670aee51c677a8e0fe8dec
2021-03-05 17:04:40 +08:00
Clayton Coleman 56434236a4 kubectl: Inline the containers for the user in attach/exec
The behavior of the container defaulting in attach/exec is inconsistent
and should be unified. As a user, when we default the vast majority of
pods will have a small number of containers and so printing the container
names inline (as kubectl logs did) is more appropriate. The debug message
we printed about using describe was already longer than 99% of all pod
container names, so we were wasting user time.

Unify container selection for exec and attach to be consistent with old
behavior. Properly handle the --quiet flag (should not print in that case)
for both commands. Remove EnableCmdSuggestion and the machinery it needs.

The message now prints:

> Defaulted container "etcdctl" out of: etcdctl, etcd, etcd-metrics, etcd-ensure-env-vars (init), etcd-resources-copy (init)

Kubernetes-commit: 43e8ebbbcd3f57d18d8151efb6242f88a763b06d
2021-02-11 11:40:25 -05:00
pacoxu 4245d9e7b5 print log for default container of kubectl
Kubernetes-commit: 96f8d6262459e802510244d2880886f8b481ee0e
2021-03-01 12:04:29 +08:00