Skip to content

Commit

Permalink
fix: soci being reset on vm stop/start (#672)
Browse files Browse the repository at this point in the history
Issue #, if available:

*Description of changes:*
- Not sure why, but containerd's config file gets reset every time we
relaunch the VM, so I just separate the "download" and "configure" logic
to keep the script idempotent
- TODO: Move this all into a separate "config_applier", similar to the
`nerdctl_config_applier` so that there can be more logic around the
"already installed" checks

*Testing done:*
- Local testing, an e2e test for this is a nice TODO though


- [x] I've reviewed the guidance in CONTRIBUTING.md


#### 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: Justin Alvarez <[email protected]>
  • Loading branch information
pendo324 authored Oct 31, 2023
1 parent f181b89 commit 9df7d32
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/config/lima_config_applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@ const (
sociFileNameFormat = "soci-snapshotter-%s-linux-%s.tar.gz"
sociDownloadURLFormat = "https://github.com/awslabs/soci-snapshotter/releases/download/v%s/%s"
sociServiceDownloadURLFormat = "https://raw.githubusercontent.com/awslabs/soci-snapshotter/v%s/soci-snapshotter.service"
sociInstallationScriptFormat = `%s
//nolint:lll // command string
sociInstallationScriptFormat = `%s
if [ ! -f /usr/local/bin/soci ]; then
# download soci
set -e
curl --retry 2 --retry-max-time 120 -OL "%s"
# move to usr/local/bin
tar -C /usr/local/bin -xvf %s soci soci-snapshotter-grpc
# changing containerd config
echo " [proxy_plugins.soci]
type = \"snapshot\"
address = \"/run/soci-snapshotter-grpc/soci-snapshotter-grpc.sock\" " >> /etc/containerd/config.toml
# install as a systemd service
curl --retry 2 --retry-max-time 120 -OL "%s"
Expand All @@ -45,6 +42,11 @@ if [ ! -f /usr/local/bin/soci ]; then
systemctl enable --now soci-snapshotter
fi
# changing containerd config, this seems to get reset on every VM stop/start
if ! grep -q soci /etc/containerd/config.toml; then
printf ' [proxy_plugins.soci]\n type = "snapshot"\n address = "/run/soci-snapshotter-grpc/soci-snapshotter-grpc.sock"\n' >> /etc/containerd/config.toml
fi
sudo systemctl restart containerd.service
`

Expand Down

0 comments on commit 9df7d32

Please sign in to comment.