mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-18 20:16:36 +00:00
Compare commits
2 Commits
0.15.0-rc1
...
override-r
Author | SHA1 | Date | |
---|---|---|---|
a4c1995587 | |||
5a7a5b2d6d |
@ -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
|
||||||
|
@ -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)
|
||||||
|
@ -140,10 +140,7 @@ func deploy(ctx context.Context, req types.FunctionDeployment, client *container
|
|||||||
memory.Limit = &v
|
memory.Limit = &v
|
||||||
}
|
}
|
||||||
|
|
||||||
container, err := client.NewContainer(
|
ctrOps := []containerd.NewContainerOpts{containerd.WithImage(image),
|
||||||
ctx,
|
|
||||||
name,
|
|
||||||
containerd.WithImage(image),
|
|
||||||
containerd.WithSnapshotter(snapshotter),
|
containerd.WithSnapshotter(snapshotter),
|
||||||
containerd.WithNewSnapshot(name+"-snapshot", image),
|
containerd.WithNewSnapshot(name+"-snapshot", image),
|
||||||
containerd.WithNewSpec(oci.WithImageConfig(image),
|
containerd.WithNewSpec(oci.WithImageConfig(image),
|
||||||
@ -151,8 +148,18 @@ 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)}
|
||||||
|
|
||||||
|
if v, ok := os.LookupEnv("FUNCTION_RUNTIME"); ok && len(v) > 0 {
|
||||||
|
ctrOps = append(ctrOps, containerd.WithRuntime(v, nil))
|
||||||
|
}
|
||||||
|
|
||||||
|
container, err := client.NewContainer(
|
||||||
|
ctx,
|
||||||
|
name,
|
||||||
|
ctrOps...,
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user