Documentation ¶
Index ¶
- Constants
- func NewHTTPRestService(config *common.ServiceConfig, ...) (cns.HTTPService, error)
- func ReturnCodeToString(returnCode int) (s string)
- type GetHTTPServiceDataResponse
- type HTTPRestService
- func (service *HTTPRestService) AllocateAnyAvailableIPConfig(podInfo cns.PodInfo) (cns.PodIpInfo, error)
- func (service *HTTPRestService) AllocateDesiredIPConfig(podInfo cns.PodInfo, desiredIpAddress string) (cns.PodIpInfo, error)
- func (service *HTTPRestService) CreateOrUpdateNetworkContainerInternal(req cns.CreateNetworkContainerRequest) int
- func (service *HTTPRestService) DeleteNetworkContainerInternal(req cns.DeleteNetworkContainerRequest) int
- func (service *HTTPRestService) GetAllocatedIPConfigs() []cns.IPConfigurationStatus
- func (service *HTTPRestService) GetAvailableIPConfigs() []cns.IPConfigurationStatus
- func (service *HTTPRestService) GetExistingIPConfig(podInfo cns.PodInfo) (cns.PodIpInfo, bool, error)
- func (service *HTTPRestService) GetHTTPRestDataHandler(w http.ResponseWriter, r *http.Request)
- func (service *HTTPRestService) GetHTTPStruct() HttpRestServiceData
- func (service *HTTPRestService) GetNetworkContainerInternal(req cns.GetNetworkContainerRequest) (cns.GetNetworkContainerResponse, int)
- 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) GetPodIPIDByOrchestratorContext() map[string]string
- 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(ctx context.Context, ncSnapshotIntervalInMinutes int)
- 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)
- func (service *HTTPRestService) UpdateIPAMPoolMonitorInternal(scalar nnc.Scaler, spec nnc.NodeNetworkConfigSpec) int
- type HttpRestServiceData
- type Response
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 GetHTTPServiceDataResponse ¶
type GetHTTPServiceDataResponse struct { HttpRestServiceData HttpRestServiceData Response Response }
type HTTPRestService ¶
type HTTPRestService struct { *cns.Service PodIPIDByPodInterfaceKey map[string]string // PodInterfaceId is key and value is Pod IP (SecondaryIP) uuid. PodIPConfigState map[string]cns.IPConfigurationStatus // Secondary IP ID(uuid) is key 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 (*HTTPRestService) AllocateDesiredIPConfig ¶ added in v1.1.5
func (*HTTPRestService) CreateOrUpdateNetworkContainerInternal ¶
func (service *HTTPRestService) CreateOrUpdateNetworkContainerInternal(req cns.CreateNetworkContainerRequest) int
This API will be called by CNS RequestController on CRD update.
func (*HTTPRestService) DeleteNetworkContainerInternal ¶
func (service *HTTPRestService) DeleteNetworkContainerInternal(req cns.DeleteNetworkContainerRequest) int
DeleteNetworkContainerInternal deletes a network container.
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 (*HTTPRestService) GetHTTPRestDataHandler ¶ added in v1.2.9
func (service *HTTPRestService) GetHTTPRestDataHandler(w http.ResponseWriter, r *http.Request)
func (*HTTPRestService) GetHTTPStruct ¶ added in v1.2.9
func (service *HTTPRestService) GetHTTPStruct() HttpRestServiceData
func (*HTTPRestService) GetNetworkContainerInternal ¶
func (service *HTTPRestService) GetNetworkContainerInternal(req cns.GetNetworkContainerRequest) (cns.GetNetworkContainerResponse, int)
GetNetworkContainerInternal gets network container details.
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) GetPodIPIDByOrchestratorContext ¶ added in v1.2.9
func (service *HTTPRestService) GetPodIPIDByOrchestratorContext() map[string]string
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.PodInfo, 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(ctx context.Context, ncSnapshotIntervalInMinutes int)
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
func (*HTTPRestService) UpdateIPAMPoolMonitorInternal ¶ added in v1.4.1
func (service *HTTPRestService) UpdateIPAMPoolMonitorInternal(scalar nnc.Scaler, spec nnc.NodeNetworkConfigSpec) int
type HttpRestServiceData ¶ added in v1.2.9
type HttpRestServiceData struct { PodIPIDByPodInterfaceKey map[string]string // PodInterfaceId is key and value is Pod IP uuid. PodIPConfigState map[string]cns.IPConfigurationStatus // secondaryipid(uuid) is key IPAMPoolMonitor cns.IpamPoolMonitorStateSnapshot }
struct to return in-memory httprest data in debug api