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

make config and metadata visible #22

Conversation

mikemccracken
Copy link
Contributor

@mikemccracken mikemccracken commented Oct 1, 2024

"write molecule config to metadata path" is important to be able to trace an event that points at a failed DM Verity volume, through its molecule mountpoint, to an OCI image and potentially to a container running that image that we then need to stop.

"move metadata path to /run" is handy for testing, but is not strictly required, since it only changes the behavior of the atomfs binary. Other programs using atomfs as a package are free to set the metadata path however they want, if they need it to be accessible while the molecule is mounted.

Fixes #21

The molecule config contains the OCI path and tag, which is important if
we want to track what container image is mounted at a particular path,
and thus what container might need to stop if a verity error is detected
in one of the atoms in the molecule it's using.

This commit writes that config to a JSON file in the metadata path.

Signed-off-by: Michael McCracken <[email protected]>
@mikemccracken mikemccracken marked this pull request as ready for review October 1, 2024 00:12
@hallyn
Copy link
Contributor

hallyn commented Oct 1, 2024

Error: cmd/atomfs/umount.go:10:2: "machinerun.io/atomfs/log" imported and not used

@hallyn
Copy link
Contributor

hallyn commented Oct 1, 2024

Otherwise looks fine to me, thanks

In order to make it trivial to read the config.json for a given mount,
move the metadata path to /run/atomfs/meta/$munged-mountpt-name/

Signed-off-by: Michael McCracken <[email protected]>
@mikemccracken mikemccracken force-pushed the 2024.09.30/main/make-meta-visible branch from 91e6e84 to 98626ba Compare October 1, 2024 19:54
@mikemccracken
Copy link
Contributor Author

derp! thanks, fixed

@mikemccracken
Copy link
Contributor Author

thanks for the review, I was wondering if there was a reason to object to moving away from the nice neat tucked-under-the-mountpoint approach. I didn't look too hard but didn't think of a nice way to get at the meta of a still-mounted molecule with the previous scheme..

@hallyn
Copy link
Contributor

hallyn commented Oct 1, 2024

Well, now that you mention it, there is reason :) If different users (or different root logins) each try to mount to the same mountpoint in different namespaces, which is perfectly legitimate, then there will now be conflicts, right?

@mikemccracken
Copy link
Contributor Author

that's a good point, do you have a scheme in mind that fixes that? Is there a way to get a unique string that maps to a given mount namespace?

Or alternately maybe we should keep the old behavior as default and add a --use-central-meta flag (bad name) that does what I added here?

@hallyn
Copy link
Contributor

hallyn commented Oct 2, 2024

Yeah, you should be able to use:

serge@honeybadger:~$ ls -l /proc/self/ns/mnt
lrwxrwxrwx 1 serge serge 0 Oct  2 13:39 /proc/self/ns/mnt -> 'mnt:[4026531841]'

For the mounter. That mntns name will be unique as long as that mntns exists, so if it created the mount, it'll live as long as the mount does.

@mikemccracken
Copy link
Contributor Author

closing this for a new PR with this change but also more. My earlier assertion that "Other programs using atomfs as a package are free to set the metadata path however they want, if they need it to be accessible while the molecule is mounted." may have been true but it meant duplicating a lot of atomfs code in those programs, so my new PR has a different approach where the mount code moves into the atomfs package and everything using it to mount a molecule will get the metadata at /run/atomfs/meta. It will incorporate the suggestion to use the mount nsname.

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.

need to track OCI image source info
2 participants