lbutil

package module
v0.0.0-...-41cdbde Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

README

Shared constants and functions for controllers that use k8s-ipam to configure loadbalancers.

Documentation

Index

Constants

View Source
const (

	// If set to any value, a VIP will be configured.
	AnnNxReqVIP = "nexinto.com/req-vip"

	// This will be set to the VIP. If set, the Loadbalancer was configured successfully.
	AnnNxVIP = "nexinto.com/vip"

	// This will be the VIP chosen for the service.
	AnnNxAssignedVIP = "nexinto.com/assigned-vip"

	// Set this to explicitly choose a VIP provider.
	AnnNxVIPProvider = "nexinto.com/vip-provider"

	// The active provider for this VIP.
	AnnNxVIPActiveProvider = "nexinto.com/vip-active-provider"
)

Variables

This section is empty.

Functions

func EnsureVIP

func EnsureVIP(kube kubernetes.Interface, ipamclient ipamclientset.Interface, addressLister ipamlisterv1.IpAddressLister,
	service *corev1.Service, controllerName string, requireAnnotation bool) (ok bool, needsUpdate bool, newservice *corev1.Service, err error)

Checks if the service is annotated with a valid VIP, if not, work towards that. Return value ok is true if the service / its annotation is valid and the caller can continue and use the VIP; if it is false, the caller must stop processing and retry later. If there is no error and it is ok to continue, use the returned "newservice" to query the VIP or to make changes to the Service, not your original service because the original came from the cache and should not be modified. If 'needsUpdate' is true, then the service copy was modified and needs to be updated by the caller.

func IpAddressCreatedOrUpdated

func IpAddressCreatedOrUpdated(serviceQueue workqueue.RateLimitingInterface, address *ipamv1.IpAddress)

If an IP address object changes and a Service is an owner, wake up that Service.

func IpAddressDeleted

func IpAddressDeleted(kubernetes kubernetes.Interface, serviceLister corelisterv1.ServiceLister, address *ipamv1.IpAddress) error

If an IP address is deleted and a Service is the owner and it still exists, remove the VIP annotation and wake up the service so the service can retry requesting loadbalancing.

func LogEventAndFail

func LogEventAndFail(kube kubernetes.Interface, o metav1.Object, message string) error

Create a Warning Event for the object and also return it as an error.

func MakeEvent

func MakeEvent(kube kubernetes.Interface, o metav1.Object, message string, warn bool) error

Create an event for an object.

func RequestAddress

func RequestAddress(kube kubernetes.Interface, ipamclient ipamclientset.Interface, service *corev1.Service) error

Create a new IpAddress Object for a Service.

func SimIPAM

func SimIPAM(ipamclient ipamclientset.Interface) error

Simulates the behaviour of the ipam controller.

func StoreVIP

func StoreVIP(vip string, kube kubernetes.Interface, service *corev1.Service) *corev1.Service

Types

This section is empty.

Jump to

Keyboard shortcuts

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