Skip to content

Commit

Permalink
fix: persists network user data (runfinch#211)
Browse files Browse the repository at this point in the history
PR fixes runfinch#180

*Description of changes:*

Persists the `cni` user data stored in `~/.local/share/cni` and in
`~/.config/cni`

*Testing done:*

Manual testing

```
$ finch network create samtest --subnet 10.8.0.0/24
$ finch run --network=samtest --name hello public.ecr.aws/amazonlinux/amazonlinux:2 sleep 1
$ finch vm stop
$ finch vm remove
$ finch vm init
$ finch start hello
```

#### License Acceptance

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

---------

Signed-off-by: Sam Berning <[email protected]>
Signed-off-by: Hsing-Yu (David) Chen <[email protected]>
Co-authored-by: Hsing-Yu (David) Chen <[email protected]>
  • Loading branch information
sam-berning and davidhsingyuchen authored Feb 10, 2023
1 parent 1578ce7 commit f6baf82
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions finch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,25 @@ provision:
script: |
#!/bin/bash
sudo chown $USER /mnt/lima-finch
mkdir -p /mnt/lima-finch/containerd
mkdir -p /mnt/lima-finch/nerdctl
mkdir -p ~/.local/share/nerdctl
# https://github.com/containerd/nerdctl/blob/cffdf87ff4d648a5344eea1406bb95ca3ad7eaa4/extras/rootless/containerd-rootless.sh#L144-L146
# XDG_DATA_HOME & ~/.local/share: https://github.com/containerd/nerdctl/blob/cffdf87ff4d648a5344eea1406bb95ca3ad7eaa4/extras/rootless/containerd-rootless.sh#L51
mkdir -p /mnt/lima-finch/containerd ~/.local/share/containerd
sudo mount --bind /mnt/lima-finch/containerd ~/.local/share/containerd
# https://github.com/containerd/nerdctl/blob/main/docs/dir.md#dataroot
mkdir -p /mnt/lima-finch/nerdctl ~/.local/share/nerdctl
sudo mount --bind /mnt/lima-finch/nerdctl ~/.local/share/nerdctl
# https://github.com/containerd/nerdctl/blob/main/docs/dir.md#netconfpath
mkdir -p /mnt/lima-finch/cni-config ~/.config/cni
sudo mount --bind /mnt/lima-finch/cni-config ~/.config/cni
# https://github.com/containerd/nerdctl/blob/cffdf87ff4d648a5344eea1406bb95ca3ad7eaa4/extras/rootless/containerd-rootless.sh#L148-L150
# XDG_DATA_HOME & ~/.local/share: https://github.com/containerd/nerdctl/blob/cffdf87ff4d648a5344eea1406bb95ca3ad7eaa4/extras/rootless/containerd-rootless.sh#L51
mkdir -p /mnt/lima-finch/cni-local ~/.local/share/cni
sudo mount --bind /mnt/lima-finch/cni-local ~/.local/share/cni
systemctl --user restart containerd.service
# Probe scripts to check readiness.
Expand Down

0 comments on commit f6baf82

Please sign in to comment.