kubernetes

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package kubernetes provides utility functions and types to be used with code interacting with Kubernetes API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildServiceEndpoint

func BuildServiceEndpoint(address *v1.EndpointAddress, port *v1.EndpointPort) (*api.ServiceEndpoint, error)

BuildServiceEndpoint builds an api.ServiceEndpoint from the given address and port Kubernetes objects.

func BuildServiceInstance

func BuildServiceInstance(serviceName string, pod *v1.Pod, address *v1.EndpointAddress, port *v1.EndpointPort) (*api.ServiceInstance, error)

BuildServiceInstance builds an api.ServiceInstance from the given serviceName, pod, address and port.

func BuildServiceMetadata

func BuildServiceMetadata(annotations map[string]string) (json.RawMessage, error)

BuildServiceMetadata builds a serialized JSON object from the given Kubernetes resource annotations.

func BuildServiceStatus

func BuildServiceStatus(podStatus *v1.PodStatus) (string, error)

BuildServiceStatus builds a service instance status string for the given pod.

func BuildServiceTags

func BuildServiceTags(labels map[string]string) ([]string, error)

BuildServiceTags builds a slice of string tags from the given Kubernetes resource labels. Each label is converted into a "key=value" string.

func InitThirdPartyResource

func InitThirdPartyResource(tprConfig *TPRConfig) error

InitThirdPartyResource initialize third party resource if it does not exist

func NewClient

func NewClient(config Config) (kubernetes.Interface, error)

NewClient creates a new Kubernetes client using the specified configuration. If no URL and Token are specified, then these values are attempted to be read from the service account (if running within a Kubernetes pod).

func NewTPRClient

func NewTPRClient(config Config, tprConfig *TPRConfig) (*rest.RESTClient, error)

NewTPRClient creates a new Kubernetes client using the specified configuration for working with the specified ThirdPartyResource. If no URL and Token are specified, then these values are attempted to be read from the service account (if running within a Kubernetes pod).

Types

type AddFunc

type AddFunc func(obj interface{})

AddFunc is the ResourceEventHandler function called when a watched Kubernetes API object is added.

type Config

type Config struct {
	URL   string
	Token string
}

Config stores configurable attributes of a Kubernetes client.

type DeleteFunc

type DeleteFunc func(obj interface{})

DeleteFunc is the ResourceEventHandler function called when a watched Kubernetes API object is deleted.

type TPRConfig

type TPRConfig struct {
	Name        string
	GroupName   string
	Version     string
	Description string
	Type        runtime.Object
	ListType    runtime.Object
}

TPRConfig stores configurable attributes of a Kubernetes ThirdPartyResource object.

type UpdateFunc

type UpdateFunc func(oldObj, newObj interface{})

UpdateFunc is the ResourceEventHandler function called when a watched Kubernetes API object is updated.

type Workqueue

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

Workqueue enqueues and processes ResourceEventHandler callbacks from cache controllers.

func NewWorkqueue

func NewWorkqueue() *Workqueue

NewWorkqueue creates a new workqueue.

func (*Workqueue) EnqueueingAddFunc

func (wq *Workqueue) EnqueueingAddFunc(f AddFunc) AddFunc

EnqueueingAddFunc returns an AddFunc that enqueues the given AddFunc invocation.

func (*Workqueue) EnqueueingDeleteFunc

func (wq *Workqueue) EnqueueingDeleteFunc(f DeleteFunc) DeleteFunc

EnqueueingDeleteFunc returns an DeleteFunc that enqueues the given DeleteFunc invocation.

func (*Workqueue) EnqueueingUpdateFunc

func (wq *Workqueue) EnqueueingUpdateFunc(f UpdateFunc) UpdateFunc

EnqueueingUpdateFunc returns an UpdateFunc that enqueues the given UpdateFunc invocation. The wrapping UpdateFunc drops events in which the resource version of the old object is the same as the resource version of the new object (e.g., in case of a full cache resync).

func (*Workqueue) Start

func (wq *Workqueue) Start()

Start launches a worker goroutine to process events from the queue.

func (*Workqueue) Stop

func (wq *Workqueue) Stop()

Stop the worker goroutine from processing events from the queue.

Jump to

Keyboard shortcuts

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