[Windows] Adds optional loopbackDSR argument to cni config.
Adds a bool to the cni config that will add a policy that allows for loopbackDSR on an interface. Updates relevant documentation. Allows L2Tunnel networks to be used for L2Bridge plugin.
This commit is contained in:
@ -32,7 +32,8 @@ With win-bridge plugin, all containers (on the same host) are plugged into an L2
|
||||
"NeedEncap": true
|
||||
}
|
||||
}
|
||||
].
|
||||
],
|
||||
"loopbackDSR": true,
|
||||
"capabilities": {
|
||||
"dns": true
|
||||
}
|
||||
@ -51,5 +52,6 @@ With win-bridge plugin, all containers (on the same host) are plugged into an L2
|
||||
* `ipam` (dictionary, optional): IPAM configuration to be used for this network.
|
||||
* `Policies` (list, optional): List of hns policies to be used (only used when ApiVersion is < 2).
|
||||
* `HcnPolicyArgs` (list, optional): List of hcn policies to be used (only used when ApiVersion is 2).
|
||||
* `capabilities` (dictionary, optional): runtime capabilities to enable.
|
||||
* `dns` (boolean, optional): if true will take the dns config supplied by the runtime and override other settings.
|
||||
* `loopbackDSR` (bool, optional): If true, will add a policy to allow the interface to support loopback direct server return.
|
||||
* `capabilities` (dictionary, optional): Runtime capabilities to enable.
|
||||
* `dns` (boolean, optional): If true, will take the dns config supplied by the runtime and override other settings.
|
@ -39,6 +39,7 @@
|
||||
"NeedEncap":true
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"loopbackDSR": true
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ package main
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
@ -38,7 +39,6 @@ type NetConf struct {
|
||||
hns.NetConf
|
||||
|
||||
IPMasqNetwork string `json:"ipMasqNetwork,omitempty"`
|
||||
ApiVersion int `json:"ApiVersion"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
@ -103,7 +103,7 @@ func cmdHnsAdd(args *skel.CmdArgs, n *NetConf) (*current.Result, error) {
|
||||
return nil, fmt.Errorf("network %v not found", networkName)
|
||||
}
|
||||
|
||||
if !strings.EqualFold(hnsNetwork.Type, "L2Bridge") {
|
||||
if !strings.EqualFold(hnsNetwork.Type, "L2Bridge") && !strings.EqualFold(hnsNetwork.Type, "L2Tunnel") {
|
||||
return nil, fmt.Errorf("network %v is of an unexpected type: %v", networkName, hnsNetwork.Type)
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ func cmdHcnAdd(args *skel.CmdArgs, n *NetConf) (*current.Result, error) {
|
||||
return nil, fmt.Errorf("network %v not found", networkName)
|
||||
}
|
||||
|
||||
if hcnNetwork.Type != hcn.L2Bridge {
|
||||
if hcnNetwork.Type != hcn.L2Bridge && hcnNetwork.Type != hcn.L2Tunnel {
|
||||
return nil, fmt.Errorf("network %v is of unexpected type: %v", networkName, hcnNetwork.Type)
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,11 @@ With win-overlay plugin, all containers (on the same host) are plugged into an O
|
||||
"ipam": {
|
||||
"type": "host-local",
|
||||
"subnet": "10.10.0.0/16"
|
||||
}
|
||||
},
|
||||
"loopbackDSR": true,
|
||||
"capabilites": {
|
||||
"dns": true
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
@ -33,5 +33,6 @@ With win-overlay plugin, all containers (on the same host) are plugged into an O
|
||||
* `endpointMacPrefix` (string, optional): set to the MAC prefix configured for Flannel.
|
||||
* `Policies` (list, optional): List of hns policies to be used.
|
||||
* `ipam` (dictionary, required): IPAM configuration to be used for this network.
|
||||
* `loopbackDSR` (bool, optional): If true, will add a policy to allow the interface to support loopback direct server return.
|
||||
* `capabilities` (dictionary, optional): runtime capabilities to be parsed and injected by runtime.
|
||||
* `dns` (boolean, optional): if true will take the dns config supplied by the runtime and override other settings.
|
||||
* `dns` (boolean, optional): If true, will take the dns config supplied by the runtime and override other settings.
|
@ -17,6 +17,7 @@ package main
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
@ -118,7 +119,9 @@ func cmdAdd(args *skel.CmdArgs) error {
|
||||
}
|
||||
|
||||
result.DNS = n.GetDNS()
|
||||
|
||||
if n.LoopbackDSR {
|
||||
n.ApplyLoopbackDSR(&ipAddr)
|
||||
}
|
||||
hnsEndpoint := &hcsshim.HNSEndpoint{
|
||||
Name: epName,
|
||||
VirtualNetwork: hnsNetwork.Id,
|
||||
|
Reference in New Issue
Block a user