k8s

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package k8s implements a client for communicating with a Kubernetes apiserver. It is intended to support an ingress controller, so it is limited to the types needed.

The types are copied from the stable api of the Kubernetes 1.3 release.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetAllIngresses returns all the ingresses in the cluster.
	GetAllIngresses() ([]*v1beta1.Ingress, error)

	// GetIngresses returns ingresses in namespaces with matching labels
	GetIngresses(*NamespaceSelector) ([]*v1beta1.Ingress, error)

	// GetServices returns all the services in the cluster.
	GetServices() ([]*v1.Service, error)

	// WatchIngresses watches for updates to ingresses and notifies the Watcher.
	WatchIngresses() Watcher

	// WatchServices watches for updates to services and notifies the Watcher.
	WatchServices() Watcher

	// WatchNamespaces watches for updates to namespaces and notifies the Watcher.
	WatchNamespaces() Watcher

	// UpdateIngressStatus updates the ingress status with the loadbalancer hostname or ip address.
	UpdateIngressStatus(*v1beta1.Ingress) error
}

Client for connecting to a Kubernetes cluster. Watchers will receive a notification whenever the client connects to the API server, including reconnects, to notify that there may be new ingresses that need to be retrieved. It's intended that client code will call the getters to retrieve the current state when notified.

func New

func New(kubeconfig string, resyncPeriod time.Duration) (Client, error)

New creates a client for the kubernetes apiserver.

type NamespaceSelector

type NamespaceSelector struct {
	LabelName  string
	LabelValue string
}

NamespaceSelector defines the label name and value for filtering namespaces

type Watcher

type Watcher interface {
	// Updates provides update notification.
	Updates() <-chan interface{}
}

Watcher provides channels for receiving updates. It tries its best to run forever, retrying if the underlying connection fails.

func CombineWatchers

func CombineWatchers(watchers ...Watcher) Watcher

CombineWatchers returns a watcher that watches all. The combined watcher becomes the owner of the passed in watchers and so clients should not attempt to use or stop the individual watchers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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