Merge pull request #6904 from bakito/master

print gvk information on existing resource conflict
pull/7364/head
Matthew Fisher 5 years ago committed by GitHub
commit d2b89119a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -33,7 +33,8 @@ func existingResourceConflict(resources kube.ResourceList) error {
} }
helper := resource.NewHelper(info.Client, info.Mapping) 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) { if apierrors.IsNotFound(err) {
return nil return nil
} }
@ -41,7 +42,7 @@ func existingResourceConflict(resources kube.ResourceList) error {
return errors.Wrap(err, "could not get information about the resource") 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_kind: %s, new_kind: %s", info.Namespace, info.Name, existing.GetObjectKind().GroupVersionKind(), info.Mapping.GroupVersionKind)
}) })
return err return err
} }

Loading…
Cancel
Save