refactor(win-bridge): netconf
- support v2 api - unify v1 and v2 api BREAKING CHANGE: - remove `HcnPolicyArgs` field - merge `HcnPolicyArgs` into `Policies` field Signed-off-by: thxcode <thxcode0824@gmail.com>
This commit is contained in:
52
plugins/main/windows/win-bridge/sample-v2.conf
Normal file
52
plugins/main/windows/win-bridge/sample-v2.conf
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"name":"cbr0",
|
||||
"type":"flannel",
|
||||
"delegate":{
|
||||
"apiVersion":2,
|
||||
"type":"win-bridge",
|
||||
"dns":{
|
||||
"nameservers":[
|
||||
"11.0.0.10"
|
||||
],
|
||||
"search":[
|
||||
"svc.cluster.local"
|
||||
]
|
||||
},
|
||||
"policies":[
|
||||
{
|
||||
"name":"EndpointPolicy",
|
||||
"value":{
|
||||
"Type":"OutBoundNAT",
|
||||
"Settings":{
|
||||
"Exceptions":[
|
||||
"192.168.0.0/16",
|
||||
"11.0.0.0/8",
|
||||
"10.137.196.0/23"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name":"EndpointPolicy",
|
||||
"value":{
|
||||
"Type":"SDNRoute",
|
||||
"Settings":{
|
||||
"DestinationPrefix":"11.0.0.0/8",
|
||||
"NeedEncap":true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name":"EndpointPolicy",
|
||||
"value":{
|
||||
"Type":"SDNRoute",
|
||||
"Settings":{
|
||||
"DestinationPrefix":"10.137.198.27/32",
|
||||
"NeedEncap":true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"loopbackDSR":true
|
||||
}
|
||||
}
|
@ -84,9 +84,7 @@ func processEndpointArgs(args *skel.CmdArgs, n *NetConf) (*hns.EndpointInfo, err
|
||||
}
|
||||
|
||||
// configure sNAT exception
|
||||
if len(n.IPMasqNetwork) != 0 {
|
||||
n.ApplyOutboundNatPolicy(n.IPMasqNetwork)
|
||||
}
|
||||
n.ApplyOutboundNatPolicy(n.IPMasqNetwork)
|
||||
|
||||
// add port mapping if any present
|
||||
n.ApplyPortMappingPolicy(n.RuntimeConfig.PortMaps)
|
||||
|
@ -119,7 +119,7 @@ func cmdAdd(args *skel.CmdArgs) error {
|
||||
|
||||
result.DNS = n.GetDNS()
|
||||
if n.LoopbackDSR {
|
||||
n.ApplyLoopbackDSR(&ipAddr)
|
||||
n.ApplyLoopbackDSRPolicy(&ipAddr)
|
||||
}
|
||||
hnsEndpoint := &hcsshim.HNSEndpoint{
|
||||
Name: epName,
|
||||
@ -129,7 +129,7 @@ func cmdAdd(args *skel.CmdArgs) error {
|
||||
GatewayAddress: gw,
|
||||
IPAddress: ipAddr,
|
||||
MacAddress: macAddr,
|
||||
Policies: n.MarshalPolicies(),
|
||||
Policies: n.GetHNSEndpointPolicies(),
|
||||
}
|
||||
|
||||
return hnsEndpoint, nil
|
||||
|
Reference in New Issue
Block a user