Documentation
¶
Index ¶
- Variables
- func CreateLeaseHolderIdentity(clusterID, xpdbPodID, podNamespace, podName string) string
- type Service
- func (s *Service) LocalLock(ctx context.Context, leaseHolderIdentity, namespace string, ...) error
- func (s *Service) LocalUnlock(ctx context.Context, leaseHolderIdentity, namespace string, ...) error
- func (s *Service) Lock(ctx context.Context, leaseHolderIdentity, namespace string, ...) error
- func (s *Service) Unlock(ctx context.Context, leaseHolderIdentity, namespace string, ...) error
Constants ¶
This section is empty.
Variables ¶
var LeaseDurationSeconds = int32(5)
LeaseDurationSeconds is the default duration for the Lease object. This defines the duration for how long a given xpdb is locked. The value should be higher than the sum of the following durations:
- the round-trip latency across all clusters (1-2 seconds)
- the processing time of the x-pdb http server (<1 second)
- the time kube-apiserver needs to process the x-pdb admission control response and the time it takes until the desired action (evict/delete pod) is observable through the kube-apiserver (1-2 seconds)
- a generous surcharge (1-... seconds)
Functions ¶
func CreateLeaseHolderIdentity ¶
CreateLeaseHolderIdentity creates the leaseHolderIdentity for the lease used to perform the locking mechanism of the xpdb disruptions.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is responsible to manage the locks used to guarantee that there are no race conditions when doing disruptions across clusters.
func NewService ¶
func NewService( logger *logr.Logger, client client.Client, reader client.Reader, stateClientPool *stateclient.ClientPool, leaseNamespace string, remoteEndpoints []string, ) *Service
NewService creates a new Service instance.
func (*Service) LocalLock ¶
func (s *Service) LocalLock(ctx context.Context, leaseHolderIdentity, namespace string, selector *metav1.LabelSelector) error
LocalLock creates / updates leases on the local cluster to disallow concurrent pod disruptions for a given namespace and selector.
func (*Service) LocalUnlock ¶
func (s *Service) LocalUnlock(ctx context.Context, leaseHolderIdentity, namespace string, selector *metav1.LabelSelector) error
LocalUnlock deletes leases on the local cluster to allow pod disruptions to happen.