Skip to content

Commit a1f5700

Browse files
authored
chore: report executed pod name when action failed (#10008)
1 parent e2f4da8 commit a1f5700

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/controller/lifecycle/kbagent.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ func (a *kbagent) callActionWithSelector(ctx context.Context, spec *appsv1.Actio
358358
return nil, errors.Wrapf(err, "http error occurred when executing action %s at pod %s", lfa.name(), pod.Name)
359359
}
360360
if len(rsp.Error) > 0 {
361-
return nil, a.formatError(lfa, rsp)
361+
return nil, a.formatError(lfa, rsp, pod.Name)
362362
}
363363
// take first non-nil output
364364
if output == nil && rsp.Output != nil {
@@ -385,9 +385,9 @@ func (a *kbagent) serverEndpoint(pod *corev1.Pod) (string, int32, error) {
385385
return host, port, nil
386386
}
387387

388-
func (a *kbagent) formatError(lfa lifecycleAction, rsp proto.ActionResponse) error {
388+
func (a *kbagent) formatError(lfa lifecycleAction, rsp proto.ActionResponse, podName string) error {
389389
wrapError := func(err error) error {
390-
return errors.Wrapf(err, "action: %s, error: %s", lfa.name(), rsp.Message)
390+
return errors.Wrapf(err, "action: %s, executed on pod: %s, error: %s", lfa.name(), podName, rsp.Message)
391391
}
392392
err := proto.Type2Error(rsp.Error)
393393
switch {

0 commit comments

Comments
 (0)