locking

package module
v0.0.0-...-7453492 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 7 Imported by: 0

README

Locking

This repo provides some locking primitives for use with multi-cluster Kubernetes operators. It provides 3 current implementations:

  1. A basic lock implementation for single operators based on using the Kubernetes lease API
  2. A multi-cluster lock implementation that attempts to acquire multiple leases using the lease API in cases where the amount of locks that are being acquired is small.
  3. A raft-based lock implementation that requires operators knowing about each other.

NOTE: This software is not production-ready and is meant to demonstrate conceptually how a fleet of multi-cluster operators can be run in disparate clusters and still function.

Future Ideas

Modify the multi-lock implementation to not require obtaining all locks, but rather a quorum of locks.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LeaderManager

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

func NewKubernetesLockManager

func NewKubernetesLockManager(configuration kube.LockConfiguration) *LeaderManager

func NewLeaderTrackingRaftLockManager

func NewLeaderTrackingRaftLockManager(configuration raft.LockConfiguration, setLeader func(uint64)) *LeaderManager

func NewRaftLockManager

func NewRaftLockManager(configuration raft.LockConfiguration) *LeaderManager

func (*LeaderManager) IsLeader

func (lm *LeaderManager) IsLeader() bool

func (*LeaderManager) RegisterRoutine

func (lm *LeaderManager) RegisterRoutine(fn func(ctx context.Context) error)

func (*LeaderManager) Run

func (lm *LeaderManager) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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