resourcelock

package
v1.5.0-beta.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LeaderElectionRecordAnnotationKey = "control-plane.alpha.kubernetes.io/leader"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointsLock

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

func (*EndpointsLock) Create

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

Create attempts to create a LeaderElectionRecord annotation

func (*EndpointsLock) Describe

func (el *EndpointsLock) Describe() string

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

func (*EndpointsLock) Get

func (*EndpointsLock) Identity

func (el *EndpointsLock) Identity() string

returns the Identity of the lock

func (*EndpointsLock) RecordEvent

func (el *EndpointsLock) RecordEvent(s string)

RecordEvent in leader election while adding meta-data

func (*EndpointsLock) Update

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

Update will update and existing annotation on a given resource.

type Interface

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.

type LeaderElectionRecord

type LeaderElectionRecord struct {
	HolderIdentity       string           `json:"holderIdentity"`
	LeaseDurationSeconds int              `json:"leaseDurationSeconds"`
	AcquireTime          unversioned.Time `json:"acquireTime"`
	RenewTime            unversioned.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

type ResourceLockConfig struct {
	Identity      string
	EventRecorder record.EventRecorder
}

ResourceLockConfig common data that exists across different resource locks

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL