Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable host to local pod connectivity in Windows VXLAN #1096

Merged
merged 2 commits into from
Feb 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 25 additions & 1 deletion backend/vxlan/device_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"encoding/json"
"fmt"
"github.com/Microsoft/hcsshim"
"github.com/Microsoft/hcsshim/hcn"
"github.com/buger/jsonparser"
"github.com/coreos/flannel/pkg/ip"
log "github.com/golang/glog"
Expand Down Expand Up @@ -129,7 +130,30 @@ func ensureNetwork(expectedNetwork *hcsshim.HNSNetwork, expectedVSID int64, expe
}

log.Infof("Created HNSNetwork %s", networkName)
return newNetwork, nil
existingNetwork = newNetwork
}

existingNetworkV2, err := hcn.GetNetworkByID(existingNetwork.Id)
if err != nil {
return nil, errors.Annotatef(err, "Could not find vxlan0 in V2")
}

addHostRoute := true
for _, policy := range existingNetworkV2.Policies {
if policy.Type == hcn.HostRoute {
addHostRoute = false
}
}
if addHostRoute {
hostRoutePolicy := hcn.NetworkPolicy{
Type: hcn.HostRoute,
Settings: []byte("{}"),
}

networkRequest := hcn.PolicyNetworkRequest{
Policies: []hcn.NetworkPolicy{hostRoutePolicy},
}
existingNetworkV2.AddPolicy(networkRequest)
}

return existingNetwork, nil
Expand Down
5 changes: 5 additions & 0 deletions backend/vxlan/vxlan_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ func (be *VXLANBackend) RegisterNetwork(ctx context.Context, wg sync.WaitGroup,
return nil, fmt.Errorf("Cannot get HNS networks [%+v]", err)
}

err = hcn.RemoteSubnetSupported()
if err != nil {
return nil, err
}

var remoteDrMac string
var providerAddress string
for _, hnsNetwork := range hnsNetworks {
Expand Down
2 changes: 1 addition & 1 deletion glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import:
- package: github.com/bronze1man/goStrongswanVici
version: 4d72634a2f113aa48347dbc7dcb14adb806b6534
- package: github.com/Microsoft/hcsshim
version: v0.8.3
- package: github.com/Microsoft/go-winio
version: v0.4.11
- pacakge: github.com/sirupsen/logrus
Expand Down
17 changes: 9 additions & 8 deletions vendor/github.com/Microsoft/hcsshim/appveyor.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions vendor/github.com/Microsoft/hcsshim/cmd/go-runhcs/NOTICE

This file was deleted.

125 changes: 0 additions & 125 deletions vendor/github.com/Microsoft/hcsshim/cmd/go-runhcs/runhcs.go

This file was deleted.

This file was deleted.

This file was deleted.

Loading