client-go: k8s.io/client-go/tools/leaderelection/resourcelock Index | Files

package resourcelock

import "k8s.io/client-go/tools/leaderelection/resourcelock"

Index

Package Files

configmaplock.go endpointslock.go interface.go

Constants

const (
    LeaderElectionRecordAnnotationKey = "control-plane.alpha.kubernetes.io/leader"
    EndpointsResourceLock             = "endpoints"
    ConfigMapsResourceLock            = "configmaps"
)

type ConfigMapLock Uses

type ConfigMapLock struct {
    // ConfigMapMeta should contain a Name and a Namespace of an
    // ConfigMapMeta object that the Leadercmlector will attempt to lead.
    ConfigMapMeta metav1.ObjectMeta
    Client        corev1client.ConfigMapsGetter
    LockConfig    ResourceLockConfig
    // contains filtered or unexported fields
}

func (*ConfigMapLock) Create Uses

func (cml *ConfigMapLock) Create(ler LeaderElectionRecord) error

Create attempts to create a LeadercmlectionRecord annotation

func (*ConfigMapLock) Describe Uses

func (cml *ConfigMapLock) Describe() string

Describe is used to convert details on current resource lock into a string

func (*ConfigMapLock) Get Uses

func (cml *ConfigMapLock) Get() (*LeaderElectionRecord, error)

Get returns the cmlection record from a ConfigMap Annotation

func (*ConfigMapLock) Identity Uses

func (cml *ConfigMapLock) Identity() string

returns the Identity of the lock

func (*ConfigMapLock) RecordEvent Uses

func (cml *ConfigMapLock) RecordEvent(s string)

RecordEvent in leader cmlection while adding meta-data

func (*ConfigMapLock) Update Uses

func (cml *ConfigMapLock) Update(ler LeaderElectionRecord) error

Update will update and existing annotation on a given resource.

type EndpointsLock Uses

type EndpointsLock struct {
    // EndpointsMeta should contain a Name and a Namespace of an
    // Endpoints object that the LeaderElector will attempt to lead.
    EndpointsMeta metav1.ObjectMeta
    Client        corev1client.EndpointsGetter
    LockConfig    ResourceLockConfig
    // contains filtered or unexported fields
}

func (*EndpointsLock) Create Uses

func (el *EndpointsLock) Create(ler LeaderElectionRecord) error

Create attempts to create a LeaderElectionRecord annotation

func (*EndpointsLock) Describe Uses

func (el *EndpointsLock) Describe() string

Describe is used to convert details on current resource lock into a string

func (*EndpointsLock) Get Uses

func (el *EndpointsLock) Get() (*LeaderElectionRecord, error)

Get returns the election record from a Endpoints Annotation

func (*EndpointsLock) Identity Uses

func (el *EndpointsLock) Identity() string

returns the Identity of the lock

func (*EndpointsLock) RecordEvent Uses

func (el *EndpointsLock) RecordEvent(s string)

RecordEvent in leader election while adding meta-data

func (*EndpointsLock) Update Uses

func (el *EndpointsLock) Update(ler LeaderElectionRecord) error

Update will update and existing annotation on a given resource.

type Interface Uses

type Interface interface {
    // Get returns the LeaderElectionRecord
    Get() (*LeaderElectionRecord, error)

    // Create attempts to create a LeaderElectionRecord
    Create(ler LeaderElectionRecord) error

    // Update will update and existing LeaderElectionRecord
    Update(ler LeaderElectionRecord) error

    // RecordEvent is used to record events
    RecordEvent(string)

    // Identity will return the locks Identity
    Identity() string

    // Describe is used to convert details on current resource lock
    // into a string
    Describe() string
}

Interface offers a common interface for locking on arbitrary resources used in leader election. The Interface is used to hide the details on specific implementations in order to allow them to change over time. This interface is strictly for use by the leaderelection code.

func New Uses

func New(lockType string, ns string, name string, client corev1.CoreV1Interface, rlc ResourceLockConfig) (Interface, error)

Manufacture will create a lock of a given type according to the input parameters

type LeaderElectionRecord Uses

type LeaderElectionRecord struct {
    HolderIdentity       string      `json:"holderIdentity"`
    LeaseDurationSeconds int         `json:"leaseDurationSeconds"`
    AcquireTime          metav1.Time `json:"acquireTime"`
    RenewTime            metav1.Time `json:"renewTime"`
    LeaderTransitions    int         `json:"leaderTransitions"`
}

LeaderElectionRecord is the record that is stored in the leader election annotation. This information should be used for observational purposes only and could be replaced with a random string (e.g. UUID) with only slight modification of this code. TODO(mikedanese): this should potentially be versioned

type ResourceLockConfig Uses

type ResourceLockConfig struct {
    Identity      string
    EventRecorder record.EventRecorder
}

ResourceLockConfig common data that exists across different resource locks

Package resourcelock imports 7 packages (graph) and is imported by 32 packages. Updated 2017-10-18. Refresh now. Tools for package owners.