Skip to content

Commit

Permalink
New package for IPAM module
Browse files Browse the repository at this point in the history
This PR moves IPAM module and all its side components in a new package/folder created ad-hoc in order to improve the project directory/file organization.
  • Loading branch information
davidefalcone1 committed Jul 5, 2021
1 parent 037fff9 commit 1378692
Show file tree
Hide file tree
Showing 19 changed files with 95 additions and 86 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -22,5 +22,6 @@ bin
*~
*.tgz
.vscode
.devcontainer

externalcrds
6 changes: 3 additions & 3 deletions cmd/liqonet/main.go
Expand Up @@ -35,7 +35,7 @@ import (
tunneloperator "github.com/liqotech/liqo/internal/liqonet/tunnel-operator"
"github.com/liqotech/liqo/internal/liqonet/tunnelEndpointCreator"
liqoconst "github.com/liqotech/liqo/pkg/consts"
liqonetOperator "github.com/liqotech/liqo/pkg/liqonet"
liqonetIpam "github.com/liqotech/liqo/pkg/liqonet/ipam"
liqonetns "github.com/liqotech/liqo/pkg/liqonet/netns"
"github.com/liqotech/liqo/pkg/liqonet/overlay"
liqorouting "github.com/liqotech/liqo/pkg/liqonet/routing"
Expand Down Expand Up @@ -197,8 +197,8 @@ func main() {
}
case "tunnelEndpointCreator-operator":
dynClient := dynamic.NewForConfigOrDie(mgr.GetConfig())
ipam := liqonetOperator.NewIPAM()
err = ipam.Init(liqonetOperator.Pools, dynClient, liqoconst.NetworkManagerIpamPort)
ipam := liqonetIpam.NewIPAM()
err = ipam.Init(liqonetIpam.Pools, dynClient, liqoconst.NetworkManagerIpamPort)
if err != nil {
klog.Errorf("cannot init IPAM:%w", err)
}
Expand Down
1 change: 1 addition & 0 deletions go.mod
Expand Up @@ -7,6 +7,7 @@ require (
github.com/clastix/capsule v0.1.0-rc2
github.com/containernetworking/plugins v0.8.6
github.com/coreos/go-iptables v0.4.5
github.com/daixiang0/gci v0.2.9 // indirect
github.com/google/go-cmp v0.5.5
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.2.0
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Expand Up @@ -260,6 +260,8 @@ github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1S
github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s=
github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8=
github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I=
github.com/daixiang0/gci v0.2.9 h1:iwJvwQpBZmMg31w+QQ6jsyZ54KEATn6/nfARbBNW294=
github.com/daixiang0/gci v0.2.9/go.mod h1:+4dZ7TISfSmqfAGv59ePaHfNzgGtIkHAhhdKggP1JAc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -1306,6 +1308,7 @@ golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjs
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20201118003311-bd56c0adb394/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
Expand Down
Expand Up @@ -44,7 +44,7 @@ import (
netv1alpha1 "github.com/liqotech/liqo/apis/net/v1alpha1"
crdreplicator "github.com/liqotech/liqo/internal/crdReplicator"
liqoconst "github.com/liqotech/liqo/pkg/consts"
"github.com/liqotech/liqo/pkg/liqonet"
liqonetIpam "github.com/liqotech/liqo/pkg/liqonet/ipam"
"github.com/liqotech/liqo/pkg/liqonet/tunnel/wireguard"
liqonetutils "github.com/liqotech/liqo/pkg/liqonet/utils"
"github.com/liqotech/liqo/pkg/utils"
Expand Down Expand Up @@ -95,7 +95,7 @@ type TunnelEndpointCreator struct {
ExternalCIDR string
ReservedSubnets []string
AdditionalPools []string
IPManager liqonet.Ipam
IPManager liqonetIpam.Ipam
Mutex sync.Mutex
WaitConfig *sync.WaitGroup
IpamConfigured bool
Expand Down
2 changes: 0 additions & 2 deletions pkg/liqonet/doc.go

This file was deleted.

6 changes: 6 additions & 0 deletions pkg/liqonet/ipam/doc.go
@@ -0,0 +1,6 @@
// Package ipam contains the IPAM module. It is in charge of:
// 1. Keep track of used networks/IP addresses
// 2. Assign networks (ex. remap a remote cluster network to a new network)
// 3. Assign IP addresses (ex. to service endpoints)
// 4. Notify GW about endpoint IP remapping
package ipam
2 changes: 1 addition & 1 deletion pkg/liqonet/ipam.go → pkg/liqonet/ipam/ipam.go
@@ -1,4 +1,4 @@
package liqonet
package ipam

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/liqonet/ipam.pb.go → pkg/liqonet/ipam/ipam.pb.go

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

2 changes: 1 addition & 1 deletion pkg/liqonet/ipam.proto → pkg/liqonet/ipam/ipam.proto
@@ -1,5 +1,5 @@
syntax="proto3";
option go_package = "./liqonet";
option go_package = "./ipam";

service ipam {
rpc MapEndpointIP (MapRequest) returns (MapResponse);
Expand Down
@@ -1,4 +1,4 @@
package liqonet
package ipam

import (
"bytes"
Expand Down

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

0 comments on commit 1378692

Please sign in to comment.