Allow service controller to indicate that it has cleared load balancer resources #32157
Description
Issue:
Create a type=LoadBalancer service.
When the user creates the service, service controller creates the corresponding cloud specific Load balancer. User can watch for load balancer to be created using ServiceStatus.
When user deletes the service, service controller deletes the corresponding LB. There is no way for user to know that service controller has deleted the LB.
What you expected to happen:
A way to figure out if cloud LB resources were deleted.
Proposal:
Use the finalizer/termination condition flow as in namespaces.
Service controller adds itself as a finalizer to each service.
When user deletes a service, apiserver sets the terminating condition on it.
Service controller observes that the service went in termination condition, it deletes the cloud resources it had created for that service, removes itself as finalizer and then deletes the service if there are no more finalizers.