package leaderelection
import "k8s.io/kubernetes/pkg/controlplane/controller/leaderelection"
Index ¶
- Variables
- func RunWithLeaderElection(ctx context.Context, config *rest.Config, newRunnerFn NewRunner)
- type Controller
- func NewController(leaseInformer coordinationv1informers.LeaseInformer, leaseCandidateInformer coordinationv1beta1.LeaseCandidateInformer, leaseClient coordinationv1client.CoordinationV1Interface, leaseCandidateClient coordinationv1beta1client.CoordinationV1beta1Interface) (*Controller, error)
- func (c *Controller) Run(ctx context.Context, workers int)
- type LeaseCandidateGCController
- func NewLeaseCandidateGC(clientset kubernetes.Interface, gcCheckPeriod time.Duration, leaseCandidateInformer coordinationv1beta1informers.LeaseCandidateInformer) *LeaseCandidateGCController
- func (c *LeaseCandidateGCController) Run(ctx context.Context)
- type NewRunner
Variables ¶
var ( // TODO: Eventually these should be configurable LeaseDuration = 15 * time.Second RenewDeadline = 10 * time.Second RetryPeriod = 2 * time.Second )
Functions ¶
func RunWithLeaderElection ¶
RunWithLeaderElection runs the provided runner function with leader election. newRunnerFn might be called multiple times, and it should return another controller instance's Run method each time. RunWithLeaderElection only returns when the context is done, or initial leader election fails.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the leader election controller, which observes component identity leases for components that have self-nominated as candidate leaders for leases and elects leaders for those leases, favoring candidates with higher versions.
func NewController ¶
func NewController(leaseInformer coordinationv1informers.LeaseInformer, leaseCandidateInformer coordinationv1beta1.LeaseCandidateInformer, leaseClient coordinationv1client.CoordinationV1Interface, leaseCandidateClient coordinationv1beta1client.CoordinationV1beta1Interface) (*Controller, error)
func (*Controller) Run ¶
func (c *Controller) Run(ctx context.Context, workers int)
type LeaseCandidateGCController ¶
type LeaseCandidateGCController struct {
// contains filtered or unexported fields
}
func NewLeaseCandidateGC ¶
func NewLeaseCandidateGC(clientset kubernetes.Interface, gcCheckPeriod time.Duration, leaseCandidateInformer coordinationv1beta1informers.LeaseCandidateInformer) *LeaseCandidateGCController
NewLeaseCandidateGC creates a new LeaseCandidateGCController.
func (*LeaseCandidateGCController) Run ¶
func (c *LeaseCandidateGCController) Run(ctx context.Context)
Run starts one worker.
type NewRunner ¶
Source Files ¶
election.go leaderelection_controller.go leasecandidategc_controller.go run_with_leaderelection.go
- Version
- v1.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 30 packages
- Last checked
- 3 hours ago –
Tools for package owners.