Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build soci-snapshotter package #3879

Merged
merged 1 commit into from
May 29, 2024
Merged

Conversation

larvacea
Copy link
Member

@larvacea larvacea commented Apr 9, 2024

Description of changes:
This builds the soci-snapshotter containerd plugin. The plugin has two components:

  • soci-snapshotter-grpc is a daemon (systemd service).
  • soci is a CLI tool for working with SOCI indices.

In addition, the rpm packages (and should install) soci-snapshotter.service, the unit file for systemd, so the daemon starts during boot (after network, and before containerd).

The aws-dev variant (and no other variant) includes the package.

Testing done:
[Edit] Manual testing on an aws-dev ec2 instance, following the soci-snapshotter installation and getting-started guides. The soci-snapshotter documentation uses nerdctl, so these packages were tested using nerdctl. That required a few extra steps:

  • Create an overlay file system on the /root directory because nerdctl wants to store registry credentials in $HOME/.docker/config.json.
  • Install wget and tar in the admin container, download, then copy nerdctl over to the host.
  • Add the soci-snapshotter plugin to containerd's configuration (in the AMI)

Following the steps outlined in the soci-snapshotter repo, I can verify containerd will happily pull and run an image through soci. I see exactly the transactions I expect with ECR and the plugin is able to find and download the soci index, ztoc, and manifest files given the package URI. Both pull and run benefit from lazy loading on the test image they suggested.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Copy link
Contributor

@yeazelm yeazelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per your testing comments:

Absolutely none. This definitely builds the RPM, and the rpm tools say it is all perfectly fine. The aws-dev variant builds. If one wanted to inform containerd of the plugin's existence, one would need to add a few lines to the containerd config.toml file.

Can we try a bit more validation than this? Since it is a dev image, I don't think we need to fully integrate the API for the configuration settings, but at least you could attempt to get containerd to use it via the shell manually? Just because it builds into an rpm doesn't mean the resulting binaries are usable. I'd like to at least see a basic smoke test to ensure the binaries could work once the rest of the configuration is provided.

packages/soci-snapshotter/Cargo.toml Outdated Show resolved Hide resolved
packages/soci-snapshotter/Cargo.toml Show resolved Hide resolved
packages/soci-snapshotter/Cargo.toml Outdated Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.spec Outdated Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.spec Outdated Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.spec Outdated Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.spec Outdated Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.spec Outdated Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.spec Outdated Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.spec Outdated Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.service Outdated Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.service Outdated Show resolved Hide resolved
packages/soci-snapshotter/Cargo.toml Outdated Show resolved Hide resolved
@larvacea larvacea force-pushed the soci branch 5 times, most recently from 43c71fd to f23d765 Compare April 22, 2024 16:56
packages/fuse/fuse.spec Outdated Show resolved Hide resolved
packages/fuse/fuse.spec Outdated Show resolved Hide resolved
packages/fuse/fuse.spec Outdated Show resolved Hide resolved
packages/fuse/fuse.spec Outdated Show resolved Hide resolved
packages/fuse/fuse.spec Outdated Show resolved Hide resolved
packages/fuse/fuse.spec Outdated Show resolved Hide resolved
packages/fuse/fuse.spec Outdated Show resolved Hide resolved
packages/fuse/fuse.spec Outdated Show resolved Hide resolved
packages/fuse/fuse.spec Outdated Show resolved Hide resolved
packages/fuse/fuse.spec Outdated Show resolved Hide resolved
@larvacea
Copy link
Member Author

Testing confirms that soci-snapshotter (running on bottlerocket, as a systemd service) works with or without fuse. Without fuse, soci-snapshotter will write error messages to the journal.

Copy link
Contributor

@bcressey bcressey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure the snapshotter binaries will need to be built for FIPS and non-FIPS, so I've suggested the changes required for that.

packages/soci-snapshotter/soci-snapshotter.service Outdated Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.service Outdated Show resolved Hide resolved
packages/soci-snapshotter/Cargo.toml Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.spec Outdated Show resolved Hide resolved
packages/soci-snapshotter/soci-snapshotter.spec Outdated Show resolved Hide resolved
@larvacea larvacea force-pushed the soci branch 5 times, most recently from ff9d96f to 1f5d38d Compare May 7, 2024 16:30
@larvacea larvacea force-pushed the soci branch 2 times, most recently from ca6e5cb to 8e5946f Compare May 16, 2024 22:55
Add the SOCI snapshotter package to aws-dev. This is a lazy-loading plugin for
containerd.

See:

https://github.com/awslabs/soci-snapshotter
@larvacea
Copy link
Member Author

I have incorporated all of Ben's suggestions except changing the source URL. Changing the source URL broke the build, and I have not yet debugged that problem.

@larvacea larvacea merged commit 349713d into bottlerocket-os:develop May 29, 2024
33 checks passed
@larvacea larvacea deleted the soci branch May 29, 2024 15:12
@ducminhle
Copy link

Hi @larvacea,
Is this PR ready for EKS?
When I install soci-snapshotter on EKS (with pre-boostrap user-data), I need to install amazon-ecr-credential-helper and config $HOME/.docker/config.json to pull images from ECR.

{
  "credsStore": "ecr-login"
}

@arnaldo2792
Copy link
Contributor

Hey @ducminhle , this is not ready to be used by EKS or ECS yet, due to the dependencies that you described. We need to work closely with the EKS and SOCI maintainers to figure out if there is a different solution to support credentials in SOCI.

@ducminhle
Copy link

Hey @ducminhle , this is not ready to be used by EKS or ECS yet, due to the dependencies that you described. We need to work closely with the EKS and SOCI maintainers to figure out if there is a different solution to support credentials in SOCI.

Thank you for your answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants