v1

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultLeaderElect is the default true leader election should be enabled
	DefaultLeaderElect = true

	// DefaultLeaderElectionLeaseDuration is the default time in seconds that non-leader candidates will wait to force acquire leadership
	DefaultLeaderElectionLeaseDuration = 15 * time.Second

	// DefaultLeaderElectionRenewDeadline is the default time in seconds that the acting master will retry refreshing leadership before giving up
	DefaultLeaderElectionRenewDeadline = 10 * time.Second

	// DefaultLeaderElectionRetryPeriod is the default time in seconds that the leader election clients should wait between tries of actions
	DefaultLeaderElectionRetryPeriod = 2 * time.Second
)

Variables

This section is empty.

Functions

func RestConfig

func RestConfig(kubeConfig string) (*restclient.Config, error)

Types

type LeaderCallback

type LeaderCallback interface {
	OnStartedLeading(ctx context.Context, clusterCode, namespace, labelSelector string, kubeClientSet clientset.Interface) error
	OnStoppedLeading(ctx context.Context)
}

type LeaderElectionOptions

type LeaderElectionOptions struct {
	LeaderElect                 bool
	LeaderElectionNamespace     string
	LeaderElectionLeaseDuration time.Duration
	LeaderElectionRenewDeadline time.Duration
	LeaderElectionRetryPeriod   time.Duration
	LeaderElectionLeaseLockName string
	ClusterCode                 string
	Namespace                   string
	LabelSelector               string
}

type LeaderElector

type LeaderElector struct {
	KubeClientSet clientset.Interface
}

func (LeaderElector) Run

func (s LeaderElector) Run(ctx context.Context, electOpts LeaderElectionOptions, callback LeaderCallback, stopCh <-chan struct{}) error

type Pod

type Pod interface {
}

type PodClient

type PodClient struct {
	coreclientv1.PodInterface
	WatchEventHandler
	Namespace     string
	ClusterCode   string
	LabelSelector string
}

func NewPodClient

func NewPodClient(v1Client coreclientv1.PodInterface, clusterCode, namespace, labelSelector string, eventHandler WatchEventHandler) *PodClient

func (*PodClient) DoWatch

func (r *PodClient) DoWatch(ctx context.Context) error

type ReplicaSet

type ReplicaSet interface {
	CreateOrReplace(ctx context.Context, rs *appsv1.ReplicaSet) (*appsv1.ReplicaSet, error)
}

type ReplicaSetClient

type ReplicaSetClient struct {
	appclientv1.ReplicaSetInterface
	WatchEventHandler
	Namespace     string
	ClusterCode   string
	LabelSelector string
}

func NewReplicaSetClient

func NewReplicaSetClient(rsClient appclientv1.ReplicaSetInterface, clusterCode, namespace, labelSelector string, eventHandler WatchEventHandler) *ReplicaSetClient

func (*ReplicaSetClient) CreateOrReplace

func (r *ReplicaSetClient) CreateOrReplace(ctx context.Context, rs *appsv1.ReplicaSet) (*appsv1.ReplicaSet, error)

func (*ReplicaSetClient) DoWatch

func (r *ReplicaSetClient) DoWatch(ctx context.Context) error

type WatchEventHandler

type WatchEventHandler interface {
	Handle(ctx context.Context, clusterCode string, event watch.Event) error
}

type Watcher

type Watcher interface {
	DoWatch(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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