kube

package
v0.0.0-...-1581578 Latest Latest
Warning

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

Go to latest
Published: May 24, 2018 License: Apache-2.0 Imports: 25 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"
	// IstioNamespace used by default for Istio cluster-wide installation
	IstioNamespace = "istio-system"
)
View Source
const (
	// IngressClassAnnotation is the annotation on ingress resources for the class of controllers
	// responsible for it
	IngressClassAnnotation = "kubernetes.io/ingress.class"

	// KubeServiceAccountsOnVMAnnotation is to specify the K8s service accounts that are allowed to run
	// this service on the VMs
	KubeServiceAccountsOnVMAnnotation = "alpha.istio.io/kubernetes-serviceaccounts"

	// CanonicalServiceAccountsOnVMAnnotation is to specify the non-Kubernetes service accounts that
	// are allowed to run this service on the VMs
	CanonicalServiceAccountsOnVMAnnotation = "alpha.istio.io/canonical-serviceaccounts"

	// IstioURIPrefix is the URI prefix in the Istio service account scheme
	IstioURIPrefix = "spiffe"

	// PortAuthenticationAnnotationKeyPrefix is the annotation key prefix that used to define
	// authentication policy.
	PortAuthenticationAnnotationKeyPrefix = "auth.istio.io"
)

Variables

This section is empty.

Functions

func ConvertProtocol

func ConvertProtocol(name string, proto v1.Protocol) model.Protocol

ConvertProtocol from k8s protocol and port name

func CreateInterface

func CreateInterface(kubeconfig string) (*rest.Config, 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 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, options ControllerOptions) *Controller

NewController creates a new Kubernetes controller

func (*Controller) HasSynced

func (c *Controller) HasSynced() bool

HasSynced returns true after the initial state synchronization

func (*Controller) Instances

func (c *Controller) Instances() map[string][]model.Endpoint

Instances ...

func (*Controller) QueueSchedule

func (c *Controller) QueueSchedule(job func())

QueueSchedule ...

func (*Controller) RegisterEndpointHandler

func (c *Controller) RegisterEndpointHandler(f func())

RegisterEndpointHandler ...

func (*Controller) RegisterServiceHandler

func (c *Controller) RegisterServiceHandler(f func())

RegisterServiceHandler ...

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

func (*Controller) Workload

func (c *Controller) Workload(id string) (model.Instance, error)

Workload returns the workload descriptor

type ControllerOptions

type ControllerOptions struct {
	// Namespace the controller watches. If set to meta_v1.NamespaceAll (""), controller watches all namespaces
	WatchedNamespace 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

Jump to

Keyboard shortcuts

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