Documentation ¶
Index ¶
- Constants
- type Config
- type Interface
- type LeaderElectionRecord
- type ProvisionPVCLock
- func (pl *ProvisionPVCLock) Create(ler LeaderElectionRecord) error
- func (pl *ProvisionPVCLock) Describe() string
- func (pl *ProvisionPVCLock) Get() (*LeaderElectionRecord, error)
- func (pl *ProvisionPVCLock) Identity() string
- func (pl *ProvisionPVCLock) RecordEvent(s string)
- func (pl *ProvisionPVCLock) Update(ler LeaderElectionRecord) error
Constants ¶
const (
// LeaderElectionRecordAnnotationKey is the annotation key for records
LeaderElectionRecordAnnotationKey = "control-plane.alpha.kubernetes.io/leader"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.8.0
type Config struct { Identity string EventRecorder record.EventRecorder }
Config common data that exists across different resource locks
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 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 ProvisionPVCLock ¶
type ProvisionPVCLock struct { // PVCMeta should contain a Name and a Namespace of a PVC // object that the LeaderElector will attempt to lead. PVCMeta metav1.ObjectMeta Client clientset.Interface LockConfig Config // contains filtered or unexported fields }
ProvisionPVCLock is a lock on an existing PVC to provision a PV for
func (*ProvisionPVCLock) Create ¶
func (pl *ProvisionPVCLock) Create(ler LeaderElectionRecord) error
Create is not allowed, the PVC should already exist
func (*ProvisionPVCLock) Describe ¶
func (pl *ProvisionPVCLock) Describe() string
Describe is used to convert details on current resource lock into a string
func (*ProvisionPVCLock) Get ¶
func (pl *ProvisionPVCLock) Get() (*LeaderElectionRecord, error)
Get returns the LeaderElectionRecord
func (*ProvisionPVCLock) Identity ¶
func (pl *ProvisionPVCLock) Identity() string
Identity returns the Identity of the lock
func (*ProvisionPVCLock) RecordEvent ¶
func (pl *ProvisionPVCLock) RecordEvent(s string)
RecordEvent in leader election while adding meta-data
func (*ProvisionPVCLock) Update ¶
func (pl *ProvisionPVCLock) Update(ler LeaderElectionRecord) error
Update will update and existing annotation on a given resource.