Commit Graph

668 Commits

Author SHA1 Message Date
Andreas Karis 1b4373f26b Improve conditionFuncFor expression parsing for wait --for jsonpath
Make it possible to parse jsonpath filter expressions: Split
jsonpath expressions on single '=' only and leave '==' as part of the
string.

Reported-at: https://github.com/kubernetes/kubernetes/issues/119206
Signed-off-by: Andreas Karis <ak.karis@gmail.com>

Kubernetes-commit: 41889984304c44b879d8bcae92c9ed7aa3fd8c67
2023-06-20 03:34:50 +02: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
Maciej Szulik e0816cbaa1 Remove long/golang version information making short the default
Kubernetes-commit: 3f07fc3acc9014f33fb9bbde12937b35e3f48c75
2023-03-17 15:20:56 +01:00
aimuz 2ec2847518 fix: kubectl expose fails for apps with same-port, different-protocol
Fixed: https://github.com/kubernetes/kubernetes/issues/114402
Signed-off-by: aimuz <mr.imuz@gmail.com>

Kubernetes-commit: e5116a39c96a78511fc8c0da4730d3262b2c121c
2023-06-19 09:58:54 +08:00
minherz bd48fd4c16 chore: address review feedback
add integration test to wait for json without value
refactor JSON condition value parsing and validating
adjusting test to reflect the error message refactoring

Kubernetes-commit: dbdd861ea366af50fb74983426587dad7222cb89
2023-06-29 00:36:07 -07:00
minherz baf5b1c999 chore(fix): test jsonpath condition parsing errors
Test parsing logic for invalid JSONPath condition formats,
excluding JSON path expression parsing.
Fix error in parsing logic

Kubernetes-commit: a5c4fbe979188335f4f414a1aef303f1c0f353f6
2023-06-03 21:40:16 -07:00
minherz 0c921b2f35 Support JSONPath condition without value
Extend current JSONPath condition logic to return from wait on "any" value.
Change parsing JSONPath input to support the syntax without value.
Match any simple or complex (object or array) values.

Kubernetes-commit: 9d3e55ec431f3f595a7739fcc592602f7cc1d69b
2023-05-21 19:03:24 -07:00
Frederic Branczyk eca0d6a8b1 kubectl: Allow parallelizing diffing
Kubernetes-commit: 1cfb932111e53e296a3b0f001b6f5d03f212f32f
2023-06-05 13:18:49 +02:00
Varsha Prasad Narsing a49f0e6d53 [refactor] refactoring flags and options in Expose cmd
This PR decouples the command options from the input flags.
The input flags from the command are then translated to
options which are further used while running the command.

Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>

Kubernetes-commit: 8f229057484453bd1b820d00c940efbbc56addc5
2023-05-05 11:31:03 -04:00
Ritikaa96 d5606514d9 Adding review changs to update
Kubernetes-commit: fff5b35023b2b9cd9ec681e188c077225d1293a3
2023-06-16 16:33:07 +05:30
Ritikaa96 13f1a1e448 Updated kubectl explain help output
Kubernetes-commit: e213448db12abb91450028c89a9e8330d693a110
2023-06-14 12:33:18 +05:30
Ritikaa96 26d4d62bb1 Details added in kubectl explain help
Kubernetes-commit: 8c06ca68d7d3a286425ab89bcafb109e83199a94
2023-06-13 17:01:46 +05:30
Andrea Hoffer b676723184 Update CLI help text for grammar and consistency
Kubernetes-commit: a86380c7813a6d0cfa248c9165c878038730526a
2023-06-12 15:55:59 -04:00
carlory f4c3a1c36a fix Cronjob status.lastSuccessfulTime not populated by a manually triggered job
Kubernetes-commit: f2a64cb91d7cf7216db60c2e1c8b1e530c85f94f
2023-06-07 19:01:51 +08:00
Mihai Costea 900a7ab781 Remove StartupProbe on debug with pod copy
Kubernetes-commit: ea6495e8284b7eccd292c67e21a32081c4a29967
2023-06-07 15:40:10 +03:00
TommyStarK e88f1b3589 kubectl: use bytes.Buffer.String
Signed-off-by: TommyStarK <thomasmilox@gmail.com>

Kubernetes-commit: da4a8d831b933475cfdb20cb7e6d0ed027d516eb
2023-06-04 15:45:24 +02:00
LronDC 22b4cf895f Optimize usage message of commands which have subcommands.
Signed-off-by: LronDC <lun.su@daocloud.io>

Kubernetes-commit: 15678e4a67e1b725368ca1bd3a97b670c5d97776
2023-05-10 18:10:28 +08:00
HirazawaUi 08300912da fix fd leaks and failed file removing for pkg kubectl and pod-security-admission
Kubernetes-commit: b94c6daa0b7602e2d30e35cf2b94f9d1e8fde56e
2023-05-03 01:36:46 +08:00
Stephen Kitt cfd2169f88 cli: replace intstr.FromInt with intstr.FromInt32
This touches cases where FromInt() is used on numeric constants, or
values which are already int32s, or int variables which are defined
close by and can be changed to int32s with little impact.

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

Kubernetes-commit: 45836971f27ca70cd7742e8ee66e99e3c648cf9f
2023-03-14 16:17:48 +01:00
Keita Mochizuki f118a887e5 Fix: Restricted profile comply with PSS (#117543)
* restricted profile comply with PSA v1.27

* add test case

* Reflect review comments

* Reflect review comments 2

* Reflect review comments 3

Kubernetes-commit: 0813904404034fd760d8e7e1e3ca5444610a7fa8
2023-05-24 20:16:49 +09:00
Filip Křepinský a71362e506 rename err to lookupErr
Kubernetes-commit: bafae5c0764a222e336de1d7ce2645186bb455dd
2023-05-15 16:41:54 +02:00
Filip Křepinský 3ebdc043ce fix false positive kubectl plugin unit tests
- test.args should be passed instead of the os.Args of the test framework
  to prevent simple invocation of kubectl without args that could
  manifest in false positive test runs
- plugin execution should have a different test path
- tests should invoke functioning kubectl commands instead of the mock
  ones to ensure the correct subcommand is executed without a failure

Kubernetes-commit: 8b9cbe62025da49a31518870f2aea0ce9797d3ce
2023-05-11 20:12:38 +02:00
adil ghaffar 76565cfba8 Changing annotate PrintFlags from annotate to annotated
Kubernetes-commit: d6e488b998effbda9675d4dc3d297a142a4079f7
2023-05-16 14:39:15 +03:00
Arda Güçlü 1fecf3ab58 Simplify plugin resolution check function
Kubernetes-commit: daebf1c735df845f5e8429381593a4de1762361e
2023-05-15 08:51:46 +03:00
Arda Güçlü f53c5f479c Use getter function for plugin subcommand resolution
Plugin subcommand resolution is relatively less used than the
builtin subcommands. That's why, instead always initializing a
hash map on memory, it would be better to use a getter function only
serves as needed.

In addition to that this function will be exported that external
libraries can use it.

Kubernetes-commit: 4634073d0b979d2827106a0a1010456ac420baa8
2023-05-10 10:41:43 +03:00
gxwilkerson33 1b129f017b add no resources found message to rollout-status command (#117884)
* add no resources found message to rollout-status command

* return err if not nil before no resource message

Kubernetes-commit: a5575425b039bf7c15dfaa9a7acf257fdc4fde3f
2023-05-11 23:28:58 +00:00
Chris Bandy facdb16b53 Replace os.Setenv with testing.T.Setenv in tests
T.Setenv ensures that the environment is returned to its prior state
when the test ends. It also panics when called from a parallel test to
prevent racy test interdependencies.

Kubernetes-commit: 2181eea48435310d1b6e366ea8db2968c4941b93
2023-04-15 10:09:47 -05:00
m.nabokikh deeeaea2a7 KEP-3325: Promote SelfSubjectReview to GA
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

Kubernetes-commit: 40de26dcff80f29380a4ba90a93ce3ece7482b78
2023-05-02 01:26:20 +02:00
charles-chenzz 0d2299217d reduce util pkg for testing in tempdir.
Kubernetes-commit: aaa30439bdda1589eacc7be8547c297a73e346b9
2023-04-18 11:18:10 +08:00
Brian Pursley 198d4bdc32 Fix typo in kubectl api-resources help text for --categories flag
Kubernetes-commit: 6d8a0100f70f2df61340bd52385841c5df7bda58
2023-04-25 20:26:10 -04:00
aditya-K2 9ce8f5e1fc Remove repeated info
Kubernetes-commit: 28ac914bc54a946188b98254dfe85a0d721e22f5
2023-04-24 10:22:08 +05:30
aditya-K2 c60b12df3a Move info where its most relevant
Kubernetes-commit: e0d5c4aa93e6279979a60db5c8357799c2d54a8f
2023-04-08 00:27:13 +05:30
aditya-K2 06bf9e7cc8 Update `kubectl edit` documentation
kubectl defaults to /bin/bash if the SHELL environment variable isn't
set. Updating the docs to mention that you can override the shell
location by setting the SHELL environment variable.

Kubernetes-commit: 0a508ad8067dcc8d48420daca536fca09df5846b
2023-03-13 00:01:39 +05:30
Tim Hockin c131fb884e Replace uses of ObjectReflectDiff with cmp.Diff
ObjectReflectDiff is already a shim over cmp.Diff, so no actual output
or behavior changes

Kubernetes-commit: bc302fa4144d21a338683cd83701661f97be4aba
2023-03-23 11:34:03 -07:00
Tim Hockin ece694d5d1 Replace uses of diff.ObjectDiff with cmp.Diff
ObjectDiff is already a shim over cmp.Diff, so no actual output or
behavior changes

Kubernetes-commit: 29c0b73d640b6e50c4f2dfeee7b07ca66a530dbd
2023-03-23 11:29:01 -07:00
Tim Hockin a431fc3d05 Replace apimachinery diff.StringDiff with cmp
I forced failures of most of these tests and verified readability

Kubernetes-commit: 97bab44cae3857710bfb072d233e654784082ee3
2023-03-23 11:10:32 -07:00
Arda Güçlü da6bd32b26 More migrations from genericclioptions to genericiooptions
Kubernetes-commit: b4e4db336f690606fcdb69bf1d3109f4edc9bd7b
2023-04-05 15:14:51 +03:00
Arda Güçlü 3f05cfcd78 Migrate genericclioptions.IOStreams usage to genericiooptions
Kubernetes-commit: 00c30941260a27e6929aef84c7fdbc8f1508518c
2023-04-05 14:07:46 +03:00
Arda Güçlü 5de8e8f539 kubectl events: Support fully qualified names for --for flag
Users can pass resources into `kubectl events` command via `--for` flag,
if they have desire to only get events for the resource they specify.

However, current `kubectl events` does not support passing fully qualified
names(e.g. `replicasets.apps`, `cronjobs.v1.batch`, etc.). This PR adds support
for this.

Kubernetes-commit: 457bb58ebbf5a863ce30f51c53a84bc41c2380dc
2023-03-31 12:34:00 +03:00
Katrina Verey 03f092a1af Use standard *.kubernetes.io instead of *.k8s.io for ApplySet
Kubernetes-commit: a0cff30104ea950a5cc733a109e7f9084275e49e
2023-03-20 18:21:04 -04:00
justinsb 11dbc9b97f prunev2: find resources in parallel
To improve wall-clock speed, we run list operations in parallel.  This
particularly helps when the round-trip time is high.

We issue requests as quickly as possible, kube-apiservers should all
have priority and fairness at this point and we don't want to
duplicate/fight that system.

Kubernetes-commit: 82eee59d0feb4b303e6ef78ebb7ec646a059f266
2023-03-14 12:45:45 +00:00
natasha41575 178e0df9e6 Update kubectl kustomize to kyaml/v0.14.1, cmd/config/v0.11.1, api/v0.13.2, kustomize/v5.0.1
Kubernetes-commit: 09e6e4db1d2fd901601f5ed23c7c29b7dc310649
2023-03-14 11:40:28 -05:00
Alexander Zielenski 86033dd377 enable openapiv3 by default
Kubernetes-commit: ce3385ab1f9b0cce4d972b8888584dd0fe295c70
2023-03-08 13:15:56 -08:00
justinsb 62b0fbdb7a kubectl prunev2: Refactor the applyset to be more reusable
This enables sharing with diff.

Kubernetes-commit: d016fdcc834099dee721f42a384e1bc1f710e599
2023-03-14 12:12:00 +00:00
justinsb 180519d83a kubectl diff: refactor tracker into a separate type
This means that we can reuse the logic even if we swap out the pruner.

Kubernetes-commit: 9c5c8b243d1a6524e38d847c54de3046b332d373
2023-03-14 12:06:44 +00: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
Katrina Verey a038484b5c Allow conformant CRDs to be ApplySet parents
Kubernetes-commit: 923d9b63fd87e9446f5746f544237c7e0de009a0
2023-03-07 11:29:50 -05:00
Katrina Verey ca98377c3e Applyset dry run tests + ID value (#116265)
* Test for ApplySet with --dry-run=client|server

* Use the real format for ApplySet ID

* Incorporate feedback

* Adjustments from rebase

Kubernetes-commit: 6a31757f45693fec5ea4723bcb405ce4437e31ca
2023-03-15 11:17:56 +00:00
Justin SB 0567f1e464 prunev2: Implement basic pruning
Implement the basic prune strategy where we find-by-label and then
delete unknown objects.

Kubernetes-commit: f17a319dc60374a46be1b37a453227d134ac479e
2023-02-22 21:40:25 -05:00