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: StringThe name of the lease object.
namespace: StringThe namespace of the lease object.
identity: StringThe identity to use when the lease is acquired.
Typically this value will directly correspond to the name of the pod running this process.
manager: StringThe 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: DurationThe 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: DurationThe duration that the current lease holder will retry refreshing the lease.
Core clients default this value to 10 seconds.
retry_period: DurationThe duration which leader elector clients should wait between tries of actions.
Core clients default this value to 2 seconds.
api_timeout: DurationAPI 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:
namemust not be an empty string;namespacemust not be an empty string;identitymust not be an empty string;managermust not be an empty string;lease_durationmust be greater thanrenew_deadline;renew_deadlinemust be greater than(JITTER_FACTOR * retry_period.num_seconds());lease_durationmust be >= 1 second;renew_deadlinemust be >= 1 second;retry_periodmust be >= 1 second;apu_timeoutmust be >= 1 second;