Documentation
¶
Index ¶
- Constants
- func IsNotFound(err error) bool
- func IsUnsupportedAPI(err error) bool
- type CNSClientError
- type Client
- func (c *Client) CreateHostNCApipaEndpoint(ctx context.Context, networkContainerID string) (string, error)
- func (c *Client) CreateNetworkContainer(ctx context.Context, cncr cns.CreateNetworkContainerRequest) error
- func (c *Client) DeleteHostNCApipaEndpoint(ctx context.Context, networkContainerID string) error
- func (c *Client) DeleteNetworkContainer(ctx context.Context, ncID string) error
- func (c *Client) GetAllNCsFromCns(ctx context.Context) (cns.GetAllNetworkContainersResponse, error)
- func (c *Client) GetAllNetworkContainers(ctx context.Context, orchestratorContext []byte) ([]cns.GetNetworkContainerResponse, error)
- func (c *Client) GetEndpoint(ctx context.Context, endpointID string) (*restserver.GetEndpointResponse, error)
- func (c *Client) GetHTTPServiceData(ctx context.Context) (*restserver.GetHTTPServiceDataResponse, error)
- func (c *Client) GetHomeAz(ctx context.Context) (*cns.GetHomeAzResponse, error)
- func (c *Client) GetIPAddressesMatchingStates(ctx context.Context, stateFilter ...types.IPState) ([]cns.IPConfigurationStatus, error)
- func (c *Client) GetNetworkContainer(ctx context.Context, orchestratorContext []byte) (*cns.GetNetworkContainerResponse, error)
- func (c *Client) GetPodOrchestratorContext(ctx context.Context) (map[string][]string, error)
- func (c *Client) NMAgentSupportedAPIs(ctx context.Context) (*cns.NmAgentSupportedApisResponse, error)
- func (c *Client) NumOfCPUCores(ctx context.Context) (*cns.NumOfCPUCoresResponse, error)
- func (c *Client) PostAllNetworkContainers(ctx context.Context, createNcRequest cns.PostNetworkContainersRequest) error
- func (c *Client) PublishNetworkContainer(ctx context.Context, pncr cns.PublishNetworkContainerRequest) error
- func (c *Client) ReleaseIPAddress(ctx context.Context, ipconfig cns.IPConfigRequest) error
- func (c *Client) ReleaseIPs(ctx context.Context, ipconfig cns.IPConfigsRequest) error
- func (c *Client) RequestIPAddress(ctx context.Context, ipconfig cns.IPConfigRequest) (*cns.IPConfigResponse, error)
- func (c *Client) RequestIPs(ctx context.Context, ipconfig cns.IPConfigsRequest) (*cns.IPConfigsResponse, error)
- func (c *Client) SetOrchestratorType(ctx context.Context, sotr cns.SetOrchestratorTypeRequest) error
- func (c *Client) UnpublishNC(ctx context.Context, uncr cns.UnpublishNetworkContainerRequest) error
- func (c *Client) UpdateEndpoint(ctx context.Context, endpointID string, ipInfo map[string]*restserver.IPInfo) (*cns.Response, error)
- type ConnectionFailureErr
- type FailedHTTPRequest
Constants ¶
const ( // DefaultTimeout default timeout duration for CNS Client. DefaultTimeout = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
IsNotFound tests if the provided error is of type CNSClientError and then further tests if the error code is of type UnknowContainerID
func IsUnsupportedAPI ¶
IsUnsupportedAPI tests if the provided error is of type CNSClientError and then further tests if the error code is of type UnsupportedAPI
Types ¶
type CNSClientError ¶
type CNSClientError struct { Code types.ResponseCode Err error }
CNSClientError records an error and relevant code
func (*CNSClientError) Error ¶
func (e *CNSClientError) Error() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client specifies a client to connect to Ipam Plugin.
func (*Client) CreateHostNCApipaEndpoint ¶
func (c *Client) CreateHostNCApipaEndpoint(ctx context.Context, networkContainerID string) (string, error)
CreateHostNCApipaEndpoint creates an endpoint in APIPA network for host container connectivity.
func (*Client) CreateNetworkContainer ¶
func (c *Client) CreateNetworkContainer(ctx context.Context, cncr cns.CreateNetworkContainerRequest) error
CreateNetworkContainer will create the provided network container, or update an existing one if one already exists.
func (*Client) DeleteHostNCApipaEndpoint ¶
DeleteHostNCApipaEndpoint deletes the endpoint in APIPA network created for host container connectivity.
func (*Client) DeleteNetworkContainer ¶
DeleteNetworkContainer destroys the requested network container matching the provided ID.
func (*Client) GetAllNCsFromCns ¶
func (*Client) GetAllNetworkContainers ¶
func (c *Client) GetAllNetworkContainers(ctx context.Context, orchestratorContext []byte) ([]cns.GetNetworkContainerResponse, error)
GetAllNetworkContainers Request to get network container configs.
func (*Client) GetEndpoint ¶ added in v1.5.17
func (c *Client) GetEndpoint(ctx context.Context, endpointID string) (*restserver.GetEndpointResponse, error)
GetEndpoint calls the EndpointHandlerAPI in CNS to retrieve the state of a given EndpointID
func (*Client) GetHTTPServiceData ¶
func (c *Client) GetHTTPServiceData(ctx context.Context) (*restserver.GetHTTPServiceDataResponse, error)
GetHTTPServiceData gets all public in-memory struct details for debugging purpose
func (*Client) GetIPAddressesMatchingStates ¶
func (c *Client) GetIPAddressesMatchingStates(ctx context.Context, stateFilter ...types.IPState) ([]cns.IPConfigurationStatus, error)
GetIPAddressesMatchingStates takes a variadic number of string parameters, to get all IP Addresses matching a number of states usage GetIPAddressesWithStates(ctx, types.Available...)
func (*Client) GetNetworkContainer ¶
func (c *Client) GetNetworkContainer(ctx context.Context, orchestratorContext []byte) (*cns.GetNetworkContainerResponse, error)
GetNetworkContainer Request to get network container config.
func (*Client) GetPodOrchestratorContext ¶
GetPodOrchestratorContext calls GetPodIpOrchestratorContext API on CNS
func (*Client) NMAgentSupportedAPIs ¶
func (c *Client) NMAgentSupportedAPIs(ctx context.Context) (*cns.NmAgentSupportedApisResponse, error)
NMAgentSupportedAPIs returns the supported API names from NMAgent. This can be used, for example, to detect whether the node is capable for GRE allocations.
func (*Client) NumOfCPUCores ¶
NumOfCPUCores returns the number of CPU cores available on the host that CNS is running on.
func (*Client) PostAllNetworkContainers ¶
func (*Client) PublishNetworkContainer ¶
func (c *Client) PublishNetworkContainer(ctx context.Context, pncr cns.PublishNetworkContainerRequest) error
PublishNetworkContainer publishes the provided network container via the NMAgent resident on the node where CNS is running. This effectively proxies the publication through CNS which can be useful for avoiding throttling issues from Wireserver.
func (*Client) ReleaseIPAddress ¶
ReleaseIPAddress calls releaseIPAddress on CNS, ipaddress ex: (10.0.0.1)
func (*Client) ReleaseIPs ¶
ReleaseIPs calls releaseIPs on which releases the IPs on the pod
func (*Client) RequestIPAddress ¶
func (c *Client) RequestIPAddress(ctx context.Context, ipconfig cns.IPConfigRequest) (*cns.IPConfigResponse, error)
RequestIPAddress calls the requestIPAddress in CNS
func (*Client) RequestIPs ¶
func (c *Client) RequestIPs(ctx context.Context, ipconfig cns.IPConfigsRequest) (*cns.IPConfigsResponse, error)
RequestIPs calls the RequestIPConfigs in CNS
func (*Client) SetOrchestratorType ¶
func (c *Client) SetOrchestratorType(ctx context.Context, sotr cns.SetOrchestratorTypeRequest) error
SetOrchestratorType sets the orchestrator type for a given node
func (*Client) UnpublishNC ¶
UnpublishNC unpublishes the network container via the NMAgent running alongside the CNS service. This is useful to avoid throttling issues imposed by Wireserver.
func (*Client) UpdateEndpoint ¶ added in v1.5.17
func (c *Client) UpdateEndpoint(ctx context.Context, endpointID string, ipInfo map[string]*restserver.IPInfo) (*cns.Response, error)
UpdateEndpoint calls the EndpointHandlerAPI in CNS to update the state of a given EndpointID with either HNSEndpointID or HostVethName
type ConnectionFailureErr ¶
type ConnectionFailureErr struct {
// contains filtered or unexported fields
}
func (*ConnectionFailureErr) Error ¶
func (e *ConnectionFailureErr) Error() string
type FailedHTTPRequest ¶
type FailedHTTPRequest struct {
Code int
}
FailedHTTPRequest describes an HTTP request to CNS that has returned a non-200 status code.
func (*FailedHTTPRequest) Error ¶
func (f *FailedHTTPRequest) Error() string