@@ -13,10 +13,10 @@ import (
13
13
"k8s.io/apimachinery/pkg/util/uuid"
14
14
"k8s.io/cli-runtime/pkg/genericclioptions"
15
15
"k8s.io/client-go/kubernetes"
16
- "k8s.io/client-go/tools/watch"
17
16
coreclient "k8s.io/client-go/kubernetes/typed/core/v1"
18
17
restclient "k8s.io/client-go/rest"
19
18
"k8s.io/client-go/tools/remotecommand"
19
+ "k8s.io/client-go/tools/watch"
20
20
"k8s.io/kubernetes/pkg/client/conditions"
21
21
"k8s.io/kubernetes/pkg/util/interrupt"
22
22
"log"
@@ -222,8 +222,11 @@ func (o *DebugOptions) Run() error {
222
222
return err
223
223
}
224
224
watcher , err := o .CoreClient .Pods (pod .Namespace ).Watch (v1 .SingleObject (pod .ObjectMeta ))
225
+ if err != nil {
226
+ return err
227
+ }
225
228
// FIXME: hard code -> config
226
- ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Minute )
229
+ ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Minute )
227
230
defer cancel ()
228
231
log .Println ("waiting for forked container running..." )
229
232
event , err := watch .UntilWithoutRetry (ctx , watcher , conditions .PodRunning )
@@ -284,7 +287,7 @@ func (o *DebugOptions) Run() error {
284
287
log .Printf ("failed to delete pod %s, consider manual deletion." , pod .Name )
285
288
}
286
289
}
287
- }).Run (fn );
290
+ }).Run (fn )
288
291
}
289
292
290
293
if err := t .Safe (withCleanUp ); err != nil {
@@ -379,4 +382,3 @@ func copyAndStripPod(pod *corev1.Pod, targetContainer string) *corev1.Pod {
379
382
380
383
return copied
381
384
}
382
-
0 commit comments