fix: handle resource apiVersion upgrades

Signed-off-by: Jacob LeGrone <git@jacob.work>
pull/7625/head
Jacob LeGrone 6 years ago
parent 2cd3d12acd
commit d8bff5fdbd
No known key found for this signature in database
GPG Key ID: 5FD0852F235368C1

@ -42,6 +42,17 @@ func existingResourceConflict(resources kube.ResourceList) error {
return errors.Wrap(err, "could not get information about the resource")
}
// For compatibility reasons Kubernetes serves some resources at multiple API versions,
// while only using one storage version:
// https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/20190802-dynamic-coordinated-storage-version.md
//
// This can cause helper.Get to detect an existing resource at the (new) version that
// Helm is attempting to create. If the new version matches the one returned by the
// API server, then it should be safe to continue with installation/upgrade.
if existing.GetObjectKind().GroupVersionKind() == info.Mapping.GroupVersionKind {
return nil
}
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

Loading…
Cancel
Save