UPSTREAM: 75785: add annotation from namespace controller to indicate why deletion failed (reverts)
@@ -134,9 +134,6 @@ func (d *namespacedResourcesDeleter) Delete(nsName string) error {
// there may still be content for us to remove
estimate, err := d.deleteAllContent(namespace)
- // we don't care about errors on reporting the status message update
- // we unconditionally set this value to ensure that we clear it when deletion is complete
- _, _ = d.retryOnConflictError(namespace, d.updateSetDeletionFailureFunc(err))
if err != nil {
return err
}
@@ -298,20 +295,6 @@ func (d *namespacedResourcesDeleter) updateNamespaceStatusFunc(namespace *v1.Nam
return d.nsClient.UpdateStatus(&newNamespace)
}
-// updateSetDeletionFailureFunc will set an annotation indicating that the namespace controller has failed to delete all content
-func (d *namespacedResourcesDeleter) updateSetDeletionFailureFunc(err error) func(namespace *v1.Namespace) (*v1.Namespace, error) {
- errorAnnotationName := "namespace-controller.kcm.openshift.io/deletion-error"
- return func(namespace *v1.Namespace) (*v1.Namespace, error) {
- newNamespace := namespace.DeepCopy()
- if err == nil || len(err.Error()) == 0 {
- delete(newNamespace.Annotations, errorAnnotationName)
- } else {
- newNamespace.Annotations[errorAnnotationName] = err.Error()
- }
- return d.nsClient.Update(newNamespace)
- }
-}
-
// finalized returns true if the namespace.Spec.Finalizers is an empty list
func finalized(namespace *v1.Namespace) bool {
return len(namespace.Spec.Finalizers) == 0
