resourcelock

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
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

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

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

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

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

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

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

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

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

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

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

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

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

Update will update an existing annotation on a given resource.

Jump to

Keyboard shortcuts

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