print gvk information on existing resource conflict

Signed-off-by: Marc Brugger <github@bakito.ch>
pull/6904/head
Marc Brugger 6 years ago
parent bd1f4a443e
commit 8231b17c31

@ -33,7 +33,8 @@ func existingResourceConflict(resources kube.ResourceList) error {
}
helper := resource.NewHelper(info.Client, info.Mapping)
if _, err := helper.Get(info.Namespace, info.Name, info.Export); err != nil {
existing, err := helper.Get(info.Namespace, info.Name, info.Export)
if err != nil {
if apierrors.IsNotFound(err) {
return nil
}
@ -41,7 +42,7 @@ func existingResourceConflict(resources kube.ResourceList) error {
return errors.Wrap(err, "could not get information about the resource")
}
return fmt.Errorf("existing resource conflict: kind: %s, namespace: %s, name: %s", info.Mapping.GroupVersionKind.Kind, info.Namespace, info.Name)
return fmt.Errorf("existing resource conflict: namespace: %s, name: %s, existing: [gvk: %s, ] / new: [gvk: %s]", info.Namespace, info.Name, existing.GetObjectKind().GroupVersionKind(), info.Mapping.GroupVersionKind)
})
return err
}

Loading…
Cancel
Save