Alter IP range and share kvm

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd) 2021-03-14 19:33:07 +00:00
parent 5a7a5b2d6d
commit a4c1995587
3 changed files with 5 additions and 4 deletions

View File

@ -42,7 +42,7 @@ const (
defaultBridgeName = "openfaas0" defaultBridgeName = "openfaas0"
// defaultSubnet is the default subnet used in the defaultCNIConf -- this value is set to not collide with common container networking subnets: // 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 is the interface name to be created in the container
defaultIfPrefix = "eth" defaultIfPrefix = "eth"
@ -179,7 +179,7 @@ func GetIPAddress(container string, PID uint32) (string, error) {
// //
// Example: // Example:
// //
// /var/run/cni/openfaas-cni-bridge/10.62.0.2 // /var/run/cni/openfaas-cni-bridge/10.63.0.2
// //
// nats-621 // nats-621
// eth1 // eth1

View File

@ -10,7 +10,7 @@ import (
func Test_isCNIResultForPID_Found(t *testing.T) { func Test_isCNIResultForPID_Found(t *testing.T) {
body := `nats-621 body := `nats-621
eth1` eth1`
fileName := `10.62.0.2` fileName := `10.63.0.2`
container := "nats" container := "nats"
PID := uint32(621) PID := uint32(621)
fullPath := filepath.Join(os.TempDir(), fileName) fullPath := filepath.Join(os.TempDir(), fileName)
@ -38,7 +38,7 @@ eth1`
func Test_isCNIResultForPID_NoMatch(t *testing.T) { func Test_isCNIResultForPID_NoMatch(t *testing.T) {
body := `nats-621 body := `nats-621
eth1` eth1`
fileName := `10.62.0.3` fileName := `10.63.0.3`
container := "gateway" container := "gateway"
PID := uint32(621) PID := uint32(621)
fullPath := filepath.Join(os.TempDir(), fileName) fullPath := filepath.Join(os.TempDir(), fileName)

View File

@ -148,6 +148,7 @@ func deploy(ctx context.Context, req types.FunctionDeployment, client *container
oci.WithCapabilities([]string{"CAP_NET_RAW"}), oci.WithCapabilities([]string{"CAP_NET_RAW"}),
oci.WithMounts(mounts), oci.WithMounts(mounts),
oci.WithEnv(envs), oci.WithEnv(envs),
oci.WithLinuxDevice("/dev/kvm", "rmw"),
withMemory(memory)), withMemory(memory)),
containerd.WithContainerLabels(labels)} containerd.WithContainerLabels(labels)}