Skip to content

Commit

Permalink
deploy stitched link instead of using ep.Deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Sep 30, 2024
1 parent fb3cf1b commit 9e140a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 4 additions & 5 deletions cmd/vxlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,10 @@ var vxlanCreateCmd = &cobra.Command{
return fmt.Errorf("not a VxlanStitched link")
}

for _, ep := range vxl.GetEndpoints() {
err := ep.Deploy(ctx)
if err != nil {
return err
}
// deploy the vxlan with existing link. The first endpoint is the host endpoint
err = vxl.DeployWithExistingVeth(ctx, vxl.GetEndpoints()[0])
if err != nil {
return err
}

return nil
Expand Down
7 changes: 5 additions & 2 deletions links/link_vxlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ func (lr *LinkVxlanRaw) resolveStitchedVxlan(params *ResolveParams) (Link, error
var stitchEp Endpoint

// if the endpoint is host, we don't need to create the veth link
// the stitch endpoint becomes the vxlan link local endpoint
// the stitch endpoint is just a host endpoint with the passed interface name
if lr.Endpoint.Node == "host" {
vethLink, stitchEp, err = nil, vxlanLink.localEndpoint, nil
// a fake endpoint used only to print the host interface name in the outputs
// it is not deployed as it meant to exist
epHost := NewEndpointHost(NewEndpointGeneric(vxlanLink.localEndpoint.GetNode(), params.VxlanIfaceNameOverwrite, nil))
vethLink, stitchEp, err = nil, epHost, nil
} else {
// otherwise we need to create the veth link
vethLink, stitchEp, err = lr.resolveStitchedVEthComponent(params)
Expand Down

0 comments on commit 9e140a4

Please sign in to comment.