Injected kubernetes client need by the methods to create, renew, and delete leases.
Injected lease renewal service need to support automatic (background) lease renewals.
The holder of the lease.
The namespace in which the lease is to be acquired.
The name of the lease to be acquired; if not provided, the namespace is used.
The duration in seconds for which the lease is to be held; if not provided, the default value is used.
Readonly
clientInjected kubernetes client need by the methods to create, renew, and delete leases.
Readonly
renewalInjected lease renewal service need to support automatic (background) lease renewals.
Static
Readonly
DEFAULT_The default duration in seconds for which the lease is to be held before being considered expired.
The duration in seconds for which the lease is held before being considered expired. By default, the duration is set to 20 seconds. It is recommended to renew the lease at 50% of the duration to prevent unexpected expiration.
The holder of the lease.
The name of the lease.
The namespace in which the lease is to be acquired. By default, the namespace is used as the lease name. The defaults assume there is only a single deployment in a given namespace.
The identifier of the scheduled lease renewal task.
Internal setter for the scheduleId property. External callers should not use this method.
The identifier of the scheduled lease renewal task.
Acquires the lease. If the lease is already acquired, it checks if the lease is expired or held by the same process. If the lease is expired, it creates a new lease. If the lease is held by the same process, it renews the lease. If the lease is held by another process, then an exception is thrown.
Attempts to acquire the lease, by calling the acquire method. If an exception is thrown, it is caught and false is returned. If the lease is successfully acquired, true is returned; otherwise, false is returned.
true if the lease is successfully acquired; otherwise, false.
Attempts to release the lease, by calling the release method. If an exception is thrown, it is caught and false is returned. If the lease is successfully released, true is returned; otherwise, false is returned.
true if the lease is successfully released; otherwise, false.
Attempts to renew the lease, by calling the renew method. If an exception is thrown, it is caught and false is returned. If the lease is successfully renewed, true is returned; otherwise, false is returned.
true if the lease is successfully renewed; otherwise, false.
Concrete implementation of a Kubernetes based time-based mutually exclusive lock via the Coordination API. Applies a namespace/deployment wide lock to ensure that only one process, machine, and user can hold the lease at a time. The lease is automatically renewed in the background to prevent expiration and ensure the holder maintains the lease. If the process die, the lease is automatically released after the lease duration.