hns

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: Apache-2.0 Imports: 11 Imported by: 9

Documentation

Rendered for windows/amd64

Index

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)

func ConstructEndpointName

func ConstructEndpointName(containerID string, netNs string, networkName string) string

ConstructEndpointName constructs enpointId which is used to identify an endpoint from HNS There is a special consideration for netNs name here, which is required for Windows Server 1709 containerID is the Id of the container on which the endpoint is worked on

func ConstructHcnResult

func ConstructHcnResult(hcnNetwork *hcn.HostComputeNetwork, hcnEndpoint *hcn.HostComputeEndpoint) (*current.Result, error)

func ConstructResult

func ConstructResult(hnsNetwork *hcsshim.HNSNetwork, hnsEndpoint *hcsshim.HNSEndpoint) (*current.Result, error)

ConstructResult constructs the CNI result for the endpoint

func DeprovisionEndpoint

func DeprovisionEndpoint(epName string, netns string, containerID string) error

DeprovisionEndpoint removes an endpoint from the container by sending a Detach request to HNS For shared endpoint, ContainerDetach is used for removing the endpoint completely, HotDetachEndpoint is used

func GenerateHcnEndpoint

func GenerateHcnEndpoint(epInfo *EndpointInfo, n *NetConf) (*hcn.HostComputeEndpoint, error)

func GenerateHnsEndpoint

func GenerateHnsEndpoint(epInfo *EndpointInfo, n *NetConf) (*hcsshim.HNSEndpoint, error)

func GetIpString

func GetIpString(ip *net.IP) string

short function so we know when to return "" for a string

func GetSandboxContainerID

func GetSandboxContainerID(containerID string, netNs string) string

GetSandboxContainerID returns the sandbox ID of this pod

func ProvisionEndpoint

func ProvisionEndpoint(epName string, expectedNetworkId string, containerID string, netns string, makeEndpoint EndpointMakerFunc) (*hcsshim.HNSEndpoint, error)

ProvisionEndpoint provisions an endpoint to a container specified by containerID. If an endpoint already exists, the endpoint is reused. This call is idempotent

func RemoveHcnEndpoint

func RemoveHcnEndpoint(epName string) error

This version follows the v2 workflow of removing the endpoint from the namespace and deleting it

Types

type EndpointInfo

type EndpointInfo struct {
	EndpointName string
	DNS          types.DNS
	NetworkName  string
	NetworkId    string
	Gateway      net.IP
	IpAddress    net.IP
}

type EndpointMakerFunc

type EndpointMakerFunc func() (*hcsshim.HNSEndpoint, error)

type HcnEndpointMakerFunc

type HcnEndpointMakerFunc func() (*hcn.HostComputeEndpoint, error)

type NetConf

type NetConf struct {
	types.NetConf
	HcnPolicyArgs []hcn.EndpointPolicy `json:"HcnPolicyArgs,omitempty"`
	Policies      []policy             `json:"policies,omitempty"`
	RuntimeConfig RuntimeConfig        `json:"runtimeConfig"`
}

NetConf is the CNI spec

func (*NetConf) ApplyDefaultPAPolicy

func (n *NetConf) ApplyDefaultPAPolicy(paAddress string)

ApplyDefaultPAPolicy is used to configure a endpoint PA policy in HNS

func (*NetConf) ApplyOutboundNatPolicy

func (n *NetConf) ApplyOutboundNatPolicy(nwToNat string)

ApplyOutboundNatPolicy applies NAT Policy in VFP using HNS Simultaneously an exception is added for the network that has to be Nat'd

func (*NetConf) GetDNS

func (n *NetConf) GetDNS() types.DNS

If runtime dns values are there use that else use cni conf supplied dns

func (*NetConf) MarshalPolicies

func (n *NetConf) MarshalPolicies() []json.RawMessage

MarshalPolicies converts the Endpoint policies in Policies to HNS specific policies as Json raw bytes

type RuntimeConfig

type RuntimeConfig struct {
	DNS RuntimeDNS `json:"dns"`
}

type RuntimeDNS

type RuntimeDNS struct {
	Nameservers []string `json:"servers,omitempty"`
	Search      []string `json:"searches,omitempty"`
}

Jump to

Keyboard shortcuts

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