// handleDelete handles the deletion of a landscaper deployment.
handleDelete handles the deletion of a landscaper deployment.
// handleDelete handles the deletion of a landscaper deployment .
func (c *Controller) handleDelete(ctx context.Context, log logr.Logger, deployment *lssv1alpha1.LandscaperDeployment) error {
	var (
		err             error
		currOp          = "Delete"
		removeFinalizer bool
	)
	if deployment.Status.InstanceRef != nil && !deployment.Status.InstanceRef.IsEmpty() {
		removeFinalizer, err = c.ensureDeleteInstanceForDeployment(ctx, log, deployment)
		if err != nil {
			return err
		}
	} else {
		removeFinalizer = true
	}
	if removeFinalizer {
		controllerutil.RemoveFinalizer(deployment, lssv1alpha1.LandscaperServiceFinalizer)
		if err = c.Client().Update(ctx, deployment); err != nil {
			return lsserrors.NewWrappedError(err, currOp, "RemoveFinalizer", err.Error())
		}
	}
	return nil
}
func ( c * Controller ) handleDelete ( ctx context . Context , log logr . Logger , deployment * lssv1alpha1 . LandscaperDeployment ) error { var ( err error currOp = " " removeFinalizer bool ) if deployment . Status . InstanceRef != nil && ! deployment . Status . InstanceRef . IsEmpty ( ) { removeFinalizer , err = c . ensureDeleteInstanceForDeployment ( ctx , log , deployment ) if err != nil { return err } } else { removeFinalizer = true } if removeFinalizer { controllerutil . RemoveFinalizer ( deployment , lssv1alpha1 . LandscaperServiceFinalizer ) if err = c . Client ( ) . Update ( ctx , deployment ) ; err != nil { return lsserrors . NewWrappedError ( err , currOp , " " , err . Error ( ) ) } } return nil }
handleDelete handles the deletion of a landscaper deployment.
handleDelete handles the deletion of a landscaper deployment .