ipam/host-local: Move allocator and config to backend
Signed-off-by: André Martins <aanm90@gmail.com>
This commit is contained in:
parent
98ff61aac3
commit
f60111b093
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
package allocator
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main_test
|
||||
package allocator_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
@ -21,7 +21,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHostLocal(t *testing.T) {
|
||||
func TestAllocator(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "HostLocal Suite")
|
||||
RunSpecs(t, "Allocator Suite")
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
package allocator
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
package allocator
|
||||
|
||||
import (
|
||||
"encoding/json"
|
@ -15,6 +15,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/containernetworking/cni/plugins/ipam/host-local/backend/allocator"
|
||||
"github.com/containernetworking/cni/plugins/ipam/host-local/backend/disk"
|
||||
|
||||
"github.com/containernetworking/cni/pkg/skel"
|
||||
@ -27,7 +28,7 @@ func main() {
|
||||
}
|
||||
|
||||
func cmdAdd(args *skel.CmdArgs) error {
|
||||
ipamConf, err := LoadIPAMConfig(args.StdinData, args.Args)
|
||||
ipamConf, err := allocator.LoadIPAMConfig(args.StdinData, args.Args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -38,7 +39,7 @@ func cmdAdd(args *skel.CmdArgs) error {
|
||||
}
|
||||
defer store.Close()
|
||||
|
||||
allocator, err := NewIPAllocator(ipamConf, store)
|
||||
allocator, err := allocator.NewIPAllocator(ipamConf, store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -55,7 +56,7 @@ func cmdAdd(args *skel.CmdArgs) error {
|
||||
}
|
||||
|
||||
func cmdDel(args *skel.CmdArgs) error {
|
||||
ipamConf, err := LoadIPAMConfig(args.StdinData, args.Args)
|
||||
ipamConf, err := allocator.LoadIPAMConfig(args.StdinData, args.Args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -66,10 +67,10 @@ func cmdDel(args *skel.CmdArgs) error {
|
||||
}
|
||||
defer store.Close()
|
||||
|
||||
allocator, err := NewIPAllocator(ipamConf, store)
|
||||
ipAllocator, err := allocator.NewIPAllocator(ipamConf, store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return allocator.Release(args.ContainerID)
|
||||
return ipAllocator.Release(args.ContainerID)
|
||||
}
|
||||
|
2
test
2
test
@ -11,7 +11,7 @@ set -e
|
||||
|
||||
source ./build
|
||||
|
||||
TESTABLE="libcni plugins/ipam/dhcp plugins/ipam/host-local plugins/main/loopback pkg/invoke pkg/ns pkg/skel pkg/types pkg/utils plugins/main/ipvlan plugins/main/macvlan plugins/main/bridge plugins/main/ptp plugins/test/noop pkg/utils/hwaddr pkg/ip pkg/version pkg/version/testhelpers plugins/meta/flannel"
|
||||
TESTABLE="libcni plugins/ipam/dhcp plugins/ipam/dhcp plugins/ipam/host-local/backend/allocator plugins/ipam/host-local/backend plugins/main/loopback pkg/invoke pkg/ns pkg/skel pkg/types pkg/utils plugins/main/ipvlan plugins/main/macvlan plugins/main/bridge plugins/main/ptp plugins/test/noop pkg/utils/hwaddr pkg/ip pkg/version pkg/version/testhelpers plugins/meta/flannel"
|
||||
FORMATTABLE="$TESTABLE pkg/testutils plugins/meta/flannel plugins/meta/tuning"
|
||||
|
||||
# user has not provided PKG override
|
||||
|
Loading…
x
Reference in New Issue
Block a user