Documentation ¶
Index ¶
- func AddHcnEndpoint(epName string, expectedNetworkId string, namespace string, ...) (*hcn.HostComputeEndpoint, error)
- func AddHnsEndpoint(epName string, expectedNetworkId string, containerID string, netns string, ...) (*hcsshim.HNSEndpoint, error)
- func ConstructEndpointName(containerID string, netNs string, networkName string) string
- func ConstructHcnResult(hcnNetwork *hcn.HostComputeNetwork, hcnEndpoint *hcn.HostComputeEndpoint) (*current.Result, error)
- func ConstructHnsResult(hnsNetwork *hcsshim.HNSNetwork, hnsEndpoint *hcsshim.HNSEndpoint) (*current.Result, error)
- func GenerateHcnEndpoint(epInfo *EndpointInfo, n *NetConf) (*hcn.HostComputeEndpoint, error)
- func GenerateHnsEndpoint(epInfo *EndpointInfo, n *NetConf) (*hcsshim.HNSEndpoint, error)
- func GetDefaultDestinationPrefix(ip *net.IP) string
- func GetIpString(ip *net.IP) string
- func GetSandboxContainerID(containerID string, netNs string) string
- func RemoveHcnEndpoint(epName string) error
- func RemoveHnsEndpoint(epName string, netns string, containerID string) error
- type EndpointInfo
- type HcnEndpointMakerFunc
- type HnsEndpointMakerFunc
- type NetConf
- func (n *NetConf) ApplyDefaultPAPolicy(address string)
- func (n *NetConf) ApplyLoopbackDSRPolicy(ip *net.IP)
- func (n *NetConf) ApplyOutboundNatPolicy(exceptionCIDR string)
- func (n *NetConf) ApplyPortMappingPolicy(portMappings []PortMapEntry)
- func (n *NetConf) GetDNS() types.DNS
- func (n *NetConf) GetHNSEndpointPolicies() []json.RawMessage
- func (n *NetConf) GetHostComputeEndpointPolicies() []hcn.EndpointPolicy
- type Policy
- type PortMapEntry
- type RuntimeConfig
- type RuntimeDNS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHcnEndpoint ¶
func AddHcnEndpoint(epName string, expectedNetworkId string, namespace string, makeEndpoint HcnEndpointMakerFunc) (*hcn.HostComputeEndpoint, error)
AddHcnEndpoint attaches a HostComputeEndpoint to the given namespace.
func AddHnsEndpoint ¶ added in v1.0.0
func AddHnsEndpoint(epName string, expectedNetworkId string, containerID string, netns string, makeEndpoint HnsEndpointMakerFunc) (*hcsshim.HNSEndpoint, error)
AddHnsEndpoint attaches an HNSEndpoint to a container specified by containerID.
func ConstructEndpointName ¶
ConstructEndpointName constructs endpoint id which is used to identify an endpoint from HNS/HCN.
func ConstructHcnResult ¶
func ConstructHcnResult(hcnNetwork *hcn.HostComputeNetwork, hcnEndpoint *hcn.HostComputeEndpoint) (*current.Result, error)
ConstructHcnResult constructs the CNI result for the HostComputeEndpoint.
func ConstructHnsResult ¶ added in v1.0.0
func ConstructHnsResult(hnsNetwork *hcsshim.HNSNetwork, hnsEndpoint *hcsshim.HNSEndpoint) (*current.Result, error)
ConstructHnsResult constructs the CNI result for the HNSEndpoint.
func GenerateHcnEndpoint ¶
func GenerateHcnEndpoint(epInfo *EndpointInfo, n *NetConf) (*hcn.HostComputeEndpoint, error)
GenerateHcnEndpoint generates a HostComputeEndpoint with given info and config.
func GenerateHnsEndpoint ¶
func GenerateHnsEndpoint(epInfo *EndpointInfo, n *NetConf) (*hcsshim.HNSEndpoint, error)
GenerateHnsEndpoint generates an HNSEndpoint with given info and config.
func GetDefaultDestinationPrefix ¶ added in v0.8.2
GetDefaultDestinationPrefix returns the default destination prefix according to the given IP type.
func GetIpString ¶
GetIpString returns the given IP as a string.
func GetSandboxContainerID ¶
GetSandboxContainerID returns the sandbox ID of this pod.
func RemoveHcnEndpoint ¶
RemoveHcnEndpoint removes the given name endpoint from namespace.
Types ¶
type EndpointInfo ¶
type HcnEndpointMakerFunc ¶
type HcnEndpointMakerFunc func() (*hcn.HostComputeEndpoint, error)
type HnsEndpointMakerFunc ¶ added in v1.0.0
type HnsEndpointMakerFunc func() (*hcsshim.HNSEndpoint, error)
type NetConf ¶
type NetConf struct { types.NetConf // ApiVersion specifies the policies type of HNS or HCN, select one of [1, 2]. // HNS is the v1 API, which is the default version and applies to dockershim. // HCN is the v2 API, which can leverage HostComputeNamespace and use in containerd. ApiVersion int `json:"apiVersion,omitempty"` // Policies specifies the policy list for HNSEndpoint or HostComputeEndpoint. Policies []Policy `json:"policies,omitempty"` // RuntimeConfig represents the options to be passed in by the runtime. RuntimeConfig RuntimeConfig `json:"runtimeConfig"` // LoopbackDSR specifies whether to support loopback direct server return. LoopbackDSR bool `json:"loopbackDSR,omitempty"` }
NetConf is the CNI spec
func (*NetConf) ApplyDefaultPAPolicy ¶
ApplyDefaultPAPolicy applies an endpoint PA policy in HNS/HCN.
func (*NetConf) ApplyLoopbackDSRPolicy ¶ added in v1.0.0
ApplyLoopbackDSRPolicy configures the given IP to support loopback DSR.
func (*NetConf) ApplyOutboundNatPolicy ¶
ApplyOutboundNatPolicy applies the sNAT policy in HNS/HCN and configures the given CIDR as an exception.
func (*NetConf) ApplyPortMappingPolicy ¶ added in v0.8.6
func (n *NetConf) ApplyPortMappingPolicy(portMappings []PortMapEntry)
ApplyPortMappingPolicy applies the host/container port mapping policies in HNS/HCN.
func (*NetConf) GetDNS ¶
GetDNS returns the DNS values if they are there use that else use netconf supplied DNS.
func (*NetConf) GetHNSEndpointPolicies ¶ added in v1.0.0
func (n *NetConf) GetHNSEndpointPolicies() []json.RawMessage
GetHNSEndpointPolicies converts the configuration policies to HNSEndpoint policies.
func (*NetConf) GetHostComputeEndpointPolicies ¶ added in v1.0.0
func (n *NetConf) GetHostComputeEndpointPolicies() []hcn.EndpointPolicy
GetHostComputeEndpointPolicies converts the configuration policies to HostComputeEndpoint policies.
type Policy ¶ added in v1.0.0
type Policy struct { Name string `json:"name"` Value json.RawMessage `json:"value"` }
type PortMapEntry ¶ added in v0.8.6
type PortMapEntry struct { HostPort int `json:"hostPort"` ContainerPort int `json:"containerPort"` Protocol string `json:"protocol"` HostIP string `json:"hostIP,omitempty"` }
func (*PortMapEntry) GetProtocolEnum ¶ added in v1.0.0
func (p *PortMapEntry) GetProtocolEnum() (uint32, error)
type RuntimeConfig ¶
type RuntimeConfig struct { DNS RuntimeDNS `json:"dns"` PortMaps []PortMapEntry `json:"portMappings,omitempty"` }