lb

package
Version: v0.8.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// NodeUnreachablePodReason is the reason and message set on a pod
	// when its state cannot be confirmed as kubelet is unresponsive
	// on the node it is (was) running.
	// copy from k8s.io/kubernetes/pkg/util/node
	NodeUnreachablePodReason = "NodeLost"
)

Variables

View Source
var DefaultRetry = wait.Backoff{
	Steps:    5,
	Duration: 10 * time.Millisecond,
	Factor:   1.0,
	Jitter:   0.1,
}

DefaultRetry is the recommended retry for a conflict where multiple clients are making changes to the same resource.

Functions

func CalculateReplicas

func CalculateReplicas(lb *lbapi.LoadBalancer) (int32, bool)

CalculateReplicas helps you to calculate replicas of lb determines if you need to add node affinity

func ComputePodStatus

func ComputePodStatus(pod *v1.Pod) lbapi.PodStatus

ComputePodStatus computes the pod's current status

func EvictPod added in v0.5.5

func EvictPod(client kubernetes.Interface, lb *lbapi.LoadBalancer, pod *v1.Pod)

EvictPod deletes the pod scheduled to the wrong node

func ExternalProviderStatusEqual added in v0.3.3

func ExternalProviderStatusEqual(a, b lbapi.ExpternalProviderStatus) bool

ExternalProviderStatusEqual check whether the given two ExpternalProviderStatus are equal

func IpvsdrProviderStatusEqual

func IpvsdrProviderStatusEqual(a, b lbapi.IpvsdrProviderStatus) bool

IpvsdrProviderStatusEqual check whether the given two Statuses are equal

func IsPodMatchNodeSelectorFailed added in v0.5.4

func IsPodMatchNodeSelectorFailed(pod *v1.Pod) bool

IsPodMatchNodeSelectorFailed returns true if pod is in MatchNodeSelector failed

func IsStatic added in v0.3.5

func IsStatic(lb *lbapi.LoadBalancer) bool

IsStatic checks if lb is a static loadbalancer

func MergeDeployment added in v0.5.5

func MergeDeployment(dst, src *appsv1.Deployment) (*appsv1.Deployment, bool)

MergeDeployment merges fields in src into dst, and igornes some fields by default for debugging

func PodStatusesEqual

func PodStatusesEqual(a, b lbapi.PodStatuses) bool

PodStatusesEqual check whether the given two PodStatuses are equal

func ProxyStatusEqual

func ProxyStatusEqual(a, b lbapi.ProxyStatus) bool

ProxyStatusEqual check whether the given two PorxyStatuses are equal

func RandStringBytesRmndr

func RandStringBytesRmndr(n int) string

RandStringBytesRmndr returns a randome string.

func SplitNamespaceAndNameByDot

func SplitNamespaceAndNameByDot(value string) (namespace, name string, err error)

SplitNamespaceAndNameByDot returns the namespace and name that encoded into the label or value by dot

func UpdateLBWithRetries

func UpdateLBWithRetries(lbClient lbclient.LoadBalancerInterface, lblister lblisters.LoadBalancerLister, namespace, name string, applyUpdate updateLBFunc) (*lbapi.LoadBalancer, error)

UpdateLBWithRetries update loadbalancer with max retries

Types

type EventHandlerForDeployment

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

EventHandlerForDeployment helps you create a event handler to handle with deployments event quickly, makes you focus on you own code

func NewEventHandlerForDeployment

func NewEventHandlerForDeployment(
	lbLister lblisters.LoadBalancerLister,
	dLister appslisters.DeploymentLister,
	queue *syncqueue.SyncQueue,
	filterFunc filterDeploymentFunc,
) *EventHandlerForDeployment

NewEventHandlerForDeployment ...

func (*EventHandlerForDeployment) GetLoadBalancerForDeployments

func (eh *EventHandlerForDeployment) GetLoadBalancerForDeployments(d *appsv1.Deployment) *lbapi.LoadBalancer

GetLoadBalancerForDeployments get a list of all matching LoadBalancer for deployment

func (*EventHandlerForDeployment) OnAdd

func (eh *EventHandlerForDeployment) OnAdd(obj interface{})

OnAdd ...

func (*EventHandlerForDeployment) OnDelete

func (eh *EventHandlerForDeployment) OnDelete(obj interface{})

OnDelete ...

func (*EventHandlerForDeployment) OnUpdate

func (eh *EventHandlerForDeployment) OnUpdate(oldObj, curObj interface{})

OnUpdate ...

type EventHandlerForSyncStatusWithPod

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

EventHandlerForSyncStatusWithPod helps you create a event handler to sync status with pod event quickly, makes you focus on you own code

func NewEventHandlerForSyncStatusWithPod

func NewEventHandlerForSyncStatusWithPod(
	lbLister lblisters.LoadBalancerLister,
	podLister corelisters.PodLister,
	queue *syncqueue.SyncQueue,
	filterFunc filterPodFunc,
) *EventHandlerForSyncStatusWithPod

NewEventHandlerForSyncStatusWithPod ...

func (*EventHandlerForSyncStatusWithPod) OnAdd

func (eh *EventHandlerForSyncStatusWithPod) OnAdd(obj interface{})

OnAdd ...

func (*EventHandlerForSyncStatusWithPod) OnDelete

func (eh *EventHandlerForSyncStatusWithPod) OnDelete(obj interface{})

OnDelete ...

func (*EventHandlerForSyncStatusWithPod) OnUpdate

func (eh *EventHandlerForSyncStatusWithPod) OnUpdate(oldObj, curObj interface{})

OnUpdate ...

type SortPodStatusByName

type SortPodStatusByName []lbapi.PodStatus

SortPodStatusByName ...

func (SortPodStatusByName) Len

func (s SortPodStatusByName) Len() int

func (SortPodStatusByName) Less

func (s SortPodStatusByName) Less(i, j int) bool

func (SortPodStatusByName) Swap

func (s SortPodStatusByName) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL