kubernetes

package
v0.0.0-...-c360844 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2016 License: MIT Imports: 27 Imported by: 8

Documentation

Index

Constants

View Source
const (
	Add    = "ADD"
	Update = "UPDATE"
	Delete = "DELETE"

	ServiceKind   = "service"
	ServicesKind  = "services"
	IngressKind   = "ingress"
	IngressesKind = "ingresses"
	EndpointsKind = "endpoints"

	HostPart   = "host"
	PathPart   = "path"
	PrefixPart = "prefix"
	MethodPart = "method"
	HeaderPart = "header"

	HostKey    = "host"
	PathKey    = "path"
	PrefixKey  = "prefix"
	MethodsKey = "methods"
	HeadersKey = "headers"

	HTTP  = "http"
	HTTPS = "https"
	TCP   = "tcp"
)

Variables

View Source
var (
	ByID = func(a, b *Resource) bool { return a.id < b.id }
)
View Source
var (
	Keyspace string
)

Functions

func AddServers

func AddServers(rsc *Resource, svc *api.Service, en *api.Endpoints, port api.ServicePort)

func CreateFullController

func CreateFullController(kind string, w Updater, c cache.Getter, sel Selector, resync time.Duration) (cache.Store, *framework.Controller)

func CreateStore

func CreateStore(kind string, c cache.Getter, sel Selector, resync time.Duration, ctx context.Context) (cache.Store, error)

func CreateUpdateController

func CreateUpdateController(kind string, w Updater, c cache.Getter, sel Selector, resync time.Duration) (cache.Store, *framework.Controller)

func GenResourceID

func GenResourceID(namespace, name string, port intstr.IntOrString) string

func GenServerID

func GenServerID(namespace, name, ip string, port int) string

func GetServicePort

func GetServicePort(svc *api.Service, port intstr.IntOrString) (api.ServicePort, bool)

func HasServiceIP

func HasServiceIP(s *api.Service) bool

func Sort

func Sort(list ResourceList, fn func(a, b *Resource) bool)

func Status

func Status(client *Client) error

Types

type Cache

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

Cache is a convenience struct so we can pass around all our various caches

func NewCache

func NewCache() *Cache

func (*Cache) GetEndpoints

func (k *Cache) GetEndpoints(client unversioned.Interface, namespace, name string) (*api.Endpoints, error)

func (*Cache) GetIngress

func (k *Cache) GetIngress(client unversioned.ExtensionsInterface, namespace, name string) (*extensions.Ingress, error)

func (*Cache) GetService

func (k *Cache) GetService(client unversioned.Interface, namespace, name string) (*api.Service, error)

func (*Cache) MapServiceToIngress

func (k *Cache) MapServiceToIngress(namespace, serviceName, ingressName string)

func (*Cache) ServiceDeleted

func (k *Cache) ServiceDeleted(namespace, name string)

func (*Cache) SetEndpointsStore

func (k *Cache) SetEndpointsStore(store cache.Store)

func (*Cache) SetIngressStore

func (k *Cache) SetIngressStore(store cache.Store)

func (*Cache) SetServiceStore

func (k *Cache) SetServiceStore(store cache.Store)

type Client

type Client struct {
	*unversioned.Client
}

func NewClient

func NewClient(kubeapi, user, pass string, insecure bool) (*Client, error)

func (*Client) GetDiscoveryClient

func (c *Client) GetDiscoveryClient() *unversioned.DiscoveryClient

func (*Client) GetExtensionsClient

func (c *Client) GetExtensionsClient() *unversioned.ExtensionsClient

func (*Client) GetUnversionedClient

func (c *Client) GetUnversionedClient() *unversioned.Client

type Endpoints

type Endpoints api.Endpoints

func (Endpoints) String

func (e Endpoints) String() string

type Ingress

type Ingress extensions.Ingress

func (Ingress) String

func (i Ingress) String() string

type Resource

type Resource struct {
	*Route
	// contains filtered or unexported fields
}

Resource is a single loadbalancer Resource or service pulled out of kubernetes objects

func NewResource

func NewResource(id, namespace string, anno annotations) *Resource

NewResource returns a Resource pointer given an id, annotations and an annotations namespace which should be ServicePort.Name

func (*Resource) AddServer

func (r *Resource) AddServer(id, scheme, ip string, port int)

func (*Resource) GetAnnotation

func (r *Resource) GetAnnotation(key string) (val string, ok bool)

func (*Resource) GetAnnotations

func (r *Resource) GetAnnotations(expr string) (map[string]string, error)

func (*Resource) ID

func (r *Resource) ID() string

func (*Resource) IsWebsocket

func (r *Resource) IsWebsocket() bool

func (*Resource) NoServers

func (r *Resource) NoServers() bool

func (*Resource) Servers

func (r *Resource) Servers() ServerList

func (Resource) String

func (r Resource) String() string

type ResourceList

type ResourceList []*Resource

func GenResources

func GenResources(store *Cache, client SuperClient, obj interface{}) (ResourceList, error)

GenResources parses a given kubernetes object and returns a ResourceList or an error if the object is not a Service, Endpoints or Ingress. Returned ResourceList can be empty.

func (ResourceList) Map

func (r ResourceList) Map() map[string]*Resource

func (ResourceList) String

func (r ResourceList) String() string

type Route

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

func NewRoute

func NewRoute(id string, anno annotations) *Route

NewRoute returns a pointer to a Route given a set of annotations. The annotations are assumed to already be processed such that the keys no longer have the Keyspace prefix (e.g. romulus/) and the namespace (e.g. ServicePort.Name).

func (*Route) AddHeader

func (r *Route) AddHeader(header, value string) error

func (*Route) AddHost

func (r *Route) AddHost(host string) error

func (*Route) AddMethod

func (r *Route) AddMethod(method string) error

func (*Route) AddPath

func (r *Route) AddPath(path string) error

func (*Route) AddPrefix

func (r *Route) AddPrefix(pre string) error

func (*Route) Empty

func (r *Route) Empty() bool

func (*Route) Parts

func (r *Route) Parts() []*routePart

func (Route) String

func (r Route) String() string

type Selector

type Selector map[string]string

type Server

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

func (*Server) ID

func (s *Server) ID() string

func (*Server) IsWebsocket

func (s *Server) IsWebsocket() bool

func (Server) String

func (s Server) String() string

func (*Server) URL

func (s *Server) URL() *url.URL

type ServerList

type ServerList []*Server

func (ServerList) String

func (s ServerList) String() string

type Service

type Service api.Service

func (Service) IsFrontend

func (s Service) IsFrontend() bool

func (Service) String

func (s Service) String() string

type SuperClient

type SuperClient interface {
	unversioned.Interface
	unversioned.ExtensionsInterface
}

SuperClient is a convenience interface that includes unversioned.Interface & ExtensionsInterface

type Updater

type Updater interface {
	Add(obj interface{})
	Delete(obj interface{})
	Update(old, next interface{})
}

Updater will be fed into framework.ResourceEventHandlerFuncs

Jump to

Keyboard shortcuts

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