Documentation ¶
Index ¶
- Constants
- type ApplicationConfigMapLock
- func (cml *ApplicationConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
- func (cml *ApplicationConfigMapLock) Describe() string
- func (cml *ApplicationConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
- func (cml *ApplicationConfigMapLock) Identity() string
- func (cml *ApplicationConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
- type AuthConfigMapLock
- func (cml *AuthConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
- func (cml *AuthConfigMapLock) Describe() string
- func (cml *AuthConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
- func (cml *AuthConfigMapLock) Identity() string
- func (cml *AuthConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
- type AuthzConfigMapLock
- func (cml *AuthzConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
- func (cml *AuthzConfigMapLock) Describe() string
- func (cml *AuthzConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
- func (cml *AuthzConfigMapLock) Identity() string
- func (cml *AuthzConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
- type BusinessConfigMapLock
- func (cml *BusinessConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
- func (cml *BusinessConfigMapLock) Describe() string
- func (cml *BusinessConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
- func (cml *BusinessConfigMapLock) Identity() string
- func (cml *BusinessConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
- type Config
- type Interface
- func NewApplication(name string, client applicationv1.ApplicationV1Interface, rlc Config) Interface
- func NewAuth(name string, client authv1.AuthV1Interface, rlc Config) Interface
- func NewAuthz(name string, client authzv1.AuthzV1Interface, rlc Config) Interface
- func NewBusiness(name string, client businessv1.BusinessV1Interface, rlc Config) Interface
- func NewLogagent(name string, client logagentv1.LogagentV1Interface, rlc Config) Interface
- func NewMesh(name string, client meshv1.MeshV1Interface, 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
- func NewRegistry(name string, client registryv1.RegistryV1Interface, rlc Config) Interface
- type LeaderElectionRecord
- type LogagentConfigMapLock
- func (cml *LogagentConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
- func (cml *LogagentConfigMapLock) Describe() string
- func (cml *LogagentConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
- func (cml *LogagentConfigMapLock) Identity() string
- func (cml *LogagentConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
- type MeshConfigMapLock
- func (cml *MeshConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
- func (cml *MeshConfigMapLock) Describe() string
- func (cml *MeshConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
- func (cml *MeshConfigMapLock) Identity() string
- func (cml *MeshConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
- type MonitorConfigMapLock
- func (cml *MonitorConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
- func (cml *MonitorConfigMapLock) Describe() string
- func (cml *MonitorConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
- func (cml *MonitorConfigMapLock) Identity() string
- func (cml *MonitorConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
- type NotifyConfigMapLock
- func (cml *NotifyConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
- func (cml *NotifyConfigMapLock) Describe() string
- func (cml *NotifyConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
- func (cml *NotifyConfigMapLock) Identity() string
- func (cml *NotifyConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
- type PlatformConfigMapLock
- func (cml *PlatformConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
- func (cml *PlatformConfigMapLock) Describe() string
- func (cml *PlatformConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
- func (cml *PlatformConfigMapLock) Identity() string
- func (cml *PlatformConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
- type RegistryConfigMapLock
- func (cml *RegistryConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
- func (cml *RegistryConfigMapLock) Describe() string
- func (cml *RegistryConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
- func (cml *RegistryConfigMapLock) Identity() string
- func (cml *RegistryConfigMapLock) Update(ctx context.Context, 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 ApplicationConfigMapLock ¶ added in v1.4.0
type ApplicationConfigMapLock struct { // ConfigMapMeta should contain a Name and a Namespace of a // ConfigMapMeta object that the LeaderElector will attempt to lead. ConfigMapMeta metav1.ObjectMeta Client applicationv1client.ConfigMapsGetter LockConfig Config // contains filtered or unexported fields }
ApplicationConfigMapLock defines the structure of using configmap resources to implement distributed locks.
func (*ApplicationConfigMapLock) Create ¶ added in v1.4.0
func (cml *ApplicationConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
Create attempts to create a LeaderElectionRecord annotation
func (*ApplicationConfigMapLock) Describe ¶ added in v1.4.0
func (cml *ApplicationConfigMapLock) Describe() string
Describe is used to convert details on current resource lock into a string
func (*ApplicationConfigMapLock) Get ¶ added in v1.4.0
func (cml *ApplicationConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
Get returns the election record from a ConfigMap Annotation
func (*ApplicationConfigMapLock) Identity ¶ added in v1.4.0
func (cml *ApplicationConfigMapLock) Identity() string
Identity returns the Identity of the lock
func (*ApplicationConfigMapLock) Update ¶ added in v1.4.0
func (cml *ApplicationConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
Update will update an existing annotation on a given resource.
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(ctx context.Context, 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(ctx context.Context) (*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(ctx context.Context, ler LeaderElectionRecord) error
Update will update an existing annotation on a given resource.
type AuthzConfigMapLock ¶ added in v1.9.1
type AuthzConfigMapLock struct { // ConfigMapMeta should contain a Name and a Namespace of a // ConfigMapMeta object that the LeaderElector will attempt to lead. ConfigMapMeta metav1.ObjectMeta Client authzv1client.ConfigMapsGetter LockConfig Config // contains filtered or unexported fields }
AuthzConfigMapLock defines the structure of using configmap resources to implement distributed locks.
func (*AuthzConfigMapLock) Create ¶ added in v1.9.1
func (cml *AuthzConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
Create attempts to create a LeaderElectionRecord annotation
func (*AuthzConfigMapLock) Describe ¶ added in v1.9.1
func (cml *AuthzConfigMapLock) Describe() string
Describe is used to convert details on current resource lock into a string
func (*AuthzConfigMapLock) Get ¶ added in v1.9.1
func (cml *AuthzConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
Get returns the election record from a ConfigMap Annotation
func (*AuthzConfigMapLock) Identity ¶ added in v1.9.1
func (cml *AuthzConfigMapLock) Identity() string
Identity returns the Identity of the lock
func (*AuthzConfigMapLock) Update ¶ added in v1.9.1
func (cml *AuthzConfigMapLock) Update(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context) (*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(ctx context.Context, 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(ctx context.Context) (*LeaderElectionRecord, error) // Create attempts to create a LeaderElectionRecord Create(ctx context.Context, ler LeaderElectionRecord) error // Update will update and existing LeaderElectionRecord Update(ctx context.Context, 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 NewApplication ¶ added in v1.4.0
func NewApplication(name string, client applicationv1.ApplicationV1Interface, rlc Config) Interface
NewApplication will create a lock of a given type according to the input parameters
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 NewAuthz ¶ added in v1.9.1
func NewAuthz(name string, client authzv1.AuthzV1Interface, rlc Config) Interface
NewAuthz 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 NewLogagent ¶ added in v1.3.1
func NewLogagent(name string, client logagentv1.LogagentV1Interface, rlc Config) Interface
NewLogagent will create a lock of a given type according to the input parameters
func NewMesh ¶ added in v1.6.0
func NewMesh(name string, client meshv1.MeshV1Interface, rlc Config) Interface
NewMesh 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
func NewRegistry ¶ added in v1.4.0
func NewRegistry(name string, client registryv1.RegistryV1Interface, rlc Config) Interface
NewRegistry 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 LogagentConfigMapLock ¶ added in v1.3.1
type LogagentConfigMapLock struct { // ConfigMapMeta should contain a Name and a Namespace of a // ConfigMapMeta object that the LeaderElector will attempt to lead. ConfigMapMeta metav1.ObjectMeta Client logagentv1client.ConfigMapsGetter LockConfig Config // contains filtered or unexported fields }
NotifyConfigMapLock defines the structure of using configmap resources to implement distributed locks.
func (*LogagentConfigMapLock) Create ¶ added in v1.3.1
func (cml *LogagentConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
Create attempts to create a LeaderElectionRecord annotation
func (*LogagentConfigMapLock) Describe ¶ added in v1.3.1
func (cml *LogagentConfigMapLock) Describe() string
Describe is used to convert details on current resource lock into a string
func (*LogagentConfigMapLock) Get ¶ added in v1.3.1
func (cml *LogagentConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
Get returns the election record from a ConfigMap Annotation
func (*LogagentConfigMapLock) Identity ¶ added in v1.3.1
func (cml *LogagentConfigMapLock) Identity() string
Identity returns the Identity of the lock
func (*LogagentConfigMapLock) Update ¶ added in v1.3.1
func (cml *LogagentConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
Update will update an existing annotation on a given resource.
type MeshConfigMapLock ¶ added in v1.6.0
type MeshConfigMapLock struct { // ConfigMapMeta should contain a Name and a Namespace of a // ConfigMapMeta object that the LeaderElector will attempt to lead. ConfigMapMeta metav1.ObjectMeta Client meshv1client.ConfigMapsGetter LockConfig Config // contains filtered or unexported fields }
MeshConfigMapLock defines the structure of using configmap resources to implement distributed locks.
func (*MeshConfigMapLock) Create ¶ added in v1.6.0
func (cml *MeshConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
Create attempts to create a LeaderElectionRecord annotation
func (*MeshConfigMapLock) Describe ¶ added in v1.6.0
func (cml *MeshConfigMapLock) Describe() string
Describe is used to convert details on current resource lock into a string
func (*MeshConfigMapLock) Get ¶ added in v1.6.0
func (cml *MeshConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
Get returns the election record from a ConfigMap Annotation
func (*MeshConfigMapLock) Identity ¶ added in v1.6.0
func (cml *MeshConfigMapLock) Identity() string
Identity returns the Identity of the lock
func (*MeshConfigMapLock) Update ¶ added in v1.6.0
func (cml *MeshConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
Update will update an existing annotation on a given resource.
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(ctx context.Context, 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(ctx context.Context) (*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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context) (*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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context) (*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(ctx context.Context, ler LeaderElectionRecord) error
Update will update an existing annotation on a given resource.
type RegistryConfigMapLock ¶ added in v1.4.0
type RegistryConfigMapLock struct { // ConfigMapMeta should contain a Name and a Namespace of a // ConfigMapMeta object that the LeaderElector will attempt to lead. ConfigMapMeta metav1.ObjectMeta Client registryv1client.ConfigMapsGetter LockConfig Config // contains filtered or unexported fields }
RegistryConfigMapLock defines the structure of using configmap resources to implement distributed locks.
func (*RegistryConfigMapLock) Create ¶ added in v1.4.0
func (cml *RegistryConfigMapLock) Create(ctx context.Context, ler LeaderElectionRecord) error
Create attempts to create a LeaderElectionRecord annotation
func (*RegistryConfigMapLock) Describe ¶ added in v1.4.0
func (cml *RegistryConfigMapLock) Describe() string
Describe is used to convert details on current resource lock into a string
func (*RegistryConfigMapLock) Get ¶ added in v1.4.0
func (cml *RegistryConfigMapLock) Get(ctx context.Context) (*LeaderElectionRecord, error)
Get returns the election record from a ConfigMap Annotation
func (*RegistryConfigMapLock) Identity ¶ added in v1.4.0
func (cml *RegistryConfigMapLock) Identity() string
Identity returns the Identity of the lock
func (*RegistryConfigMapLock) Update ¶ added in v1.4.0
func (cml *RegistryConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord) error
Update will update an existing annotation on a given resource.