leader

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KubernetesLeaderController

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

KubernetesLeaderController uses the Kubernetes leader election mechanism to determine who is leader. This allows multiple instances of the scheduler to be run for high availability.

TODO: Move into package in common.

func (*KubernetesLeaderController) GetLeaderReport

func (lc *KubernetesLeaderController) GetLeaderReport() LeaderReport

func (*KubernetesLeaderController) GetToken

func (lc *KubernetesLeaderController) GetToken() LeaderToken

func (*KubernetesLeaderController) RegisterListener

func (lc *KubernetesLeaderController) RegisterListener(listener LeaseListener)

func (*KubernetesLeaderController) Run

Run starts the controller. This is a blocking call that returns when the provided context is cancelled.

func (*KubernetesLeaderController) ValidateToken

func (lc *KubernetesLeaderController) ValidateToken(tok LeaderToken) bool

type LeaderClientConnectionProvider

type LeaderClientConnectionProvider interface {
	GetCurrentLeaderClientConnection() (bool, *grpc.ClientConn, error)
}

type LeaderConnectionProvider

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

func NewLeaderConnectionProvider

func NewLeaderConnectionProvider(leaderController LeaderController, leaderConfig configuration.LeaderConfig) *LeaderConnectionProvider

func (*LeaderConnectionProvider) GetCurrentLeaderClientConnection

func (l *LeaderConnectionProvider) GetCurrentLeaderClientConnection() (bool, *grpc.ClientConn, error)

type LeaderController

type LeaderController interface {
	// GetToken returns a LeaderToken which allows you to determine if you are leader or not
	GetToken() LeaderToken
	// ValidateToken allows a caller to determine whether a previously obtained token is still valid.
	// Returns true if the token is a leader and false otherwise
	ValidateToken(tok LeaderToken) bool
	// Run starts the controller.  This is a blocking call which will return when the provided context is cancelled
	Run(ctx *armadacontext.Context) error
	// GetLeaderReport returns a report about the current leader
	GetLeaderReport() LeaderReport
}

LeaderController is an interface to be implemented by structs that control which scheduler is leader

type LeaderReport

type LeaderReport struct {
	IsCurrentProcessLeader bool
	LeaderName             string
}

type LeaderStatusMetricsCollector

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

func NewLeaderStatusMetricsCollector

func NewLeaderStatusMetricsCollector(currentInstanceName string) *LeaderStatusMetricsCollector

func (*LeaderStatusMetricsCollector) Collect

func (l *LeaderStatusMetricsCollector) Collect(metrics chan<- prometheus.Metric)

func (*LeaderStatusMetricsCollector) Describe

func (l *LeaderStatusMetricsCollector) Describe(desc chan<- *prometheus.Desc)

type LeaderToken

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

LeaderToken is a token handed out to schedulers which they can use to determine if they are leader

func InvalidLeaderToken

func InvalidLeaderToken() LeaderToken

InvalidLeaderToken returns a LeaderToken indicating this instance is not leader.

func NewLeaderToken

func NewLeaderToken() LeaderToken

NewLeaderToken returns a LeaderToken indicating this instance is the leader.

func (LeaderToken) Leader

func (l LeaderToken) Leader() bool

type LeaseListener

type LeaseListener interface {
	// contains filtered or unexported methods
}

LeaseListener allows clients to listen for lease eventSequences.

type StandaloneLeaderController

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

StandaloneLeaderController returns a token that always indicates you are leader This can be used when only a single instance of the scheduler is needed

func NewStandaloneLeaderController

func NewStandaloneLeaderController() *StandaloneLeaderController

func (*StandaloneLeaderController) GetLeaderReport

func (lc *StandaloneLeaderController) GetLeaderReport() LeaderReport

func (*StandaloneLeaderController) GetToken

func (lc *StandaloneLeaderController) GetToken() LeaderToken

func (*StandaloneLeaderController) Run

func (*StandaloneLeaderController) SetToken

func (lc *StandaloneLeaderController) SetToken(token LeaderToken)

func (*StandaloneLeaderController) ValidateToken

func (lc *StandaloneLeaderController) ValidateToken(tok LeaderToken) bool

Jump to

Keyboard shortcuts

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