Documentation ¶
Index ¶
- Constants
- func NewHTTPRestService(config *common.ServiceConfig, ...) (cns.HTTPService, error)
- func ReturnCodeToString(returnCode int) (s string)
- type HTTPRestService
- func (service *HTTPRestService) AllocateAnyAvailableIPConfig(podInfo cns.KubernetesPodInfo, orchestratorContext json.RawMessage) (cns.PodIpInfo, error)
- func (service *HTTPRestService) AllocateDesiredIPConfig(podInfo cns.KubernetesPodInfo, desiredIPAddress string, ...) (cns.PodIpInfo, error)
- func (service *HTTPRestService) CreateOrUpdateNetworkContainerInternal(req cns.CreateNetworkContainerRequest, scalar nnc.Scaler, ...) int
- func (service *HTTPRestService) GetAllocatedIPConfigs() []cns.IPConfigurationStatus
- func (service *HTTPRestService) GetAvailableIPConfigs() []cns.IPConfigurationStatus
- func (service *HTTPRestService) GetExistingIPConfig(podInfo cns.KubernetesPodInfo) (cns.PodIpInfo, bool, error)
- func (service *HTTPRestService) GetPartitionKey() (dncPartitionKey string)
- func (service *HTTPRestService) GetPendingProgramIPConfigs() []cns.IPConfigurationStatus
- func (service *HTTPRestService) GetPendingReleaseIPConfigs() []cns.IPConfigurationStatus
- func (service *HTTPRestService) GetPodIPConfigState() map[string]cns.IPConfigurationStatus
- func (service *HTTPRestService) Init(config *common.ServiceConfig) error
- func (service *HTTPRestService) MarkExistingIPsAsPending(pendingIPIDs []string) error
- func (service *HTTPRestService) MarkIPAsPendingRelease(totalIpsToRelease int) (map[string]cns.IPConfigurationStatus, error)
- func (service *HTTPRestService) MarkIpsAsAvailableUntransacted(ncID string, newHostNCVersion int)
- func (service *HTTPRestService) ReconcileNCState(ncRequest *cns.CreateNetworkContainerRequest, ...) int
- func (service *HTTPRestService) SendNCSnapShotPeriodically(ncSnapshotIntervalInMinutes int, stopSnapshot chan bool)
- func (service *HTTPRestService) SetNodeOrchestrator(r *cns.SetOrchestratorTypeRequest)
- func (service *HTTPRestService) Start(config *common.ServiceConfig) error
- func (service *HTTPRestService) Stop()
- func (service *HTTPRestService) SyncHostNCVersion(ctx context.Context, channelMode string, ...)
- func (service *HTTPRestService) SyncNodeStatus(dncEP, infraVnet, nodeID string, contextFromCNI json.RawMessage) (returnCode int, errStr string)
Constants ¶
const ( Success = 0 UnsupportedNetworkType = 1 InvalidParameter = 2 UnsupportedEnvironment = 3 UnreachableHost = 4 ReservationNotFound = 5 MalformedSubnet = 8 UnreachableDockerDaemon = 9 UnspecifiedNetworkName = 10 NotFound = 14 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 NmAgentSupportedApisError = 37 UnsupportedNCVersion = 38 UnexpectedError = 99 )
Container Network Service remote API Contract.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPRestService ¶
func NewHTTPRestService(config *common.ServiceConfig, imdsClientInterface imdsclient.ImdsClientInterface, nmagentClient nmagentclient.NMAgentClientInterface) (cns.HTTPService, error)
NewHTTPRestService creates a new HTTP Service object.
func ReturnCodeToString ¶ added in v1.0.16
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) Init ¶
func (service *HTTPRestService) Init(config *common.ServiceConfig) error
Init starts the CNS listener.
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) MarkIPAsPendingRelease ¶
func (service *HTTPRestService) MarkIPAsPendingRelease(totalIpsToRelease int) (map[string]cns.IPConfigurationStatus, error)
MarkIPAsPendingRelease will set the IPs which are in PendingProgramming or Available to PendingRelease state It will try to update [totalIpsToRelease] number of ips.
func (*HTTPRestService) MarkIpsAsAvailableUntransacted ¶
func (service *HTTPRestService) MarkIpsAsAvailableUntransacted(ncID string, newHostNCVersion int)
MarkIpsAsAvailableUntransacted will update pending programming IPs to available if NMAgent side's programmed nc version keep up with nc version. Note: this func is an untransacted API as the caller will take a Service lock
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) SyncHostNCVersion ¶
func (service *HTTPRestService) SyncHostNCVersion(ctx context.Context, channelMode string, syncHostNCTimeoutMilliSec time.Duration)
SyncHostNCVersion will check NC version from NMAgent and save it as host NC version in container status. If NMAgent NC version got updated, CNS will refresh the pending programming IP status.
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