From 6707e9d96caaaa16916a5ef17f8c56665b479683 Mon Sep 17 00:00:00 2001 From: Maciej Szulik Date: Fri, 24 Jun 2022 09:07:44 +0200 Subject: [PATCH] Improve run and debug attach message upon failure Kubernetes-commit: 43c2ae479f056f9e420062e11f3251b7095c3108 --- pkg/cmd/debug/debug.go | 2 +- pkg/cmd/run/run.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/debug/debug.go b/pkg/cmd/debug/debug.go index 046ea1d4c..f4b4b6b3d 100644 --- a/pkg/cmd/debug/debug.go +++ b/pkg/cmd/debug/debug.go @@ -802,7 +802,7 @@ func (o *DebugOptions) handleAttachPod(ctx context.Context, f cmdutil.Factory, n } if err := opts.Run(); err != nil { - fmt.Fprintf(opts.ErrOut, "Error attaching, falling back to logs: %v\n", err) + fmt.Fprintf(opts.ErrOut, "warning: couldn't attach to pod/%s, falling back to streaming logs: %v\n", podName, err) return logOpts(f, pod, opts) } return nil diff --git a/pkg/cmd/run/run.go b/pkg/cmd/run/run.go index 73656aa21..dd154ce24 100644 --- a/pkg/cmd/run/run.go +++ b/pkg/cmd/run/run.go @@ -486,7 +486,7 @@ func handleAttachPod(f cmdutil.Factory, podClient corev1client.PodsGetter, ns, n } if err := opts.Run(); err != nil { - fmt.Fprintf(opts.ErrOut, "Error attaching, falling back to logs: %v\n", err) + fmt.Fprintf(opts.ErrOut, "warning: couldn't attach to pod/%s, falling back to streaming logs: %v\n", name, err) return logOpts(f, pod, opts) } return nil