pods

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConsulRegisterEnabledAnnotation     string = "consul.register/enabled"
	ConsulRegisterServiceNameAnnotation string = "consul.register/service.name"
	CreatedByAnnotation                 string = "kubernetes.io/created-by"
	ExpectedContainerNamesAnnotation    string = "consul.register/pod.container.name"
)

These are valid annotations names which are take into account. "ConsulRegisterEnabledAnnotation" is a name of annotation key for `enabled` option. "ConsulRegisterServiceNameAnnotation" is a name of annotation key for `service.name` option. "CreatedByAnnotation" represents the key used to store the spec(json) used to create the resource "ExpectedContainerNamesAnnotation" is a name of container or list of names (separated by comma) which are take into account during register process.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller describes the attributes that are uses by Controller

func (*Controller) Clean

func (c *Controller) Clean() error

Clean checks Consul services and remove them if service does not appear in K8S cluster

func (*Controller) Sync

func (c *Controller) Sync() error

Sync synchronizes services between Consul and K8S cluster

func (*Controller) Watch

func (c *Controller) Watch()

Watch watches events in K8S cluster

type FactoryAdapter

type FactoryAdapter interface {
	Watch()
	Sync() error
	Clean() error
}

FactoryAdapter has a method to work with Controller resources.

func New

func New(clientset *kubernetes.Clientset, consulInstance consul.Adapter, cfg *config.Config, namespace string) FactoryAdapter

New creates an instance of controller

type PodInfo

type PodInfo struct {
	UID               types.UID
	Name              string
	Namespace         string
	Phase             v1.PodPhase
	IP                string
	NodeName          string
	Containers        []v1.Container
	ContainerStatuses []v1.ContainerStatus
	Ready             v1.ConditionStatus
	Labels            map[string]string
	Annotations       map[string]string
}

PodInfo represents information about a pod.

func (*PodInfo) PodToConsulService

func (p *PodInfo) PodToConsulService(containerStatus v1.ContainerStatus, cfg *config.Config) (*consulapi.AgentServiceRegistration, error)

PodToConsulService converts POD data to Consul service structure

Jump to

Keyboard shortcuts

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