restserver

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: MIT Imports: 27 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
	InvalidPrimaryIPConfig                  = 27
	PrimaryCANotSame                        = 28
	InconsistentIPConfigState               = 29
	InvalidSecondaryIPConfig                = 30
	NetworkContainerPendingStatePropagation = 31
	UnexpectedError                         = 99
)

Container Network Service remote API Contract.

Variables

This section is empty.

Functions

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]ipConfigurationStatus // 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) AllocateAnyAvailableIPConfig added in v1.1.5

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

func (*HTTPRestService) AllocateDesiredIPConfig added in v1.1.5

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

func (*HTTPRestService) CreateOrUpdateNetworkContainerInternal

func (service *HTTPRestService) CreateOrUpdateNetworkContainerInternal(req cns.CreateNetworkContainerRequest) int

This API will be called by CNS RequestController on CRD update.

func (*HTTPRestService) GetAllocatedIPConfigs added in v1.1.6

func (service *HTTPRestService) GetAllocatedIPConfigs() []ipConfigurationStatus

func (*HTTPRestService) GetAvailableIPConfigs

func (service *HTTPRestService) GetAvailableIPConfigs() []ipConfigurationStatus

func (*HTTPRestService) GetExistingIPConfig

func (service *HTTPRestService) GetExistingIPConfig(podInfo cns.KubernetesPodInfo) (ipConfigurationStatus, 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 Todo - CNI should also pass the IPAddress which needs to be released to validate if that is the right IP allcoated in the first place.

func (*HTTPRestService) SendNCSnapShotPeriodically

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

Sets up periodic timer for sending network container snapshots

func (*HTTPRestService) SetNodeOrchestrator

func (service *HTTPRestService) SetNodeOrchestrator(r *cns.SetOrchestratorTypeRequest)

SetNodeOrchestrator :- Set node orchestrator after registering with mDNC

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.

func (*HTTPRestService) SyncNodeStatus

func (service *HTTPRestService) SyncNodeStatus(dncEP, infraVnet, nodeID string, contextFromCNI json.RawMessage) (returnCode int, errStr string)

SyncNodeStatus :- Retrieve the latest node state from DNC & returns the first occurence of returnCode and error with respect to contextFromCNI

type HTTPService added in v1.0.0

type HTTPService interface {
	common.ServiceAPI
	SendNCSnapShotPeriodically(int, chan bool)
	SetNodeOrchestrator(*cns.SetOrchestratorTypeRequest)
	SyncNodeStatus(string, string, string, json.RawMessage) (int, string)
}

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