registry

package
v0.0.0-...-6eef5cf Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2014 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package registry implements the storage and system logic for the core of the api server.

Index

Constants

This section is empty.

Variables

View Source
var ErrDoesNotExist = fmt.Errorf("The requested resource does not exist.")

Functions

func GetServiceEnvironmentVariables

func GetServiceEnvironmentVariables(registry ServiceRegistry, machine string) ([]api.EnvVar, error)

GetServiceEnvironmentVariables populates a list of environment variables that are use in the container environment to get access to services.

func MakeMinionRegistryStorage

func MakeMinionRegistryStorage(m MinionRegistry) apiserver.RESTStorage

func MakePodRegistryStorage

func MakePodRegistryStorage(registry PodRegistry,
	podInfoGetter client.PodInfoGetter,
	scheduler scheduler.Scheduler,
	minionLister scheduler.MinionLister,
	cloud cloudprovider.Interface,
	podCache client.PodInfoGetter) apiserver.RESTStorage

MakePodRegistryStorage makes a RESTStorage object for a pod registry. Parameters:

registry:      The pod registry
podInfoGetter: Source of fresh container info
scheduler:     The scheduler for assigning pods to machines
minionLister:  Object which can list available minions for the scheduler
cloud:         Interface to a cloud provider (may be null)
podCache:      Source of cached container info

func MakeServiceRegistryStorage

func MakeServiceRegistryStorage(registry ServiceRegistry, cloud cloudprovider.Interface, machines MinionRegistry) apiserver.RESTStorage

func NewControllerRegistryStorage

func NewControllerRegistryStorage(registry ControllerRegistry, podRegistry PodRegistry) apiserver.RESTStorage

Types

type BasicManifestFactory

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

func (*BasicManifestFactory) MakeManifest

func (b *BasicManifestFactory) MakeManifest(machine string, pod api.Pod) (api.ContainerManifest, error)

type CachingMinionRegistry

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

func (*CachingMinionRegistry) Contains

func (c *CachingMinionRegistry) Contains(minion string) (bool, error)

func (*CachingMinionRegistry) Delete

func (c *CachingMinionRegistry) Delete(minion string) error

func (*CachingMinionRegistry) Insert

func (c *CachingMinionRegistry) Insert(minion string) error

func (*CachingMinionRegistry) List

func (c *CachingMinionRegistry) List() ([]string, error)

type Clock

type Clock interface {
	Now() time.Time
}

type CloudMinionRegistry

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

func MakeCloudMinionRegistry

func MakeCloudMinionRegistry(cloud cloudprovider.Interface, matchRE string) (*CloudMinionRegistry, error)

func (*CloudMinionRegistry) Contains

func (c *CloudMinionRegistry) Contains(minion string) (bool, error)

func (*CloudMinionRegistry) Delete

func (c *CloudMinionRegistry) Delete(minion string) error

func (*CloudMinionRegistry) Insert

func (c *CloudMinionRegistry) Insert(minion string) error

func (*CloudMinionRegistry) List

func (c *CloudMinionRegistry) List() ([]string, error)

type ControllerRegistry

type ControllerRegistry interface {
	ListControllers() ([]api.ReplicationController, error)
	GetController(controllerID string) (*api.ReplicationController, error)
	CreateController(controller api.ReplicationController) error
	UpdateController(controller api.ReplicationController) error
	DeleteController(controllerID string) error
}

ControllerRegistry is an interface for things that know how to store ReplicationControllers.

type ControllerRegistryStorage

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

ControllerRegistryStorage is an implementation of RESTStorage for the api server.

func (*ControllerRegistryStorage) Create

func (storage *ControllerRegistryStorage) Create(obj interface{}) (<-chan interface{}, error)

Create registers a given new ReplicationController instance to storage.registry.

func (*ControllerRegistryStorage) Delete

func (storage *ControllerRegistryStorage) Delete(id string) (<-chan interface{}, error)

Delete asynchronously deletes the ReplicationController specified by its id.

func (*ControllerRegistryStorage) Extract

func (storage *ControllerRegistryStorage) Extract(body []byte) (interface{}, error)

Extract deserializes user provided data into an api.ReplicationController.

func (*ControllerRegistryStorage) Get

func (storage *ControllerRegistryStorage) Get(id string) (interface{}, error)

Get obtains the ReplicationController specified by its id.

func (*ControllerRegistryStorage) List

func (storage *ControllerRegistryStorage) List(selector labels.Selector) (interface{}, error)

List obtains a list of ReplicationControllers that match selector.

func (*ControllerRegistryStorage) Update

func (storage *ControllerRegistryStorage) Update(obj interface{}) (<-chan interface{}, error)

Update replaces a given ReplicationController instance with an existing instance in storage.registry.

type EndpointController

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

func MakeEndpointController

func MakeEndpointController(serviceRegistry ServiceRegistry, client *client.Client) *EndpointController

func (*EndpointController) SyncServiceEndpoints

func (e *EndpointController) SyncServiceEndpoints() error

type EtcdRegistry

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

EtcdRegistry implements PodRegistry, ControllerRegistry and ServiceRegistry with backed by etcd.

func MakeEtcdRegistry

func MakeEtcdRegistry(client tools.EtcdClient, machines MinionRegistry) *EtcdRegistry

MakeEtcdRegistry creates an etcd registry. 'client' is the connection to etcd 'machines' is the list of machines 'scheduler' is the scheduling algorithm to use.

func (*EtcdRegistry) CreateController

func (registry *EtcdRegistry) CreateController(controller api.ReplicationController) error

CreateController creates a new ReplicationController.

func (*EtcdRegistry) CreatePod

func (registry *EtcdRegistry) CreatePod(machineIn string, pod api.Pod) error

CreatePod creates a pod based on a specification, schedule it onto a specific machine.

func (*EtcdRegistry) CreateService

func (registry *EtcdRegistry) CreateService(svc api.Service) error

CreateService creates a new Service.

func (*EtcdRegistry) DeleteController

func (registry *EtcdRegistry) DeleteController(controllerID string) error

DeleteController deletes a ReplicationController specified by its ID.

func (*EtcdRegistry) DeletePod

func (registry *EtcdRegistry) DeletePod(podID string) error

DeletePod deletes an existing pod specified by its ID.

func (*EtcdRegistry) DeleteService

func (registry *EtcdRegistry) DeleteService(name string) error

DeleteService deletes a Service specified by its name.

func (*EtcdRegistry) GetController

func (registry *EtcdRegistry) GetController(controllerID string) (*api.ReplicationController, error)

GetController gets a specific ReplicationController specified by its ID.

func (*EtcdRegistry) GetPod

func (registry *EtcdRegistry) GetPod(podID string) (*api.Pod, error)

GetPod gets a specific pod specified by its ID.

func (*EtcdRegistry) GetService

func (registry *EtcdRegistry) GetService(name string) (*api.Service, error)

GetService obtains a Service specified by its name.

func (*EtcdRegistry) ListControllers

func (registry *EtcdRegistry) ListControllers() ([]api.ReplicationController, error)

ListControllers obtains a list of ReplicationControllers.

func (*EtcdRegistry) ListPods

func (registry *EtcdRegistry) ListPods(selector labels.Selector) ([]api.Pod, error)

ListPods obtains a list of pods that match selector.

func (*EtcdRegistry) ListServices

func (registry *EtcdRegistry) ListServices() (api.ServiceList, error)

ListServices obtains a list of Services.

func (*EtcdRegistry) UpdateController

func (registry *EtcdRegistry) UpdateController(controller api.ReplicationController) error

UpdateController replaces an existing ReplicationController.

func (*EtcdRegistry) UpdateEndpoints

func (registry *EtcdRegistry) UpdateEndpoints(e api.Endpoints) error

UpdateEndpoints update Endpoints of a Service.

func (*EtcdRegistry) UpdatePod

func (registry *EtcdRegistry) UpdatePod(pod api.Pod) error

func (*EtcdRegistry) UpdateService

func (registry *EtcdRegistry) UpdateService(svc api.Service) error

UpdateService replaces an existing Service.

type HealthyMinionRegistry

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

func (*HealthyMinionRegistry) Contains

func (h *HealthyMinionRegistry) Contains(minion string) (bool, error)

func (*HealthyMinionRegistry) Delete

func (h *HealthyMinionRegistry) Delete(minion string) error

func (*HealthyMinionRegistry) Insert

func (h *HealthyMinionRegistry) Insert(minion string) error

func (*HealthyMinionRegistry) List

func (h *HealthyMinionRegistry) List() (currentMinions []string, err error)

type ManifestFactory

type ManifestFactory interface {
	// Make a container object for a given pod, given the machine that the pod is running on.
	MakeManifest(machine string, pod api.Pod) (api.ContainerManifest, error)
}

type MemoryRegistry

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

An implementation of PodRegistry and ControllerRegistry that is backed by memory Mainly used for testing.

func MakeMemoryRegistry

func MakeMemoryRegistry() *MemoryRegistry

func (*MemoryRegistry) CreateController

func (registry *MemoryRegistry) CreateController(controller api.ReplicationController) error

func (*MemoryRegistry) CreatePod

func (registry *MemoryRegistry) CreatePod(machine string, pod api.Pod) error

func (*MemoryRegistry) CreateService

func (registry *MemoryRegistry) CreateService(svc api.Service) error

func (*MemoryRegistry) DeleteController

func (registry *MemoryRegistry) DeleteController(controllerID string) error

func (*MemoryRegistry) DeletePod

func (registry *MemoryRegistry) DeletePod(podID string) error

func (*MemoryRegistry) DeleteService

func (registry *MemoryRegistry) DeleteService(name string) error

func (*MemoryRegistry) GetController

func (registry *MemoryRegistry) GetController(controllerID string) (*api.ReplicationController, error)

func (*MemoryRegistry) GetPod

func (registry *MemoryRegistry) GetPod(podID string) (*api.Pod, error)

func (*MemoryRegistry) GetService

func (registry *MemoryRegistry) GetService(name string) (*api.Service, error)

func (*MemoryRegistry) ListControllers

func (registry *MemoryRegistry) ListControllers() ([]api.ReplicationController, error)

func (*MemoryRegistry) ListPods

func (registry *MemoryRegistry) ListPods(selector labels.Selector) ([]api.Pod, error)

func (*MemoryRegistry) ListServices

func (registry *MemoryRegistry) ListServices() (api.ServiceList, error)

func (*MemoryRegistry) UpdateController

func (registry *MemoryRegistry) UpdateController(controller api.ReplicationController) error

func (*MemoryRegistry) UpdateEndpoints

func (registry *MemoryRegistry) UpdateEndpoints(e api.Endpoints) error

func (*MemoryRegistry) UpdatePod

func (registry *MemoryRegistry) UpdatePod(pod api.Pod) error

func (*MemoryRegistry) UpdateService

func (registry *MemoryRegistry) UpdateService(svc api.Service) error

type MinionRegistry

type MinionRegistry interface {
	List() (currentMinions []string, err error)
	Insert(minion string) error
	Delete(minion string) error
	Contains(minion string) (bool, error)
}

Keep track of a set of minions. Safe for concurrent reading/writing.

func MakeMinionRegistry

func MakeMinionRegistry(minions []string) MinionRegistry

Initialize a minion registry with a list of minions.

func NewCachingMinionRegistry

func NewCachingMinionRegistry(delegate MinionRegistry, ttl time.Duration) (MinionRegistry, error)

func NewHealthyMinionRegistry

func NewHealthyMinionRegistry(delegate MinionRegistry, client *http.Client) MinionRegistry

type MinionRegistryStorage

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

MinionRegistryStorage implements the RESTStorage interface, backed by a MinionRegistry.

func (*MinionRegistryStorage) Create

func (storage *MinionRegistryStorage) Create(obj interface{}) (<-chan interface{}, error)

func (*MinionRegistryStorage) Delete

func (storage *MinionRegistryStorage) Delete(id string) (<-chan interface{}, error)

func (*MinionRegistryStorage) Extract

func (storage *MinionRegistryStorage) Extract(body []byte) (interface{}, error)

func (*MinionRegistryStorage) Get

func (storage *MinionRegistryStorage) Get(id string) (interface{}, error)

func (*MinionRegistryStorage) List

func (storage *MinionRegistryStorage) List(selector labels.Selector) (interface{}, error)

func (*MinionRegistryStorage) Update

func (storage *MinionRegistryStorage) Update(minion interface{}) (<-chan interface{}, error)

type MockMinionRegistry

type MockMinionRegistry struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func MakeMockMinionRegistry

func MakeMockMinionRegistry(minions []string) *MockMinionRegistry

func (*MockMinionRegistry) Contains

func (registry *MockMinionRegistry) Contains(minion string) (bool, error)

func (*MockMinionRegistry) Delete

func (registry *MockMinionRegistry) Delete(minion string) error

func (*MockMinionRegistry) Insert

func (registry *MockMinionRegistry) Insert(minion string) error

func (*MockMinionRegistry) List

func (registry *MockMinionRegistry) List() ([]string, error)

type MockPodRegistry

type MockPodRegistry struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func MakeMockPodRegistry

func MakeMockPodRegistry(pods []api.Pod) *MockPodRegistry

func (*MockPodRegistry) CreatePod

func (registry *MockPodRegistry) CreatePod(machine string, pod api.Pod) error

func (*MockPodRegistry) DeletePod

func (registry *MockPodRegistry) DeletePod(podId string) error

func (*MockPodRegistry) GetPod

func (registry *MockPodRegistry) GetPod(podId string) (*api.Pod, error)

func (*MockPodRegistry) ListPods

func (registry *MockPodRegistry) ListPods(selector labels.Selector) ([]api.Pod, error)

func (*MockPodRegistry) UpdatePod

func (registry *MockPodRegistry) UpdatePod(pod api.Pod) error

type MockServiceRegistry

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

func (*MockServiceRegistry) CreateService

func (m *MockServiceRegistry) CreateService(svc api.Service) error

func (*MockServiceRegistry) DeleteService

func (m *MockServiceRegistry) DeleteService(name string) error

func (*MockServiceRegistry) GetService

func (m *MockServiceRegistry) GetService(name string) (*api.Service, error)

func (*MockServiceRegistry) ListServices

func (m *MockServiceRegistry) ListServices() (api.ServiceList, error)

func (*MockServiceRegistry) UpdateEndpoints

func (m *MockServiceRegistry) UpdateEndpoints(e api.Endpoints) error

func (*MockServiceRegistry) UpdateService

func (m *MockServiceRegistry) UpdateService(svc api.Service) error

type PodRegistry

type PodRegistry interface {
	// ListPods obtains a list of pods that match selector.
	ListPods(selector labels.Selector) ([]api.Pod, error)
	// Get a specific pod
	GetPod(podID string) (*api.Pod, error)
	// Create a pod based on a specification, schedule it onto a specific machine.
	CreatePod(machine string, pod api.Pod) error
	// Update an existing pod
	UpdatePod(pod api.Pod) error
	// Delete an existing pod
	DeletePod(podID string) error
}

PodRegistry is an interface implemented by things that know how to store Pod objects.

type PodRegistryStorage

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

PodRegistryStorage implements the RESTStorage interface in terms of a PodRegistry

func (*PodRegistryStorage) Create

func (storage *PodRegistryStorage) Create(obj interface{}) (<-chan interface{}, error)

func (*PodRegistryStorage) Delete

func (storage *PodRegistryStorage) Delete(id string) (<-chan interface{}, error)

func (*PodRegistryStorage) Extract

func (storage *PodRegistryStorage) Extract(body []byte) (interface{}, error)

func (*PodRegistryStorage) Get

func (storage *PodRegistryStorage) Get(id string) (interface{}, error)

func (*PodRegistryStorage) List

func (storage *PodRegistryStorage) List(selector labels.Selector) (interface{}, error)

func (*PodRegistryStorage) Update

func (storage *PodRegistryStorage) Update(obj interface{}) (<-chan interface{}, error)

type ServiceRegistry

type ServiceRegistry interface {
	ListServices() (api.ServiceList, error)
	CreateService(svc api.Service) error
	GetService(name string) (*api.Service, error)
	DeleteService(name string) error
	UpdateService(svc api.Service) error
	UpdateEndpoints(e api.Endpoints) error
}

ServiceRegistry is an interface for things that know how to store services.

type ServiceRegistryStorage

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

func (*ServiceRegistryStorage) Create

func (sr *ServiceRegistryStorage) Create(obj interface{}) (<-chan interface{}, error)

func (*ServiceRegistryStorage) Delete

func (sr *ServiceRegistryStorage) Delete(id string) (<-chan interface{}, error)

func (*ServiceRegistryStorage) Extract

func (sr *ServiceRegistryStorage) Extract(body []byte) (interface{}, error)

func (*ServiceRegistryStorage) Get

func (sr *ServiceRegistryStorage) Get(id string) (interface{}, error)

func (*ServiceRegistryStorage) List

func (sr *ServiceRegistryStorage) List(selector labels.Selector) (interface{}, error)

func (*ServiceRegistryStorage) Update

func (sr *ServiceRegistryStorage) Update(obj interface{}) (<-chan interface{}, error)

type SystemClock

type SystemClock struct{}

func (SystemClock) Now

func (SystemClock) Now() time.Time

Jump to

Keyboard shortcuts

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