Struct kube_coordinate::Config
source · pub struct Config {
pub name: String,
pub namespace: String,
pub identity: String,
pub manager: String,
pub lease_duration: Duration,
pub renew_deadline: Duration,
pub retry_period: Duration,
pub api_timeout: Duration,
}
Expand description
Configuration for leader election.
Fields§
§name: String
The name of the lease object.
namespace: String
The namespace of the lease object.
identity: String
The identity to use when the lease is acquired.
Typically this value will directly correspond to the name of the pod running this process.
manager: String
The name to use for Server-Side Apply management group.
Typically this value corresponds to the name of the group of controllers of which this
leader elector is a part. Note well that this value should be the same across the
entire management group and should be distinct from the identity
parameter.
lease_duration: Duration
The duration that non-leader candidates will wait to force acquire leadership. This is measured against time of last observed ack.
A client needs to wait a full lease_duration
without observing a change to
the record before it can attempt to take over. When all clients are
shutdown and a new set of clients are started with different names against
the same leader record, they must wait the full lease_duration
before
attempting to acquire the lease. Thus lease_duration
should be as short as
possible (within your tolerance for clock skew rate) to avoid possible
long waits in such a scenario.
Core clients default this value to 15 seconds.
renew_deadline: Duration
The duration that the current lease holder will retry refreshing the lease.
Core clients default this value to 10 seconds.
retry_period: Duration
The duration which leader elector clients should wait between tries of actions.
Core clients default this value to 2 seconds.
api_timeout: Duration
API timeout to use for interacting with the K8s API.
Implementations§
source§impl Config
impl Config
sourcepub fn manager(self, val: &str) -> Self
pub fn manager(self, val: &str) -> Self
Set the name to use for Server-Side Apply management group.
sourcepub fn lease_duration(self, val: Duration) -> Self
pub fn lease_duration(self, val: Duration) -> Self
Set the duration that non-leader candidates will wait to force acquire leadership. This is measured against time of last observed ack.
sourcepub fn renew_deadline(self, val: Duration) -> Self
pub fn renew_deadline(self, val: Duration) -> Self
Set the duration that the current lease holder will retry refreshing the lease.
sourcepub fn retry_period(self, val: Duration) -> Self
pub fn retry_period(self, val: Duration) -> Self
Set the duration which leader elector clients should wait between tries of actions.
sourcepub fn api_timeout(self, val: Duration) -> Self
pub fn api_timeout(self, val: Duration) -> Self
Set the API timeout to use for interacting with the K8s API.
sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Finish building leader elector config by validating this config builder.
§Errors
Will return Error::ConfigError
if this member’s fields are invalid according to the
following constraints:
name
must not be an empty string;namespace
must not be an empty string;identity
must not be an empty string;manager
must not be an empty string;lease_duration
must be greater thanrenew_deadline
;renew_deadline
must be greater than(JITTER_FACTOR * retry_period.num_seconds())
;lease_duration
must be >= 1 second;renew_deadline
must be >= 1 second;retry_period
must be >= 1 second;apu_timeout
must be >= 1 second;