Class LeaderElectionConfig
Configuration information for the LeaderElector class.
Namespace: Neon.Kube.K8s
Assembly: Neon.Kube.dll
Syntax
public sealed class LeaderElectionConfig
Constructors
LeaderElectionConfig(string, string, string, TimeSpan, TimeSpan, TimeSpan)
Constructor.
Declaration
public LeaderElectionConfig(string @namespace, string leaseName, string identity, TimeSpan leaseDuration = default, TimeSpan renewDeadline = default, TimeSpan retryPeriod = default)
Parameters
Type | Name | Description |
---|---|---|
string | namespace | Identifies the namespace where the lease will be hosted. |
string | leaseName | Specifies the lease name used to manage elections. Note that this must be a valid Kubernetes resource name. |
string | identity | Specifies the unique identity of the entity using LeaderElector to run for the leadership role. This will typically be passed as the host pod name. noteIt's very important that the identifiers used by different leader candidates be unique. As mentioned above, the host pod name is a great option for most situations but this could also be a UUID or some other identity scheme which guarentees uniqueness. |
TimeSpan | leaseDuration | Optionally specifies the interval a follower must wait before attempting to become the leader. This defaults to 30 seconds. |
TimeSpan | renewDeadline | Optionally specifies the interval when the leader will attempt to renew the lease before abandonding leadership. This defaults to 15 seconds. |
TimeSpan | retryPeriod | Optionally specifies the interval that LeaderElector instances should wait before retrying any actions. This defaults to 2 seconds. |
Properties
Identity
Returns the unique identity of the entity using the elector to running for the leadership role. This is typically the hosting pod name.
Declaration
public string Identity { get; }
Property Value
Type | Description |
---|---|
string |
K8s
Returns the IKubernetes client to be used to communicate with the cluster.
Declaration
public IKubernetes K8s { get; }
Property Value
Type | Description |
---|---|
IKubernetes |
LeaseDuration
Returns the interval a follower must wait before attempting to become the leader.
Declaration
public TimeSpan LeaseDuration { get; }
Property Value
Type | Description |
---|---|
TimeSpan |
LeaseName
Returns the lease name.
Declaration
public string LeaseName { get; }
Property Value
Type | Description |
---|---|
string |
Namespace
Returns the Kubernetes namespace where the lease will reside.
Declaration
public string Namespace { get; }
Property Value
Type | Description |
---|---|
string |
RenewDeadline
Returns the interval durning the leader will attempt to renew the lease before abandonding leadership upon failures.
Declaration
public TimeSpan RenewDeadline { get; }
Property Value
Type | Description |
---|---|
TimeSpan |
RetryPeriod
The interval that LeaderElector instances should wait before retrying any actions.
Declaration
public TimeSpan RetryPeriod { get; }
Property Value
Type | Description |
---|---|
TimeSpan |