resourcelock

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 23 Imported by: 2

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

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

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

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

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

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(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 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

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

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

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

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

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

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

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.

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

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

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

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