Skip to content

Commit

Permalink
Better logging for the apply task (#1663)
Browse files Browse the repository at this point in the history
which includes the GVK of the object in question to speed up debugging when applying fails.

Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
  • Loading branch information
Aleksey Dukhovniy committed Aug 27, 2020
1 parent 506cebb commit ad70978
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/engine/task/task_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func applyResources(rr []runtime.Object, ctx Context) ([]runtime.Object, error)
switch {
case apierrors.IsNotFound(err): // create resource if it doesn't exist
if err := addLastAppliedConfigAnnotation(r); err != nil {
return nil, fmt.Errorf("failed to add last applied config annotation to %s/%s: %w", key.Namespace, key.Name, err)
return nil, fmt.Errorf("failed to add last applied config annotation to a %s %s: %w", r.GetObjectKind().GroupVersionKind(), key, err)
}

err = ctx.Client.Create(context.TODO(), r)
Expand All @@ -137,7 +137,7 @@ func applyResources(rr []runtime.Object, ctx Context) ([]runtime.Object, error)
default: // update existing resource
err := patchResource(r, existing, ctx)
if err != nil {
return nil, fmt.Errorf("failed to patch %s/%s: %w", key.Namespace, key.Name, err)
return nil, fmt.Errorf("failed to patch a %s %s: %w", r.GetObjectKind().GroupVersionKind(), key, err)
}
applied = append(applied, r)
}
Expand Down

0 comments on commit ad70978

Please sign in to comment.