leaderelection

package
v0.0.0-...-1d35728 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NamespaceController     = "istio-namespace-controller-election"
	ServiceExportController = "istio-serviceexport-controller-election"
	// This holds the legacy name to not conflict with older control plane deployments which are just
	// doing the ingress syncing.
	IngressController = "istio-leader"
	// GatewayStatusController controls the status of gateway.networking.k8s.io objects. For the v1alpha1
	// this was formally "istio-gateway-leader"; because they are a different API group we need a different
	// election to ensure we do not only handle one or the other.
	GatewayStatusController = "istio-gateway-status-leader"
	// StatusController controls writing Istio status to objects
	StatusController  = "istio-status-leader"
	AnalyzeController = "istio-analyze-leader"
	// GatewayDeploymentController controls translating Kubernetes Gateway objects into various derived
	// resources (Service, Deployment, etc).
	// Unlike other types which use ConfigMaps, we use a Lease here. This is because:
	// * Others use configmap for backwards compatibility
	// * This type is per-revision, so it is higher cost. Leases are cheaper
	// * Other types use "prioritized leader election", which isn't implemented for Lease
	GatewayDeploymentController = "istio-gateway-deployment"
	NodeUntaintController       = "istio-node-untaint"
	IPAutoallocateController    = "istio-ip-autoallocate"
)

Various locks used throughout the code

Variables

This section is empty.

Functions

func LocationPrioritizedComparison

func LocationPrioritizedComparison(currentLeaderRevision string, l *LeaderElection) bool

Types

type LeaderElection

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

func NewLeaderElection

func NewLeaderElection(namespace, name, electionID, revision string, client kube.Client) *LeaderElection

NewLeaderElection creates a leader election instance with the provided ID. This follows standard Kubernetes elections, with one difference: the "default" revision will steal the lock from other revisions.

func NewLeaderElectionMulticluster

func NewLeaderElectionMulticluster(namespace, name, electionID, revision string, remote bool, client kube.Client) *LeaderElection

func NewLeaseLeaderElection

func NewLeaseLeaderElection(namespace, name, electionID, revision string, client kube.Client) *LeaderElection

NewLeaseLeaderElection creates a leader election instance with the provided ID. This follows standard Kubernetes elections, with one difference: the "default" revision will steal the lock from other revisions. The Lease object is used for maintaining the locking

func NewPerRevisionLeaderElection

func NewPerRevisionLeaderElection(namespace, name, electionID, revision string, client kube.Client) *LeaderElection

NewPerRevisionLeaderElection creates a *per revision* leader election. This means there will be one leader for each revision.

func (*LeaderElection) AddRunFunction

func (l *LeaderElection) AddRunFunction(f func(stop <-chan struct{})) *LeaderElection

AddRunFunction registers a function to run when we are the leader. These will be run asynchronously. To avoid running when not a leader, functions should respect the stop channel.

func (*LeaderElection) Run

func (l *LeaderElection) Run(stop <-chan struct{})

Run will start leader election, calling all runFns when we become the leader. If leader election is disabled, it skips straight to the runFns.

Directories

Path Synopsis
Package leaderelection implements leader election of a set of endpoints.
Package leaderelection implements leader election of a set of endpoints.

Jump to

Keyboard shortcuts

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