Skip to content

Commit

Permalink
Merge pull request #1673 from ktock/store-tocdigest-id
Browse files Browse the repository at this point in the history
[Additional Layer Store] Use TOCDigest as ID of each layer
  • Loading branch information
AkihiroSuda authored Jun 19, 2024
2 parents bfb1ce4 + a1573c2 commit 7e8fc21
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 127 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ ARG RUNC_VERSION=v1.1.12
ARG CNI_PLUGINS_VERSION=v1.4.1
ARG NERDCTL_VERSION=1.7.6

ARG PODMAN_VERSION=v5.0.2
ARG CRIO_VERSION=v1.30.0
ARG PODMAN_VERSION=v5.1.1
ARG CRIO_VERSION=main
ARG CONMON_VERSION=v2.1.11
ARG COMMON_VERSION=v0.58.2
ARG CRIO_TEST_PAUSE_IMAGE_NAME=registry.k8s.io/pause:3.6
Expand Down
5 changes: 2 additions & 3 deletions cmd/stargz-store/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,8 @@ func main() {
Fatalf("failed to prepare mountpoint %q", mountPoint)
}
}
if !config.Config.DisableVerification {
log.G(ctx).Warnf("content verification is not supported; switching to non-verification mode")
config.Config.DisableVerification = true
if config.Config.DisableVerification {
log.G(ctx).Fatalf("content verification can't be disabled")
}
mt, err := getMetadataStore(*rootDir, config)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions fs/layer/layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type Info struct {
FetchedSize int64 // layer fetched size in bytes
PrefetchSize int64 // layer prefetch size in bytes
ReadTime time.Time // last time the layer was read
TOCDigest digest.Digest
}

// Resolver resolves the layer location and provieds the handler of that layer.
Expand Down Expand Up @@ -415,6 +416,7 @@ func (l *layer) Info() Info {
FetchedSize: l.blob.FetchedSize(),
PrefetchSize: l.prefetchedSize(),
ReadTime: readTime,
TOCDigest: l.verifiableReader.Metadata().TOCDigest(),
}
}

Expand Down
1 change: 0 additions & 1 deletion script/demo-store/etc/stargz-store/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
metrics_address = "127.0.0.1:8234"
disable_verification = true
[[resolver.host."registry2-store:5000".mirrors]]
host = "registry2-store:5000"
insecure = true
10 changes: 9 additions & 1 deletion store/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,20 @@ func (n *layernode) Lookup(ctx context.Context, name string, out *fuse.EntryOut)
return nil, syscall.EIO
}
log.G(ctx).WithField(remoteSnapshotLogKey, prepareFailed).
WithField("layerdigest", n.digest).
WithField("digest", n.digest).
WithError(err).
Debugf("error resolving layer (context error: %v)", cErr)
log.G(ctx).WithError(err).Warnf("failed to mount layer %q: %q", name, n.digest)
return nil, syscall.EIO
}
if err := l.Verify(n.digest); err != nil {
log.G(ctx).WithField(remoteSnapshotLogKey, prepareFailed).
WithField("digest", n.digest).
WithError(err).
Debugf("failed to verify layer")
log.G(ctx).WithError(err).Warnf("failed to mount layer %q: %q", name, n.digest)
return nil, syscall.EIO
}
if name == blobLink {
sAttr := layerToAttr(l, &out.Attr)
cn := &blobnode{l: l}
Expand Down
Loading

0 comments on commit 7e8fc21

Please sign in to comment.