Documentation ¶
Index ¶
- Constants
- type AuthConfigMapLock
- func (cml *AuthConfigMapLock) Create(ler LeaderElectionRecord) error
- func (cml *AuthConfigMapLock) Describe() string
- func (cml *AuthConfigMapLock) Get() (*LeaderElectionRecord, error)
- func (cml *AuthConfigMapLock) Identity() string
- func (cml *AuthConfigMapLock) Update(ler LeaderElectionRecord) error
- type BusinessConfigMapLock
- func (cml *BusinessConfigMapLock) Create(ler LeaderElectionRecord) error
- func (cml *BusinessConfigMapLock) Describe() string
- func (cml *BusinessConfigMapLock) Get() (*LeaderElectionRecord, error)
- func (cml *BusinessConfigMapLock) Identity() string
- func (cml *BusinessConfigMapLock) Update(ler LeaderElectionRecord) error
- type Config
- type Interface
- func NewAuth(name string, client authv1.AuthV1Interface, rlc Config) Interface
- func NewBusiness(name string, client businessv1.BusinessV1Interface, rlc Config) Interface
- func NewMonitor(name string, client monitorv1.MonitorV1Interface, rlc Config) Interface
- func NewNotify(name string, client notifyv1.NotifyV1Interface, rlc Config) Interface
- func NewPlatform(name string, client platformv1.PlatformV1Interface, rlc Config) Interface
- type LeaderElectionRecord
- type MonitorConfigMapLock
- func (cml *MonitorConfigMapLock) Create(ler LeaderElectionRecord) error
- func (cml *MonitorConfigMapLock) Describe() string
- func (cml *MonitorConfigMapLock) Get() (*LeaderElectionRecord, error)
- func (cml *MonitorConfigMapLock) Identity() string
- func (cml *MonitorConfigMapLock) Update(ler LeaderElectionRecord) error
- type NotifyConfigMapLock
- func (cml *NotifyConfigMapLock) Create(ler LeaderElectionRecord) error
- func (cml *NotifyConfigMapLock) Describe() string
- func (cml *NotifyConfigMapLock) Get() (*LeaderElectionRecord, error)
- func (cml *NotifyConfigMapLock) Identity() string
- func (cml *NotifyConfigMapLock) Update(ler LeaderElectionRecord) error
- type PlatformConfigMapLock
- func (cml *PlatformConfigMapLock) Create(ler LeaderElectionRecord) error
- func (cml *PlatformConfigMapLock) Describe() string
- func (cml *PlatformConfigMapLock) Get() (*LeaderElectionRecord, error)
- func (cml *PlatformConfigMapLock) Identity() string
- func (cml *PlatformConfigMapLock) Update(ler LeaderElectionRecord) error
Constants ¶
const (
// LeaderElectionRecordAnnotationKey is key of leader election record annotation.
LeaderElectionRecordAnnotationKey = "tke/leader"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfigMapLock ¶
type AuthConfigMapLock struct { // ConfigMapMeta should contain a Name and a Namespace of a // ConfigMapMeta object that the LeaderElector will attempt to lead. ConfigMapMeta metav1.ObjectMeta Client authv1client.ConfigMapsGetter LockConfig Config // contains filtered or unexported fields }
BusinessConfigMapLock defines the structure of using configmap resources to implement distributed locks.
func (*AuthConfigMapLock) Create ¶
func (cml *AuthConfigMapLock) Create(ler LeaderElectionRecord) error
Create attempts to create a LeaderElectionRecord annotation
func (*AuthConfigMapLock) Describe ¶
func (cml *AuthConfigMapLock) Describe() string
Describe is used to convert details on current resource lock into a string
func (*AuthConfigMapLock) Get ¶
func (cml *AuthConfigMapLock) Get() (*LeaderElectionRecord, error)
Get returns the election record from a ConfigMap Annotation
func (*AuthConfigMapLock) Identity ¶
func (cml *AuthConfigMapLock) Identity() string
Identity returns the Identity of the lock
func (*AuthConfigMapLock) Update ¶
func (cml *AuthConfigMapLock) Update(ler LeaderElectionRecord) error
Update will update an existing annotation on a given resource.
type BusinessConfigMapLock ¶
type BusinessConfigMapLock struct { // ConfigMapMeta should contain a Name and a Namespace of a // ConfigMapMeta object that the LeaderElector will attempt to lead. ConfigMapMeta metav1.ObjectMeta Client businessv1client.ConfigMapsGetter LockConfig Config // contains filtered or unexported fields }
BusinessConfigMapLock defines the structure of using configmap resources to implement distributed locks.
func (*BusinessConfigMapLock) Create ¶
func (cml *BusinessConfigMapLock) Create(ler LeaderElectionRecord) error
Create attempts to create a LeaderElectionRecord annotation
func (*BusinessConfigMapLock) Describe ¶
func (cml *BusinessConfigMapLock) Describe() string
Describe is used to convert details on current resource lock into a string
func (*BusinessConfigMapLock) Get ¶
func (cml *BusinessConfigMapLock) Get() (*LeaderElectionRecord, error)
Get returns the election record from a ConfigMap Annotation
func (*BusinessConfigMapLock) Identity ¶
func (cml *BusinessConfigMapLock) Identity() string
Identity returns the Identity of the lock
func (*BusinessConfigMapLock) Update ¶
func (cml *BusinessConfigMapLock) Update(ler LeaderElectionRecord) error
Update will update an existing annotation on a given resource.
type Config ¶
type Config struct {
Identity string
}
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 // 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 NewAuth ¶
func NewAuth(name string, client authv1.AuthV1Interface, rlc Config) Interface
NewAuth will create a lock of a given type according to the input parameters
func NewBusiness ¶
func NewBusiness(name string, client businessv1.BusinessV1Interface, rlc Config) Interface
NewBusiness will create a lock of a given type according to the input parameters
func NewMonitor ¶
func NewMonitor(name string, client monitorv1.MonitorV1Interface, rlc Config) Interface
NewMonitor will create a lock of a given type according to the input parameters
func NewNotify ¶
func NewNotify(name string, client notifyv1.NotifyV1Interface, rlc Config) Interface
NewNotify will create a lock of a given type according to the input parameters
func NewPlatform ¶
func NewPlatform(name string, client platformv1.PlatformV1Interface, rlc Config) Interface
NewPlatform will create a lock of a given type according to the input parameters
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.
type MonitorConfigMapLock ¶
type MonitorConfigMapLock struct { // ConfigMapMeta should contain a Name and a Namespace of a // ConfigMapMeta object that the LeaderElector will attempt to lead. ConfigMapMeta metav1.ObjectMeta Client monitorv1client.ConfigMapsGetter LockConfig Config // contains filtered or unexported fields }
MonitorConfigMapLock defines the structure of using configmap resources to implement distributed locks.
func (*MonitorConfigMapLock) Create ¶
func (cml *MonitorConfigMapLock) Create(ler LeaderElectionRecord) error
Create attempts to create a LeaderElectionRecord annotation
func (*MonitorConfigMapLock) Describe ¶
func (cml *MonitorConfigMapLock) Describe() string
Describe is used to convert details on current resource lock into a string
func (*MonitorConfigMapLock) Get ¶
func (cml *MonitorConfigMapLock) Get() (*LeaderElectionRecord, error)
Get returns the election record from a ConfigMap Annotation
func (*MonitorConfigMapLock) Identity ¶
func (cml *MonitorConfigMapLock) Identity() string
Identity returns the Identity of the lock
func (*MonitorConfigMapLock) Update ¶
func (cml *MonitorConfigMapLock) Update(ler LeaderElectionRecord) error
Update will update an existing annotation on a given resource.
type NotifyConfigMapLock ¶
type NotifyConfigMapLock struct { // ConfigMapMeta should contain a Name and a Namespace of a // ConfigMapMeta object that the LeaderElector will attempt to lead. ConfigMapMeta metav1.ObjectMeta Client notifyv1client.ConfigMapsGetter LockConfig Config // contains filtered or unexported fields }
NotifyConfigMapLock defines the structure of using configmap resources to implement distributed locks.
func (*NotifyConfigMapLock) Create ¶
func (cml *NotifyConfigMapLock) Create(ler LeaderElectionRecord) error
Create attempts to create a LeaderElectionRecord annotation
func (*NotifyConfigMapLock) Describe ¶
func (cml *NotifyConfigMapLock) Describe() string
Describe is used to convert details on current resource lock into a string
func (*NotifyConfigMapLock) Get ¶
func (cml *NotifyConfigMapLock) Get() (*LeaderElectionRecord, error)
Get returns the election record from a ConfigMap Annotation
func (*NotifyConfigMapLock) Identity ¶
func (cml *NotifyConfigMapLock) Identity() string
Identity returns the Identity of the lock
func (*NotifyConfigMapLock) Update ¶
func (cml *NotifyConfigMapLock) Update(ler LeaderElectionRecord) error
Update will update an existing annotation on a given resource.
type PlatformConfigMapLock ¶
type PlatformConfigMapLock struct { // ConfigMapMeta should contain a Name and a Namespace of a // ConfigMapMeta object that the LeaderElector will attempt to lead. ConfigMapMeta metav1.ObjectMeta Client platformv1client.ConfigMapsGetter LockConfig Config // contains filtered or unexported fields }
PlatformConfigMapLock defines the structure of using configmap resources to implement distributed locks.
func (*PlatformConfigMapLock) Create ¶
func (cml *PlatformConfigMapLock) Create(ler LeaderElectionRecord) error
Create attempts to create a LeaderElectionRecord annotation
func (*PlatformConfigMapLock) Describe ¶
func (cml *PlatformConfigMapLock) Describe() string
Describe is used to convert details on current resource lock into a string
func (*PlatformConfigMapLock) Get ¶
func (cml *PlatformConfigMapLock) Get() (*LeaderElectionRecord, error)
Get returns the election record from a ConfigMap Annotation
func (*PlatformConfigMapLock) Identity ¶
func (cml *PlatformConfigMapLock) Identity() string
Identity returns the Identity of the lock
func (*PlatformConfigMapLock) Update ¶
func (cml *PlatformConfigMapLock) Update(ler LeaderElectionRecord) error
Update will update an existing annotation on a given resource.