From a4c1995587306dbc8964878246276282eedead85 Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Sun, 14 Mar 2021 19:33:07 +0000 Subject: [PATCH] Alter IP range and share kvm Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- pkg/cninetwork/cni_network.go | 4 ++-- pkg/cninetwork/cni_network_test.go | 4 ++-- pkg/provider/handlers/deploy.go | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/cninetwork/cni_network.go b/pkg/cninetwork/cni_network.go index e8e5686..71f0114 100644 --- a/pkg/cninetwork/cni_network.go +++ b/pkg/cninetwork/cni_network.go @@ -42,7 +42,7 @@ const ( defaultBridgeName = "openfaas0" // defaultSubnet is the default subnet used in the defaultCNIConf -- this value is set to not collide with common container networking subnets: - defaultSubnet = "10.62.0.0/16" + defaultSubnet = "10.63.0.0/16" // defaultIfPrefix is the interface name to be created in the container defaultIfPrefix = "eth" @@ -179,7 +179,7 @@ func GetIPAddress(container string, PID uint32) (string, error) { // // Example: // -// /var/run/cni/openfaas-cni-bridge/10.62.0.2 +// /var/run/cni/openfaas-cni-bridge/10.63.0.2 // // nats-621 // eth1 diff --git a/pkg/cninetwork/cni_network_test.go b/pkg/cninetwork/cni_network_test.go index ef19d41..e941621 100644 --- a/pkg/cninetwork/cni_network_test.go +++ b/pkg/cninetwork/cni_network_test.go @@ -10,7 +10,7 @@ import ( func Test_isCNIResultForPID_Found(t *testing.T) { body := `nats-621 eth1` - fileName := `10.62.0.2` + fileName := `10.63.0.2` container := "nats" PID := uint32(621) fullPath := filepath.Join(os.TempDir(), fileName) @@ -38,7 +38,7 @@ eth1` func Test_isCNIResultForPID_NoMatch(t *testing.T) { body := `nats-621 eth1` - fileName := `10.62.0.3` + fileName := `10.63.0.3` container := "gateway" PID := uint32(621) fullPath := filepath.Join(os.TempDir(), fileName) diff --git a/pkg/provider/handlers/deploy.go b/pkg/provider/handlers/deploy.go index aa3c0f8..f618ead 100644 --- a/pkg/provider/handlers/deploy.go +++ b/pkg/provider/handlers/deploy.go @@ -148,6 +148,7 @@ func deploy(ctx context.Context, req types.FunctionDeployment, client *container oci.WithCapabilities([]string{"CAP_NET_RAW"}), oci.WithMounts(mounts), oci.WithEnv(envs), + oci.WithLinuxDevice("/dev/kvm", "rmw"), withMemory(memory)), containerd.WithContainerLabels(labels)}