service

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package service provides the Registry interface and its RESTStorage implementation for storing Service api objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectServiceNodePorts

func CollectServiceNodePorts(service *api.Service) []int

Types

type REST

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

REST adapts a service registry into apiserver's RESTStorage model.

func NewStorage

func NewStorage(registry Registry, endpoints endpoint.Registry, serviceIPs ipallocator.Interface,
	serviceNodePorts portallocator.Interface) *REST

NewStorage returns a new REST.

func (*REST) Create

func (rs *REST) Create(ctx api.Context, obj runtime.Object) (runtime.Object, error)

func (*REST) Delete

func (rs *REST) Delete(ctx api.Context, id string) (runtime.Object, error)

func (*REST) Get

func (rs *REST) Get(ctx api.Context, id string) (runtime.Object, error)

func (*REST) List

func (rs *REST) List(ctx api.Context, label labels.Selector, field fields.Selector) (runtime.Object, error)

func (*REST) New

func (*REST) New() runtime.Object

func (*REST) NewList

func (*REST) NewList() runtime.Object

func (*REST) ResourceLocation

func (rs *REST) ResourceLocation(ctx api.Context, id string) (*url.URL, http.RoundTripper, error)

ResourceLocation returns a URL to which one can send traffic for the specified service.

func (*REST) Update

func (rs *REST) Update(ctx api.Context, obj runtime.Object) (runtime.Object, bool, error)

func (*REST) Watch

func (rs *REST) Watch(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

Watch returns Services events via a watch.Interface. It implements rest.Watcher.

type RangeRegistry

type RangeRegistry interface {
	// Get returns the latest allocation, an empty object if no allocation has been made,
	// or an error if the allocation could not be retrieved.
	Get() (*api.RangeAllocation, error)
	// CreateOrUpdate should create or update the provide allocation, unless a conflict
	// has occurred since the item was last created.
	CreateOrUpdate(*api.RangeAllocation) error
}

TODO: Move to a general location (as other components may need allocation in future; it's not service specific) RangeRegistry is a registry that can retrieve or persist a RangeAllocation object.

type Registry

type Registry interface {
	ListServices(ctx api.Context, label labels.Selector, field fields.Selector) (*api.ServiceList, error)
	CreateService(ctx api.Context, svc *api.Service) (*api.Service, error)
	GetService(ctx api.Context, name string) (*api.Service, error)
	DeleteService(ctx api.Context, name string) error
	UpdateService(ctx api.Context, svc *api.Service) (*api.Service, error)
	WatchServices(ctx api.Context, labels labels.Selector, fields fields.Selector, resourceVersion string) (watch.Interface, error)
}

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

func NewRegistry

func NewRegistry(s rest.StandardStorage) Registry

NewRegistry returns a new Registry interface for the given Storage. Any mismatched types will panic.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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