Repository navigation
Conversation
An image provider plugin will prepare some images' layers under a lease that atelet must release on checkpoint and terminate, also after an atelet restart. The overlay spec now records the image ref and the plugin's lease ID, for the rootfs and for each image volume. Image.LeaseID carries the lease from the image lookup.
The worker derived each lowerdir as <layer>/fs, so only Store layers could be mounted. The overlay spec now records each image's lowerdirs, and its Store layers when it came from the Store. The worker mounts the lowerdirs as they are, and finalizes and repairs only the Store layers. GC roots only Store layers. Image.ProviderDirs holds lowerdirs that an image provider plugin returns. ReadFile reads such lowerdirs directly and treats 0:0 character devices as whiteouts. It cannot see their opaque dirs, since reading trusted.* xattrs needs CAP_SYS_ADMIN. A spec without lowerdirs stays at version 1, so older workers still read it. A spec with lowerdirs is version 2, which older workers reject. atelet writes only Store images for now, so it still writes version 1.
| if len(storeLayers) > 0 { | ||
| *lowerDirs = nil | ||
| } else if len(*lowerDirs) > 0 { | ||
| s.Version = specVersionLowerDirs |
There was a problem hiding this comment.
Fine on its own since nothing writes v2 yet. Can the gate in #4028 default off and be documented as enable-only-after-all-workers-are-on-this-release? Rolling atelet back with a v2 bundle on the node stalls GC (InUse errors skip the pass) and the old worker can't mount it.
There was a problem hiding this comment.
It is. The gate is a preview gate, off by default, and the guide says to turn it on only after every WorkerPool runs the release, and to turn it off and drain plugin images before rolling atelet back. I added that an older atelet's GC skips every pass while a version 2 spec is on the node, and an older worker can't mount one.
| return nil, fmt.Errorf("image file %q: %w", name, err) | ||
| } | ||
| hidden, err := layerHides(layerDir, rel) | ||
| if i >= len(img.LayerDirs) { |
There was a problem hiding this comment.
What happens when an upper provider layer has an opaque /etc and a lower one has passwd? resolveImageUser would pick up the hidden file. Could the plugin return opaque dirs alongside the lowerdirs, like Store layers record them, so layerHides covers both?
There was a problem hiding this comment.
Since the API moved to one rootfs per image, a provider image has a single lowerdir, the plugin's merged overlay, where the kernel has already applied opaque dirs and whiteouts. ReadFile now reads it once as a plain directory and walks layers only for Store images.
| func (s OverlaySpec) encoded() OverlaySpec { | ||
| s.Version = specVersionStore | ||
| encode := func(lowerDirs *[]string, storeLayers []string) { | ||
| if len(storeLayers) > 0 { |
There was a problem hiding this comment.
encoded() silently drops LowerDirs when StoreLayers is set. Have you considered returning an error if they disagree, or having callers set only one?
There was a problem hiding this comment.
WriteSpec now returns an error when an image's lowerdirs aren't those of its Store layers. Setting only StoreLayers, or both consistently, still works. Covered by TestWriteSpecLowerDirsOfStoreLayers.
| ImageRef string `json:"imageRef,omitempty"` | ||
| // LeaseID is the image provider plugin's lease on LowerDirs, which atelet | ||
| // releases on checkpoint and terminate. | ||
| LeaseID string `json:"leaseID,omitempty"` |
There was a problem hiding this comment.
Nothing sets ImageRef/LeaseID in this PR. Have you considered landing them with #4029 where they're consumed? Keeping them with the stack is fine too, but the description reads as if they're recorded already.
There was a problem hiding this comment.
Moved them. The commit that adds ImageRef and LeaseID is now in the #4028 stack, right before the code that writes them, and this PR keeps only the version 2 lowerdirs. Updated the description.
Move ImageRef and LeaseID to the PR that writes them. WriteSpec rejects lowerdirs that disagree with the Store layers. ReadFile handles a provider rootfs explicitly. Document GC and worker behavior on rollback.
See the review threads on agent-substrate#4026 through agent-substrate#4031.
See the review threads on agent-substrate#4026 through agent-substrate#4031.
See the review threads on agent-substrate#4026 through agent-substrate#4031.
See the review threads on agent-substrate#4026 through agent-substrate#4031.
See the review threads on agent-substrate#4026 through agent-substrate#4031.
See the review threads on agent-substrate#4026 through agent-substrate#4031.
See the review threads on agent-substrate#4026 through agent-substrate#4031.
See the review threads on agent-substrate#4026 through agent-substrate#4031.
Part of #4023.
The worker derived each lowerdir as
<layer>/fs, so only Store layers could be mounted. The overlay spec now records each image's overlayfs lowerdirs, and its Store layers when it came from the Store. The worker mounts the lowerdirs as they are, and finalizes and repairs only the Store layers. GC roots only Store layers. Plugin layers are plain host directories, not Store layer dirs.WriteSpec fails when an image's lowerdirs are not those of its Store layers. Image.ProviderRootfs holds the rootfs a plugin returns, and ReadFile reads it as a plain directory.
A spec without lowerdirs stays at version 1, so older workers still read it. A spec with lowerdirs is version 2, which older workers reject. atelet writes version 2 only for plugin images, and only with the ImageProviderPlugin gate on (#4028). Until then it writes version 1. See docs/reference/version-skew-policy.md.
The image ref and provider lease fields land with #4028, which writes them.
Testing: go test -race ./internal/imagecache/..., including spec_test.go, imagefile_test.go and bundle_linux_test.go.
I used an AI agent to port this commit from our fork, address review comments, and draft this description. I reviewed the code and commit message.