Add possibility to skip waiting in kpt live apply#4599
Draft
mozesl-nokia wants to merge 1 commit into
Draft
Conversation
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new --wait flag to kpt live apply intended to allow exiting without waiting for resources to become ready/reconciled, and adds an e2e test case plus supporting test resources.
Changes:
- Added a
--waitboolean flag (defaulttrue) tokpt live apply. - Added a new
live-apply/no-waite2e test case and package resources. - Adjusted apply execution to short-circuit output/printing when
--wait=false.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
commands/live/apply/cmdapply.go |
Adds --wait flag and changes apply execution flow based on it. |
e2e/testdata/live-apply/no-wait/config.yaml |
New e2e scenario invoking kpt live apply --wait=false and asserting stdout. |
e2e/testdata/live-apply/no-wait/resources/Kptfile |
Test package metadata for the new e2e scenario. |
e2e/testdata/live-apply/no-wait/resources/cm.yaml |
A simple ConfigMap resource used by the no-wait e2e scenario. |
e2e/testdata/live-apply/no-wait/resources/resourcegroup.yaml |
ResourceGroup inventory manifest used by the no-wait e2e scenario. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+283
to
+286
| if !r.wait { | ||
| _, _ = fmt.Fprintf(r.ioStreams.Out, "Apply started in the background") | ||
| return nil | ||
| } |
Comment on lines
+93
to
+94
| c.Flags().BoolVar(&r.wait, "wait", true, | ||
| "Whether or not to wait for the resources to be ready") |
Comment on lines
+15
to
+20
| parallel: true | ||
| kptArgs: | ||
| - "live" | ||
| - "apply" | ||
| - "--wait=false" | ||
| stdOut: Apply started in the background |
| } | ||
|
|
||
| if !r.wait { | ||
| _, _ = fmt.Fprintf(r.ioStreams.Out, "Apply started in the background") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a
--waitflag so that it is possible to not wait for resources to be ready. Useful when wait conditions are not always as simple as Ready=True. The default is stilltrue.Further improvements: Add support for
kubectl wait --for=...style wait conditions, or possibility to define such conditions in the Kptfile or resource metadata.