Compare commits

..

4 Commits

Author SHA1 Message Date
0bf221b286 Add test for isCNIResultForPID
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-21 21:41:08 +00:00
e8c2eeb052 Use CNI cache to find container IP
This is an optimization that uses the results cache created by
CNI on the filesystem to store and fetch IP addresses for
containers in the core services and for functions. As part of
the change, the dependency on the syscall code from Weave net
has been removed, and the code should compile on MacOS again.

Updates and rebases the work in #38 by carlosedp

Tested in the original PR, further testing in the incoming
PR.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-21 21:41:08 +00:00
6c0f91e810 Set the hostname for containers and functions
By setting the hostname, the container will resolve to its
name instead of just localhost.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-21 20:58:04 +00:00
27ba86fb52 Update Go version for building
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-21 18:26:23 +00:00
3 changed files with 4 additions and 2 deletions

View File

@ -169,7 +169,7 @@ You may find alternative package names for CentOS and other Linux distributions.
#### Install Go 1.13 (x86_64) #### Install Go 1.13 (x86_64)
```bash ```bash
curl -sSLf https://dl.google.com/go/go1.13.6.linux-amd64.tar.gz > /tmp/go.tgz curl -SLf https://golang.org/dl/go1.16.linux-amd64.tar.gz > /tmp/go.tgz
sudo rm -rf /usr/local/go/ sudo rm -rf /usr/local/go/
sudo mkdir -p /usr/local/go/ sudo mkdir -p /usr/local/go/
sudo tar -xvf /tmp/go.tgz -C /usr/local/go/ --strip-components=1 sudo tar -xvf /tmp/go.tgz -C /usr/local/go/ --strip-components=1
@ -190,7 +190,7 @@ echo "export PATH=\$PATH:/usr/local/go/bin/" | tee -a $HOME/.bash_profile
#### Or on Raspberry Pi (armhf) #### Or on Raspberry Pi (armhf)
```bash ```bash
curl -SLsf https://dl.google.com/go/go1.13.6.linux-armv6l.tar.gz > go.tgz curl -SLsf https://golang.org/dl/go1.16.linux-armv6l.tar.gz > go.tgz
sudo rm -rf /usr/local/go/ sudo rm -rf /usr/local/go/
sudo mkdir -p /usr/local/go/ sudo mkdir -p /usr/local/go/
sudo tar -xvf go.tgz -C /usr/local/go/ --strip-components=1 sudo tar -xvf go.tgz -C /usr/local/go/ --strip-components=1

View File

@ -147,6 +147,7 @@ func deploy(ctx context.Context, req types.FunctionDeployment, client *container
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),
oci.WithHostname(name),
oci.WithCapabilities([]string{"CAP_NET_RAW"}), oci.WithCapabilities([]string{"CAP_NET_RAW"}),
oci.WithMounts(mounts), oci.WithMounts(mounts),
oci.WithEnv(envs), oci.WithEnv(envs),

View File

@ -172,6 +172,7 @@ func (s *Supervisor) Start(svcs []Service) error {
containerd.WithImage(image), containerd.WithImage(image),
containerd.WithNewSnapshot(svc.Name+"-snapshot", image), containerd.WithNewSnapshot(svc.Name+"-snapshot", image),
containerd.WithNewSpec(oci.WithImageConfig(image), containerd.WithNewSpec(oci.WithImageConfig(image),
oci.WithHostname(svc.Name),
withUserOrDefault(svc.User), withUserOrDefault(svc.User),
oci.WithCapabilities(svc.Caps), oci.WithCapabilities(svc.Caps),
oci.WithMounts(mounts), oci.WithMounts(mounts),