leaderelection

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNamespaceIfNeeded

func CreateNamespaceIfNeeded(cli clientset.Interface, ns string) error

func Run

func Run(cfg *config.CloudCoreConfig, readyzAdaptor *ReadyzAdaptor)

func TriggerGracefulShutdown

func TriggerGracefulShutdown() error

TriggerGracefulShutdown triggers core.GracefulShutdown()

func TryToPatchPodReadinessGate

func TryToPatchPodReadinessGate(status corev1.ConditionStatus) error

Try to patch PodReadinessGate if program runs in pod

Types

type ReadyzAdaptor

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

ReadyzAdaptor associates the /readyz endpoint with the LeaderElection object. It helps deal with the /readyz endpoint being set up prior to the LeaderElection. This contains the code needed to act as an adaptor between the leader election code the health check code. It allows us to provide readyz status about the leader election. Most specifically about if the leader has failed to renew without exiting the process. In that case we should report not healthy and rely on the kubelet to take down the process.

func NewLeaderReadyzAdaptor

func NewLeaderReadyzAdaptor(timeout time.Duration) *ReadyzAdaptor

NewLeaderReadyzAdaptor creates a basic healthz adaptor to monitor a leader election. timeout determines the time beyond the lease expiry to be allowed for timeout. checks within the timeout period after the lease expires will still return healthy.

func (*ReadyzAdaptor) Check

func (l *ReadyzAdaptor) Check(req *http.Request) error

Check is called by the readyz endpoint handler. It fails (returns an error) if we own the lease but had not been able to renew it.

func (*ReadyzAdaptor) Name

func (l *ReadyzAdaptor) Name() string

Name returns the name of the health check we are implementing.

func (*ReadyzAdaptor) SetLeaderElection

func (l *ReadyzAdaptor) SetLeaderElection(le *leaderelection.LeaderElector)

SetLeaderElection ties a leader election object to a ReadyzAdaptor

Jump to

Keyboard shortcuts

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