Skip to content

Commit 02312a1

Browse files
benoittgtgjenkins8
andcommitted
Update pkg/cmd/flags.go
Co-authored-by: George Jenkins <gvjenkins@gmail.com> Signed-off-by: Benoit Tigeot <benoittgt@users.noreply.github.com> Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
1 parent 277c140 commit 02312a1

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

pkg/cmd/flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func AddWaitFlag(cmd *cobra.Command, wait *kube.WaitStrategy) {
5959
cmd.Flags().Var(
6060
newWaitValue(kube.HookOnlyStrategy, wait),
6161
"wait",
62-
"wait until resources are ready (up to --timeout). Values: 'watcher', 'hookOnly' (default), and 'legacy'",
62+
"if specified, wait until resources are ready (up to --timeout). Values: 'watcher' (default), 'hookOnly', and 'legacy'.",
6363
)
6464
// Sets the strategy to use the watcher strategy if `--wait` is used without an argument
6565
cmd.Flags().Lookup("wait").NoOptDefVal = string(kube.StatusWatcherStrategy)

pkg/kube/statuswait.go

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (w *statusWaiter) WatchUntilReady(resourceList ResourceList, timeout time.D
6565
if timeout == 0 {
6666
timeout = DefaultStatusWatcherTimeout
6767
}
68-
ctx, cancel := context.WithTimeout(context.Background(), timeout)
68+
ctx, cancel := w.contextWithTimeout(timeout)
6969
defer cancel()
7070
slog.Debug("waiting for resources", "count", len(resourceList), "timeout", timeout)
7171
sw := watcher.NewDefaultStatusWatcher(w.client, w.restMapper)
@@ -86,33 +86,21 @@ func (w *statusWaiter) WatchUntilReady(resourceList ResourceList, timeout time.D
8686
}
8787

8888
func (w *statusWaiter) Wait(resourceList ResourceList, timeout time.Duration) error {
89-
<<<<<<< HEAD
90-
ctx, cancel := w.contextWithTimeout(timeout)
91-
||||||| parent of 86f98f870 (Prevent surprising failure with SDK when timeout is not set)
92-
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
93-
=======
9489
if timeout == 0 {
9590
timeout = DefaultStatusWatcherTimeout
9691
}
97-
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
98-
>>>>>>> 86f98f870 (Prevent surprising failure with SDK when timeout is not set)
92+
ctx, cancel := w.contextWithTimeout(timeout)
9993
defer cancel()
10094
slog.Debug("waiting for resources", "count", len(resourceList), "timeout", timeout)
10195
sw := watcher.NewDefaultStatusWatcher(w.client, w.restMapper)
10296
return w.wait(ctx, resourceList, sw)
10397
}
10498

10599
func (w *statusWaiter) WaitWithJobs(resourceList ResourceList, timeout time.Duration) error {
106-
<<<<<<< HEAD
107-
ctx, cancel := w.contextWithTimeout(timeout)
108-
||||||| parent of 86f98f870 (Prevent surprising failure with SDK when timeout is not set)
109-
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
110-
=======
111100
if timeout == 0 {
112101
timeout = DefaultStatusWatcherTimeout
113102
}
114-
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
115-
>>>>>>> 86f98f870 (Prevent surprising failure with SDK when timeout is not set)
103+
ctx, cancel := w.contextWithTimeout(timeout)
116104
defer cancel()
117105
slog.Debug("waiting for resources", "count", len(resourceList), "timeout", timeout)
118106
sw := watcher.NewDefaultStatusWatcher(w.client, w.restMapper)
@@ -123,16 +111,10 @@ func (w *statusWaiter) WaitWithJobs(resourceList ResourceList, timeout time.Dura
123111
}
124112

125113
func (w *statusWaiter) WaitForDelete(resourceList ResourceList, timeout time.Duration) error {
126-
<<<<<<< HEAD
127-
ctx, cancel := w.contextWithTimeout(timeout)
128-
||||||| parent of 86f98f870 (Prevent surprising failure with SDK when timeout is not set)
129-
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
130-
=======
131114
if timeout == 0 {
132115
timeout = DefaultStatusWatcherTimeout
133116
}
134-
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
135-
>>>>>>> 86f98f870 (Prevent surprising failure with SDK when timeout is not set)
117+
ctx, cancel := w.contextWithTimeout(timeout)
136118
defer cancel()
137119
slog.Debug("waiting for resources to be deleted", "count", len(resourceList), "timeout", timeout)
138120
sw := watcher.NewDefaultStatusWatcher(w.client, w.restMapper)

0 commit comments

Comments
 (0)