Documentation ¶
Index ¶
- func LeaderElectionRecordToLeaseSpec(ler *le.Record) coordinationv1.LeaseSpec
- func LeaseSpecToLeaderElectionRecord(spec *coordinationv1.LeaseSpec) *le.Record
- func New(ns string, name string, ...) (le.Lock, error)
- func NewFromKubeconfig(ns string, name string, rlc Config, kubeconfig *restclient.Config, ...) (le.Lock, error)
- type Config
- type EventRecorder
- type LeaseLock
- func (ll *LeaseLock) Create(ctx context.Context, ler le.Record) error
- func (ll *LeaseLock) Describe() string
- func (ll *LeaseLock) Get(ctx context.Context) (*le.Record, []byte, error)
- func (ll *LeaseLock) Identity() string
- func (ll *LeaseLock) RecordEvent(s string)
- func (ll *LeaseLock) Update(ctx context.Context, ler le.Record) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LeaderElectionRecordToLeaseSpec ¶
func LeaderElectionRecordToLeaseSpec(ler *le.Record) coordinationv1.LeaseSpec
func LeaseSpecToLeaderElectionRecord ¶
func LeaseSpecToLeaderElectionRecord(spec *coordinationv1.LeaseSpec) *le.Record
func New ¶
func New(ns string, name string, coordinationClient coordinationv1client.CoordinationV1Interface, rlc Config) (le.Lock, error)
New will create a lock of a given type according to the input parameters
func NewFromKubeconfig ¶
func NewFromKubeconfig(ns string, name string, rlc Config, kubeconfig *restclient.Config, renewDeadline time.Duration) (le.Lock, error)
NewFromKubeconfig will create a lock of a given type according to the input parameters. Timeout set for a client used to contact to Kubernetes should be lower than RenewDeadline to keep a single hung request from forcing a leader loss. Setting it to max(time.Second, RenewDeadline/2) as a reasonable heuristic.
Types ¶
type Config ¶
type Config struct { // Identity is the unique string identifying a lease holder across // all participants in an election. Identity string // EventRecorder is optional. EventRecorder EventRecorder }
Config common data that exists across different resource locks
type EventRecorder ¶
type EventRecorder interface {
Eventf(obj runtime.Object, eventType, reason, message string, args ...interface{})
}
EventRecorder records a change in the ResourceLock.
type LeaseLock ¶
type LeaseLock struct { // LeaseMeta should contain a Name and a Namespace of a // LeaseMeta object that the LeaderElector will attempt to lead. LeaseMeta metav1.ObjectMeta Client coordinationv1client.LeasesGetter LockConfig Config // contains filtered or unexported fields }
func (*LeaseLock) Describe ¶
Describe is used to convert details on current resource lock into a string
func (*LeaseLock) RecordEvent ¶
RecordEvent in leader election while adding meta-data
Click to show internal directories.
Click to hide internal directories.