Commit Graph

30 Commits

Author SHA1 Message Date
Maciej Szulik df17d35554 Add --for=create option to kubectl wait
Kubernetes-commit: aaf1fb50f32466aa5e845ff423fc4acc8f04c402
2024-07-08 13:32:31 +02:00
Maciej Szulik 1c0cdd03d9 kubectl wait: split condition functions into separate files
Kubernetes-commit: 6eec9d6b21316833bc66b1586207d5b2326b35fe
2024-07-03 11:27:08 +02:00
Jordan Liggitt 3f7d004bdf Revert "Add new --wait-for-creation flag in kubectl wait command"
This reverts commit e24b9a022f3b1e97ea538c9754d4d38f119f275e.

Kubernetes-commit: 8d67437865a8e1abaed0b813d6913b412f7ed2b4
2024-06-21 12:13:08 -04:00
Arda Güçlü 64a1fe556b Add new --wait-for-creation flag in kubectl wait command
kubectl wait command errors out when the waited resource does not exist.
But we need to provide a way to the users about intentionally also waiting for
the creation of resources.

This PR introduces a new flag to cover waiting for the creation of resources
with preserving the default behavior.

Kubernetes-commit: e24b9a022f3b1e97ea538c9754d4d38f119f275e
2024-01-26 15:53:55 +03:00
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
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
Andrea Hoffer b676723184 Update CLI help text for grammar and consistency
Kubernetes-commit: a86380c7813a6d0cfa248c9165c878038730526a
2023-06-12 15:55:59 -04: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ü b06f43ae7f kubectl wait: wire generic context (#114574)
* Wire generic context to better handle timeout

* Add integration test for wait timeout

* kubectl wait: Fix integration test always passing issue

Currently, `kubectl wait` integration test always passes even if
it gets an error. Problem is object check is done after errexit is
turned off.

This PR redirects error to output and correctly assures that
object is expected status and if it is not, test should fail.

Kubernetes-commit: 369534c6ec625ed9b251b453215c9578cdeb59bc
2022-12-23 08:15:57 +00:00
jonyhy96 1906bda541 feat: make jsonpath wait logics consistent with condition
Signed-off-by: jonyhy96 <hy352144278@gmail.com>

Kubernetes-commit: 7a1493be5679ed3ec85b7fdef685c7e6b580e8e4
2022-06-29 12:28:24 +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
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
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
W. Trevor King cdcb6ed356 kubectl: Document --for's Unicode case-folding condition-value comparison
When the wait command was added in 76794643c5 (add wait, 2018-05-18, #64034),
this comparison was via ToLower.  It moved to use Unicode case folding
[1,2] in f4940cf55f (Staticcheck:
vendor/k8s.io/kubectl/pkg/scale|describe/versioned|cmd/top|cmd/util/editor|cmd/top,
2020-01-21, #87403).

[1]: https://pkg.go.dev/strings#EqualFold
[2]: http://www.unicode.org/reports/tr30/tr30-1.html

Kubernetes-commit: f69d52338b21da938021af37f49f49a83016534d
2021-08-30 19:41:08 -07:00
Chok Yip Lau 8d1dfaeedb Added JSONPath wait for kubectl wait
Co-authored-by: Eddie Zaneski <eddiezane@gmail.com>

Kubernetes-commit: 8fcf98ec3bb16ddf32ea1688752e6b7e2a14eaa4
2021-10-04 16:19:08 -04:00
Andrea Hoffer 09ed00ef49 Minor adjustments to descriptions and example text
Kubernetes-commit: 6b736f348483bb6b20d4633319305960f4d9e4c1
2021-07-06 15:05:26 -04:00
Ling Samuel cf01e4558b fix kubectl wait --for=delete ignore not found
Signed-off-by: Ling Samuel <lingsamuelgrace@gmail.com>

Kubernetes-commit: 99cdc37e2a89df1f86045f295916c00266e4d034
2020-11-19 14:48:28 +08:00
changshuchao 7d1600ce5a code cleanup for kubectl apply_edit_last_applied.go,wait.go,completion.go,cp.go
Signed-off-by: changshuchao <chang.shuchao1@zte.com.cn>

Kubernetes-commit: e229ca33cff782e0bf602f43312b9a168aa58c4c
2021-03-07 05:04:30 +08:00
Nick Maliwacki a84bbc2022 wait ensures observedGeneration >= generation
Kubernetes-commit: 44aff9917566885ab5d8cc712a3330bac1923214
2020-12-20 00:35:31 -08:00
chymy 942504dab2 add i18n.T in waitExample
Signed-off-by: chymy <chang.min1@zte.com.cn>

Kubernetes-commit: e472a7724bc6f105e07c9a0d6362cd0e8390d2fe
2021-01-28 10:35:21 +08:00
熊中谅10171568 1d4e99420e add more usage info for kubectl wait option --for
add more usage info for kubectl wait option --for

Kubernetes-commit: 033e4a58182fb90e36d5f6cc3f291a2ea114998a
2020-12-29 21:08:03 +08:00
Karl 'NaN' Wikström 38408eaa8c cleanup: use i18n.T on all command descriptions
cleanup: use i18n.T only on string literals

cleanup: sort imports

Add i18n dependency for wait.go

Remove translation on envResource

cleanup: translate string instead of variable

cleanup: sort imports

cleanup: translate string literal only

Kubernetes-commit: cc8428566ea7160c5b20410a1bee53ca7ddb998e
2020-10-09 13:16:13 +02:00
zhouya0 3c159f733a kubectl wait add ignore not found flag
Kubernetes-commit: 3d2d95e99dd1219331ef3d32e63b39122a0ef116
2020-05-11 09:19:10 +08:00
Jordan Liggitt 0c62c9a83a client-go dynamic client: add context to callers
Kubernetes-commit: b7c2faf26c2a25427794478c6265e6d55e8acb5a
2020-03-06 10:17:41 -05:00
gavinfish 275513cb52 Staticcheck: vendor/k8s.io/kubectl/pkg/scale|describe/versioned|cmd/top|cmd/util/editor|cmd/top
Kubernetes-commit: f4940cf55fd7c2787b370464d491a764c4febd78
2020-01-21 10:13:10 +08:00
Sean Sullivan c6063dd846 Move pkg/kubectl/cmd/{command} to staging
Kubernetes-commit: 0e0ea523392f1121f61f99ac30a9bc2043eaed90
2019-08-01 11:01:40 -07:00