mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
Document RetryError properly
This commit is contained in:
parent
73bc9861d2
commit
a15013ec8b
@ -131,11 +131,11 @@ func GetInstanceProviderID(ctx context.Context, cloud Interface, nodeName types.
|
|||||||
// irrespective of the ImplementedElsewhere error. Additional finalizers for
|
// irrespective of the ImplementedElsewhere error. Additional finalizers for
|
||||||
// LB services must be managed in the alternate implementation.
|
// LB services must be managed in the alternate implementation.
|
||||||
type LoadBalancer interface {
|
type LoadBalancer interface {
|
||||||
// TODO: Break this up into different interfaces (LB, etc) when we have more than one type of service
|
|
||||||
// GetLoadBalancer returns whether the specified load balancer exists, and
|
// GetLoadBalancer returns whether the specified load balancer exists, and
|
||||||
// if so, what its status is.
|
// if so, what its status is.
|
||||||
// Implementations must treat the *v1.Service parameter as read-only and not modify it.
|
// Implementations must treat the *v1.Service parameter as read-only and not modify it.
|
||||||
// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager
|
// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager.
|
||||||
|
// TODO: Break this up into different interfaces (LB, etc) when we have more than one type of service
|
||||||
GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)
|
GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)
|
||||||
// GetLoadBalancerName returns the name of the load balancer. Implementations must treat the
|
// GetLoadBalancerName returns the name of the load balancer. Implementations must treat the
|
||||||
// *v1.Service parameter as read-only and not modify it.
|
// *v1.Service parameter as read-only and not modify it.
|
||||||
@ -143,7 +143,13 @@ type LoadBalancer interface {
|
|||||||
// EnsureLoadBalancer creates a new load balancer 'name', or updates the existing one. Returns the status of the balancer
|
// EnsureLoadBalancer creates a new load balancer 'name', or updates the existing one. Returns the status of the balancer
|
||||||
// Implementations must treat the *v1.Service and *v1.Node
|
// Implementations must treat the *v1.Service and *v1.Node
|
||||||
// parameters as read-only and not modify them.
|
// parameters as read-only and not modify them.
|
||||||
// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager
|
// Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager.
|
||||||
|
//
|
||||||
|
// Implementations may return a (possibly wrapped) api.RetryError to enforce
|
||||||
|
// backing off at a fixed duration. This can be used for cases like when the
|
||||||
|
// load balancer is not ready yet (e.g., it is still being provisioned) and
|
||||||
|
// polling at a fixed rate is preferred over backing off exponentially in
|
||||||
|
// order to minimize latency.
|
||||||
EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)
|
EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)
|
||||||
// UpdateLoadBalancer updates hosts under the specified load balancer.
|
// UpdateLoadBalancer updates hosts under the specified load balancer.
|
||||||
// Implementations must treat the *v1.Service and *v1.Node
|
// Implementations must treat the *v1.Service and *v1.Node
|
||||||
|
@ -410,6 +410,7 @@ func (c *Controller) syncLoadBalancerIfNeeded(ctx context.Context, service *v1.S
|
|||||||
klog.V(4).Infof("LoadBalancer for service %s implemented by a different controller %s, Ignoring error", key, c.cloud.ProviderName())
|
klog.V(4).Infof("LoadBalancer for service %s implemented by a different controller %s, Ignoring error", key, c.cloud.ProviderName())
|
||||||
return op, nil
|
return op, nil
|
||||||
}
|
}
|
||||||
|
// Use %w deliberately so that a returned RetryError can be handled.
|
||||||
return op, fmt.Errorf("failed to ensure load balancer: %w", err)
|
return op, fmt.Errorf("failed to ensure load balancer: %w", err)
|
||||||
}
|
}
|
||||||
if newStatus == nil {
|
if newStatus == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user