locker

package
v14.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists asserts alreadyExistsError.

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound asserts notFoundError.

Types

type Interface

type Interface interface {
	Lock(ctx context.Context) error
	Unlock(ctx context.Context) error
}

Interface is some form of lock implementation like achieved for in process locking using sync.Mutex.

type KubeLockLocker

type KubeLockLocker struct {
	// contains filtered or unexported fields
}

func NewKubeLockLocker

func NewKubeLockLocker(config KubeLockLockerConfig) (*KubeLockLocker, error)

NewKubeLockLocker implements a distributed lock mechanism mainly used for our IPAM management. You can inspect the lock annotations in the giantswarm namespace during Cluster or Node Pool creation in order to see the locking in action.

$ k get namespace -o json giantswarm --watch | jq '.metadata.annotations'
"kubelock.giantswarm.io/ipam": "{\"owner\":\"aws-operator@8.6.1\",\"createdAt\":\"2020-06-18T10:22:12.211418934Z\",\"ttl\":30000000000}"

func (KubeLockLocker) Lock

func (d KubeLockLocker) Lock(ctx context.Context) error

func (KubeLockLocker) Unlock

func (d KubeLockLocker) Unlock(ctx context.Context) error

type KubeLockLockerConfig

type KubeLockLockerConfig struct {
	Logger     micrologger.Logger
	RestConfig *rest.Config
}

type MutexLocker

type MutexLocker struct {
	// contains filtered or unexported fields
}

MutexLocker implements Interface using sync.Mutex. For now we use a shared instance of *MutexLocker for all IPAM related activity of network packages in the legacy controllers and ipam resources in the clusterapi controllers.

func NewMutexLocker

func NewMutexLocker(config MutexLockerConfig) (*MutexLocker, error)

func (*MutexLocker) Lock

func (l *MutexLocker) Lock(ctx context.Context) error

func (*MutexLocker) Unlock

func (l *MutexLocker) Unlock(ctx context.Context) error

type MutexLockerConfig

type MutexLockerConfig struct {
	Logger micrologger.Logger
}

Jump to

Keyboard shortcuts

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