restserver

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 29 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
	NetworkContainerVfpProgramPending      = 31
	FailedToAllocateIpConfig               = 32
	EmptyOrchestratorContext               = 33
	UnsupportedOrchestratorContext         = 34
	NetworkContainerVfpProgramComplete     = 35
	NetworkContainerVfpProgramCheckSkipped = 36
	UnexpectedError                        = 99
)

Container Network Service remote API Contract.

Variables

This section is empty.

Functions

func NewHTTPRestService

func NewHTTPRestService(config *common.ServiceConfig, imdsClientInterface imdsclient.ImdsClientInterface) (cns.HTTPService, error)

NewHTTPRestService creates a new HTTP Service object.

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.IPConfigurationStatus // seondaryipid(uuid) is key
	AllocatedIPCount             map[string]allocatedIPCount          // key - ncid
	IPAMPoolMonitor              cns.IPAMPoolMonitor

	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) (cns.PodIpInfo, error)

func (*HTTPRestService) AllocateDesiredIPConfig added in v1.1.5

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

func (*HTTPRestService) CreateOrUpdateNetworkContainerInternal

func (service *HTTPRestService) CreateOrUpdateNetworkContainerInternal(req cns.CreateNetworkContainerRequest, scalar nnc.Scaler, spec nnc.NodeNetworkConfigSpec) int

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

func (*HTTPRestService) GetAllocatedIPConfigs added in v1.1.6

func (service *HTTPRestService) GetAllocatedIPConfigs() []cns.IPConfigurationStatus

func (*HTTPRestService) GetAvailableIPConfigs

func (service *HTTPRestService) GetAvailableIPConfigs() []cns.IPConfigurationStatus

func (*HTTPRestService) GetExistingIPConfig

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

func (*HTTPRestService) GetPartitionKey

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

GetPartitionKey - Get dnc/service partition key

func (*HTTPRestService) GetPendingProgramIPConfigs

func (service *HTTPRestService) GetPendingProgramIPConfigs() []cns.IPConfigurationStatus

GetPendingProgramIPConfigs returns list of IPs which are in pending program status

func (*HTTPRestService) GetPendingReleaseIPConfigs

func (service *HTTPRestService) GetPendingReleaseIPConfigs() []cns.IPConfigurationStatus

func (*HTTPRestService) GetPodIPConfigState

func (service *HTTPRestService) GetPodIPConfigState() map[string]cns.IPConfigurationStatus

func (*HTTPRestService) MarkExistingIPsAsPending added in v1.1.8

func (service *HTTPRestService) MarkExistingIPsAsPending(pendingIPIDs []string) error

called when CNS is starting up and there are existing ipconfigs in the CRD that are marked as pending

func (*HTTPRestService) MarkIPsAsPending added in v1.1.8

func (service *HTTPRestService) MarkIPsAsPending(numberToMark int) (map[string]cns.IPConfigurationStatus, error)

func (*HTTPRestService) ReconcileNCState added in v1.1.7

func (service *HTTPRestService) ReconcileNCState(ncRequest *cns.CreateNetworkContainerRequest, podInfoByIp map[string]cns.KubernetesPodInfo, scalar nnc.Scaler, spec nnc.NodeNetworkConfigSpec) int

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

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

Jump to

Keyboard shortcuts

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