Commit Graph

543 Commits

Author SHA1 Message Date
Alexander Zielenski 9cd0ccd733 add `KUBECTL_EXPLAIN_OPENAPIV3` envar to gate new explain implementation
update

Kubernetes-commit: 2f16cd4aeabda5dd6d5398a3592400bc249fdb17
2022-10-12 08:37:41 -07:00
PuneetPunamiya 768d721977 Refactors describe command to split flags from options
Signed-off-by: Puneet Punamiya ppunamiy@redhat.com

Kubernetes-commit: 568f55a82bf0e375d215ee04d4bf7b916a74a715
2022-09-23 12:16:43 +05:30
Brian Pursley 7c5e877c4d Add categories to kubectl api-resources -o wide output
Add categories column to show which categories each
resource type belongs to.

Add --categories flag to allow filtering the output to
a specific category or set of categories.

Change verbs column to display verbs in a comma-delimited
list, consistent with other multi-value columns in the output.

Kubernetes-commit: a1330a405497479ea30319258e75435ba8321d61
2022-07-12 17:57:37 -04:00
m.nabokikh a5404b6548 Split the API error in two
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

Kubernetes-commit: e6e670624b5fbe5493f48796f54e60d505727314
2022-09-29 11:50:33 +02:00
m.nabokikh faf015bc84 Fix the code according to the code review comments
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

Kubernetes-commit: 967fdbd3d52b67ed5c72f2b4888adae1f04489e1
2022-09-27 15:49:51 +02:00
m.nabokikh d614c60b0c Add more accurate error message for WhoAmI command
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

Kubernetes-commit: bbc58a55176ea9f879e4dfabfde0202a17504c56
2022-09-27 14:12:07 +02:00
Arda Güçlü f6d66bab8d (kubectl patch): Add descriptive message when patch type is unsupported
`kubectl patch` commands fails when patch type is strategic merge
patch for CRDs. This PR handles `UnsupportedMediaType` error and
shows descriptive message to user.

Kubernetes-commit: dc2c0ad831f71349befdfa57d4367c4ea57d4a6c
2022-09-19 10:15:04 +03:00
Manish Kumar e19db057bd Add notes for strategic merge patch is not supported for CR
Kubernetes-commit: 4f85a584800c7967c181798387eacbe0d5e75da4
2022-09-15 11:40:46 +05:30
m.nabokikh 254147c688 Cleanup WhoAmI sorting code
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

Kubernetes-commit: b81b422a70ec6ab1bbdacae56bbe3ccd0daef5a6
2022-09-16 07:14:20 +02:00
m.nabokikh f55dcb2100 Fix WhoAmI flaky test
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

Kubernetes-commit: 378d7f8f2b05b9228efd71e73562a29f941f968a
2022-09-15 11:02:42 +02:00
m.nabokikh 2988d073de Add auth API to get self subject attributes
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

Kubernetes-commit: 00dfba473b08528f0a21f7bd3b921f5dd35b013a
2022-07-22 04:01:52 +04:00
song 6f44e96c59 update auto can-i error message
Signed-off-by: song <tinysong1226@gmail.com>

Kubernetes-commit: 41762c588fc92e5d310649d2fa6133523a045f19
2022-05-29 00:38:52 +08:00
Brian Pursley 96fc22ebfb Revert "Remove unused flags from kubectl run"
Kubernetes-commit: eae2c424efd9dda8cb0f5ba01ab4c955cdf42cfa
2022-09-05 09:34:48 -04:00
Jordan Liggitt 21676edd52 Improve kubectl display of invalid errors
Kubernetes-commit: 6c549d75a8d951ec43ecd5394b2634c1a40e5dd1
2022-08-31 11:49:34 -04:00
cndoit18 c688132ac9 style: remove redundant judgment
Signed-off-by: cndoit18 <cndoit18@outlook.com>

Kubernetes-commit: ec43037d0f57fdfc2fdc4960fdb8a7e31ac79fae
2022-07-29 18:25:05 +08:00
Brian Pursley 2b0d68cf1f Fix rollout history bug
Fix rollout history bug where the latest revision was
always shown when requesting a specific revision and
specifying an output.

Add unit and integration tests for rollout history.

Kubernetes-commit: 693e1299a6a75ffe358c41626532cdf2567c267b
2022-07-13 18:27:05 -04:00
Arda Güçlü 69c8011633 (kubectl cluster-info): Move towards RESTClientGetter instead cmdutil.Factory
To preserve loose coupling, it is needed to pass `RESTClientGetter`
instead `cmdutil.Factory` for all kubectl commands.

This PR removes `cmdutil.Factory` usage in `cluster-info` command and
instead passes `RESTClientGetter`.

Kubernetes-commit: 60680fc1d5458994aa29892e581aaf966d64ae91
2022-08-04 13:08:55 +03:00
Arda Güçlü b2cb2f2c6d (kubectl certificate): Move towards restClientGetter instead cmdutil.Factory
To preserve loose coupling, it is needed to pass `RESTClientGetter`
instead `cmdutil.Factory` for all kubectl commands.

This PR removes `cmdutil.Factory` usage and instead
passes `RESTClientGetter` as well as required changes in unit tests.

Kubernetes-commit: 55cb8ba1ebe68d2fa6b33f1e474419b895eb31ea
2022-08-04 11:36:03 +03:00
Brian Pursley 2861433ddd Fix label output bug where dry run message was not printed
Kubernetes-commit: 2efe97fa6cfa99512b3b101de4c23ce7a4100b05
2022-07-30 09:27:42 -04:00
Arda Güçlü 89edfadfa3 Use OpenAPI to determine patch type in kubectl apply patching
Currently `kubectl apply` determines correct patch type for given
GVKs by trying to register schema and if it succeeds, it uses
strategic-merge-patch.

But OpenAPI endpoint already stores which patch types are supported
by GVKs. This PR checks OpenAPI endpoint to retrieve patch type,
if OpenAPI is enabled. If it is not enabled, patch type determination
will be done as conventional registration method.

Kubernetes-commit: cddbb0c56397448ac0489f0473a26601c1feece8
2022-06-08 13:12:16 +03:00
Natasha Sarkar 393c40f5c4 Update kubectl kustomize to kyaml/v0.13.9, cmd/config/v0.10.9, api/v0.12.1, kustomize/v4.5.7 (#111606)
Kubernetes-commit: 83c3c37a879c6d14cce2465161f88d3c6881de8b
2022-08-03 04:48:50 +00:00
peizhouyu 975bff8512 fix that beginning of help text is cut off for apply and replace --filename flag
Kubernetes-commit: d216b3433d018fae95efdf987002dd8c4d006ae6
2022-07-28 11:33:34 +08:00
Marcus Puckett 77c921aa92 Fix flakiness with kubectl wait tests (#111168)
* Prepend reactor not watch reactor

This forces the object to be created first it looks like, avoiding a race condition in testing.
Use PrependReactor instead of PrependWatchReactor

Decrease test timeouts

No need to be this long
Revert use of new scheme to reuse same scheme for all tests

Allow 1 to 2 actions in stale observed generation failure

Allow range of test action lengths

Reduce test flakiness
Fix TestWaitForJSONPathCondition/handles_watch_condition_change

Set delete wait options properly

cherry pick original changes back into branch

* Revert delete timeout setting change

* Remove validateActions functions

* Remove go-spew

Kubernetes-commit: dcc54dec19fa5f4605cf679af5289b173ce6015f
2022-07-28 20:44:55 +00:00
Arda Güçlü fc1c4dafec Add new flags into alpha events
In order to promote kubectl alpha events to beta,
it should at least support flags which is already
supported by kubectl get events as well as new flags.

This PR adds;

--output: json|yaml support and does essential refactorings to
integrate other printing options easier in the future.

--no-headers: kubectl get events can hide headers when this flag is set for default printing.
Adds this ability to hide headers also for kubectl alpha events.
This flag has no effect when output is json or yaml for both commands.

--types: This will be used to filter certain events to be printed and
discard others(default behavior is same with --event=Normal,Warning).

Kubernetes-commit: 63b8684cd32f96f3a1e5c5a5fd05e8194f2140fc
2022-05-10 13:09:59 +03:00
Brian Pursley 7a39dfc2d3 Change kubectl diff to exclude managedFields by default
Changes kubectl diff to exclude managedFields by default.
Adds a new --show-managed-fields flag that allows you to
include managed fields in the diff.

Kubernetes-commit: e88470c31f74cbb1ed685ef1bc2ba91e74fc1c5e
2022-07-27 12:53:32 -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
Davanum Srinivas d3700ce217 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>

Kubernetes-commit: a9593d634c6a053848413e600dadbf974627515f
2022-07-19 20:54:13 -04:00
Davanum Srinivas ded91f6296 Adjust for os/exec changes in 1.19
https://tip.golang.org/doc/go1.19#os-exec-path

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

Kubernetes-commit: 1f557035e053e2f604b228815241d59123f9915c
2022-07-22 17:42:11 -04:00
Sean Sullivan e23896b42c gofmt update
Kubernetes-commit: d84abe868d673de917b5714cd2460f21413ac745
2022-07-24 23:46:44 -07:00
Sean Sullivan acec06e5c9 disallow --force and --prune in client-side apply
Kubernetes-commit: e02a26d74a2e346b4a5607c99180e5b748923e5f
2022-07-24 16:26:57 -07:00
muyangren2 d6613187f4 Typo in kubectl delete --help 111302
Kubernetes-commit: b7e82ad2fd03b23b53ab94de66c5b3c30863724a
2022-07-21 20:42:30 +08:00
xiaopeng bc02b7b600 add setErr
Signed-off-by: xiaopeng <hanxiaop8@outlook.com>

Kubernetes-commit: 8839609868d4b2b5887eefdbb216c1ed5b848edc
2022-06-21 17:57:48 +08:00
xiaopeng a833054047 replace deprecated setoutput
Kubernetes-commit: 48629bcc0588773bc837d1cc69cab8b21a2057e0
2022-04-05 14:04:22 +08:00
Arda Güçlü cd97087d9c Add unit tests for explain command
Kubernetes-commit: 8eb50efefc8aea38fc63b79994561667c86c520c
2022-06-30 12:48:32 +03:00
Lee Verberne f713c9d779 Fix error message in attach_test.go
Co-authored-by: Akanksha kumari <akankshakumari393@gmail.com>

Kubernetes-commit: 1dd3879da03b6a8cdef423c9fef096d1a4814448
2022-07-17 12:38:26 +02:00
Lee Verberne 3e07021378 Fix incorrect message when attaching to ephemeral containers
Kubernetes-commit: 8d4ec9ac9dcf45b66111075a1b67043c2885b263
2022-07-15 19:23:24 +02:00
Abirdcfly 3614667477 cleanup: remove duplicate import
Signed-off-by: Abirdcfly <fp544037857@gmail.com>

Kubernetes-commit: 00b9ead02c37921011ebe5293558cea5277cd295
2022-04-24 20:58:04 +08:00
Marcus Puckett d9fb1ec8c6 Revert "Move kubectl wait to informers with a cache to avoid hanging due to objects disappearing from the cluster"
Kubernetes-commit: 5badb731a895dfa0a188a3f4aec2d3edfe709b12
2022-07-18 08:48:29 -07:00
Arda Güçlü 9a8dad8efc Change error messages
Kubernetes-commit: e41f2a1d7c06a1fd49bc5055fba7e0437ecaec0e
2022-07-07 15:05:17 +03:00
Arda Güçlü bdaa26ce9e Validate dry-run and force flags can not be used same time in replace
This PR adds validation to check that `dry-run` and `force` flags
are not used at the same time. Because when `force` flag is set,
`dry-run` is discarded and objects are replaced already.

Kubernetes-commit: e389b2723e6af29a9f70509fe8ff6e5121c30681
2022-06-01 14:01:40 +03:00
Marcus Puckett 3c41b7369c Add cases for when --timeout=0 and tests
Kubernetes-commit: 61ebfdb2018b0dae4e364d0170610ccdec18b2c1
2022-07-01 16:49:31 -07:00
Marcus Puckett 533f9479cc Revert "Move kubectl wait to informers with a cache to avoid hanging due to objects disappearing from the cluster (#108086)"
This reverts commit 171431ca2c009c0a576fa288b7df892b59299389.

Kubernetes-commit: a6bd1e6ac90f3ccbbe527e44e3217a8420636c41
2022-07-01 13:45:18 -07:00
Marcus Puckett 2e38f74bcc Move kubectl wait to informers with a cache to avoid hanging due to objects disappearing from the cluster (#108086)
* move to using informers for getObjAndCheckCondition

* move to using informers for IsDeleted

* update tests to handle new informer methodology

* set minimum timeout to 1s because informer can't handle less for caching reasons

* fix null return for deletes issue

Kubernetes-commit: 171431ca2c009c0a576fa288b7df892b59299389
2022-06-30 20:54:29 +00:00
Arda Güçlü 477b1e041a Add license header into rollout status test file
Kubernetes-commit: ab15419356a47112492b04ad6434bec30c827a11
2022-06-13 16:03:37 +03:00
Arda Güçlü 195784dabe Add unit tests for rollout status command
This commit makes adjustments in rollout status command to make it
unit testable. In addition to that, unit tests for rollout status
command is added.

Kubernetes-commit: f21e5983a95ab4e72aa0ddd9ae465a613490b422
2022-06-13 15:10:26 +03:00
Arda Güçlü bdb13380d9 Enable resource builder flattening in rollout status
Kubernetes-commit: 26002596b2f078ad9c151ba477b1cfa61f883df3
2022-06-06 10:29:13 +03:00
Arda Güçlü f95d534f9d Move resource lookup into its own function
Kubernetes-commit: 66c2f6069ebbfa41d0bef0f3959abda59b8483f1
2022-06-28 09:30:06 +03:00
Arda Güçlü df792c788b Use error wrapping in patchSimple
Kubernetes-commit: 22b43d4edbee4f89984d1b905adb1f905f3ab90b
2022-06-22 10:22:27 +03:00
Arda Güçlü b19c7e78f3 Move getPatchType logic back to main function
Kubernetes-commit: 4ed5653a0bc8ca53ca6a917e634457bd7a2d8dae
2022-06-22 09:35:49 +03:00
Arda Güçlü 351ebce2c4 Stop passing source as parameter
This commit removes passing source field as parameter. Instead,
this commit returns error verb and error functions to caller function.
Caller function can add source field by generating correct message.

Kubernetes-commit: d336f7df874dc978ebd97971e1fc93d891c21e7d
2022-06-20 10:04:18 +03:00