kube

package
v0.0.0-...-a026827 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2017 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package kube implements the shared and reusable library for Kubernetes

Index

Constants

View Source
const (
	// NodeRegionLabel is the well-known label for kubernetes node region
	NodeRegionLabel = "failure-domain.beta.kubernetes.io/region"
	// NodeZoneLabel is the well-known label for kubernetes node zone
	NodeZoneLabel = "failure-domain.beta.kubernetes.io/zone"
)
View Source
const (
	// IngressClassAnnotation is the annotation on ingress resources for the class of controllers
	// responsible for it
	IngressClassAnnotation = "kubernetes.io/ingress.class"
)

Variables

This section is empty.

Functions

func CreateInterface

func CreateInterface(kubeconfig string) (kubernetes.Interface, error)

CreateInterface is a helper function to create Kubernetes interface

func KeyFunc

func KeyFunc(name, namespace string) string

KeyFunc is the internal API key function that returns "namespace"/"name" or "name" if "namespace" is empty

func MakeSecretRegistry

func MakeSecretRegistry(client kubernetes.Interface) model.SecretRegistry

MakeSecretRegistry creates an adaptor for secrets on Kubernetes. The adaptor uses the following path for secrets: _name.namespace_ where name and namespace correpond to the secret name and namespace.

func ResolveConfig

func ResolveConfig(kubeconfig string) (string, error)

ResolveConfig checks whether to use the in-cluster or out-of-cluster config

Types

type ChainHandler

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

ChainHandler applies handlers in a sequence

func (*ChainHandler) Append

func (ch *ChainHandler) Append(h Handler)

Append a handler as the last handler in the chain

func (*ChainHandler) Apply

func (ch *ChainHandler) Apply(obj interface{}, event model.Event) error

Apply is the handler function

type Controller

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

Controller is a collection of synchronized resource watchers Caches are thread-safe

func NewController

func NewController(client kubernetes.Interface, mesh *proxyconfig.ProxyMeshConfig,
	options ControllerOptions) *Controller

NewController creates a new Kubernetes controller

func (*Controller) AppendInstanceHandler

func (c *Controller) AppendInstanceHandler(f func(*model.ServiceInstance, model.Event)) error

AppendInstanceHandler implements a service catalog operation

func (*Controller) AppendServiceHandler

func (c *Controller) AppendServiceHandler(f func(*model.Service, model.Event)) error

AppendServiceHandler implements a service catalog operation

func (*Controller) GetIstioServiceAccounts

func (c *Controller) GetIstioServiceAccounts(hostname string, ports []string) []string

GetIstioServiceAccounts returns the Istio service accounts running a serivce hostname. Each service account is encoded according to the SPIFFE VSID spec. For example, a service account named "bar" in namespace "foo" is encoded as "spiffe://cluster.local/ns/foo/sa/bar".

func (*Controller) GetService

func (c *Controller) GetService(hostname string) (*model.Service, bool)

GetService implements a service catalog operation

func (*Controller) HasSynced

func (c *Controller) HasSynced() bool

HasSynced returns true after the initial state synchronization

func (*Controller) HostInstances

func (c *Controller) HostInstances(addrs map[string]bool) []*model.ServiceInstance

HostInstances implements a service catalog operation

func (*Controller) Instances

func (c *Controller) Instances(hostname string, ports []string, tagsList model.TagsList) []*model.ServiceInstance

Instances implements a service catalog operation

func (*Controller) Run

func (c *Controller) Run(stop <-chan struct{})

Run all controllers until a signal is received

func (*Controller) Services

func (c *Controller) Services() []*model.Service

Services implements a service catalog operation

type ControllerOptions

type ControllerOptions struct {
	// Namespace to restrict controller to (empty to disable restriction)
	Namespace    string
	ResyncPeriod time.Duration
	DomainSuffix string
}

ControllerOptions stores the configurable attributes of a Controller.

type Handler

type Handler func(obj interface{}, event model.Event) error

Handler specifies a function to apply on an object for a given event type

type PodCache

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

PodCache is an eventually consistent pod cache

type Queue

type Queue interface {
	// Push a ticket
	Push(Task)
	// Run the loop until a signal on the channel
	Run(<-chan struct{})
}

Queue of work tickets processed using a rate-limiting loop

func NewQueue

func NewQueue(errorDelay time.Duration) Queue

NewQueue instantiates a queue with a processing function

type Task

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

Task object for the event watchers; processes until handler succeeds

func NewTask

func NewTask(handler Handler, obj interface{}, event model.Event) Task

NewTask creates a task from a work item

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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