restserver

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 23 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Success                         = 0
	UnsupportedNetworkType          = 1
	InvalidParameter                = 2
	UnsupportedEnvironment          = 3
	UnreachableHost                 = 4
	ReservationNotFound             = 5
	MalformedSubnet                 = 8
	UnreachableDockerDaemon         = 9
	UnspecifiedNetworkName          = 10
	NotFound                        = 14
	AddressUnavailable              = 15
	NetworkContainerNotSpecified    = 16
	CallToHostFailed                = 17
	UnknownContainerID              = 18
	UnsupportedOrchestratorType     = 19
	DockerContainerNotSpecified     = 20
	UnsupportedVerb                 = 21
	UnsupportedNetworkContainerType = 22
	InvalidRequest                  = 23
	NetworkJoinFailed               = 24
	NetworkContainerPublishFailed   = 25
	NetworkContainerUnpublishFailed = 26
	UnexpectedError                 = 99
)

Container Network Service remote API Contract.

Variables

This section is empty.

Functions

func NewPodState added in v1.1.5

func NewPodState(ipaddress string, prefixLength uint8, id, ncid, state string) *cns.ContainerIPConfigState

func NewPodStateWithOrchestratorContext added in v1.1.5

func NewPodStateWithOrchestratorContext(ipaddress string, prefixLength uint8, id, ncid, state string, orchestratorContext cns.KubernetesPodInfo) (*cns.ContainerIPConfigState, error)

func ReturnCodeToString added in v1.0.16

func ReturnCodeToString(returnCode int) (s string)

ReturnCodeToString - Converts an error code to appropriate string.

Types

type HTTPRestService

type HTTPRestService struct {
	*cns.Service

	PodIPIDByOrchestratorContext map[string]string                      // OrchestratorContext is key and value is Pod IP uuid.
	PodIPConfigState             map[string]*cns.ContainerIPConfigState // seondaryipid(uuid) is key
	AllocatedIPCount             map[string]allocatedIPCount            // key - ncid

	sync.RWMutex
	// contains filtered or unexported fields
}

HTTPRestService represents http listener for CNS - Container Networking Service.

func (*HTTPRestService) AddIPConfigsToState added in v1.1.5

func (service *HTTPRestService) AddIPConfigsToState(ipconfigs []*cns.ContainerIPConfigState) error

AddIPConfigsToState takes a lock on the service object, and will add an array of ipconfigs to the CNS Service. Used to add IPConfigs to the CNS pool, specifically in the scenario of rebatching.

func (*HTTPRestService) AllocateAnyAvailableIPConfig added in v1.1.5

func (service *HTTPRestService) AllocateAnyAvailableIPConfig(podInfo cns.KubernetesPodInfo, orchestratorContext json.RawMessage) (*cns.ContainerIPConfigState, error)

func (*HTTPRestService) AllocateDesiredIPConfig added in v1.1.5

func (service *HTTPRestService) AllocateDesiredIPConfig(podInfo cns.KubernetesPodInfo, desiredIPAddress string, orchestratorContext json.RawMessage) (*cns.ContainerIPConfigState, error)

func (*HTTPRestService) GetExistingIPConfig

func (service *HTTPRestService) GetExistingIPConfig(podInfo cns.KubernetesPodInfo) (*cns.ContainerIPConfigState, bool, error)

func (*HTTPRestService) GetPartitionKey

func (service *HTTPRestService) GetPartitionKey() (dncPartitionKey string)

GetPartitionKey - Get dnc/service partition key

func (*HTTPRestService) ReleaseIPConfig added in v1.1.5

func (service *HTTPRestService) ReleaseIPConfig(podInfo cns.KubernetesPodInfo) error

//SetIPConfigAsAllocated takes a lock of the service, and sets the ipconfig in the CNS stateas Available

func (*HTTPRestService) RemoveIPConfigsFromState added in v1.1.5

func (service *HTTPRestService) RemoveIPConfigsFromState(ipconfigs []*cns.ContainerIPConfigState) error

RemoveIPConfigsFromState takes a lock on the service object, and will remove an array of ipconfigs to the CNS Service. Used to add IPConfigs to the CNS pool, specifically in the scenario of rebatching.

func (*HTTPRestService) SendNCSnapShotPeriodically

func (service *HTTPRestService) SendNCSnapShotPeriodically(ncSnapshotIntervalInMinutes int, stopSnapshot chan bool)

Sets up periodic timer for sending network container snapshots

func (*HTTPRestService) Start

func (service *HTTPRestService) Start(config *common.ServiceConfig) error

Start starts the CNS listener.

func (*HTTPRestService) Stop

func (service *HTTPRestService) Stop()

Stop stops the CNS.

type HTTPService added in v1.0.0

type HTTPService interface {
	common.ServiceAPI
	SendNCSnapShotPeriodically(int, chan bool)
}

HTTPService describes the min API interface that every service should have.

func NewHTTPRestService

func NewHTTPRestService(config *common.ServiceConfig) (HTTPService, error)

NewHTTPRestService creates a new HTTP Service object.

Jump to

Keyboard shortcuts

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