Skip to content

Commit

Permalink
Add docs for env var, use upstream constant
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor committed Dec 17, 2020
1 parent 2047c65 commit aa8fc48
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 27 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ There are a number of packages for reading/writing these interfaces from/to vari
The main focus has been registry interactions (hence the name) via the [`remote`](pkg/v1/remote) package,
but we have implemented other formats as we needed them to interoperate with various tools.

### Experiments

Over time, we will add new functionality under experimental environment variables listed here.

| Env Var | Value(s) | What is does |
---------------------------------------
| `GGCR_EXPERIMENT_ESTARGZ` | `"1"` | When enabled this experiment will direct `tarball.LayerFromOpener` to emit [estargz](https://github.com/opencontainers/image-spec/issues/815) compatible layers, which enable them to be lazily loaded by an appropriately configured containerd. |


### `v1.Image`

#### Sources
Expand Down
19 changes: 0 additions & 19 deletions pkg/v1/internal/estargz/constants.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/v1/tarball/layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func LayerFromOpener(opener Opener, opts ...LayerOption) (v1.Layer, error) {
if err != nil {
return nil, err
}
layer.annotations[gestargz.TOCDigestKey] = h.String()
layer.annotations[estargz.TOCJSONDigestAnnotation] = h.String()
return &and.ReadCloser{
Reader: rc,
CloseFunc: func() error {
Expand Down
13 changes: 6 additions & 7 deletions pkg/v1/tarball/layer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

"github.com/containerd/stargz-snapshotter/estargz"
"github.com/google/go-containerregistry/pkg/internal/compare"
gestargz "github.com/google/go-containerregistry/pkg/v1/internal/estargz"
"github.com/google/go-containerregistry/pkg/v1/validate"
)

Expand Down Expand Up @@ -130,10 +129,10 @@ func TestLayerFromFileEstargz(t *testing.T) {
t.Errorf("expected digests to differ: %s", defaultDigest.String())
}

if descriptorDefaultCompression.Annotations[gestargz.TOCDigestKey] == descriptorSpeedCompression.Annotations[gestargz.TOCDigestKey] {
if descriptorDefaultCompression.Annotations[estargz.TOCJSONDigestAnnotation] == descriptorSpeedCompression.Annotations[estargz.TOCJSONDigestAnnotation] {
t.Errorf("wanted different toc digests got default: %s, speed: %s",
descriptorDefaultCompression.Annotations[gestargz.TOCDigestKey],
descriptorSpeedCompression.Annotations[gestargz.TOCDigestKey])
descriptorDefaultCompression.Annotations[estargz.TOCJSONDigestAnnotation],
descriptorSpeedCompression.Annotations[estargz.TOCJSONDigestAnnotation])
}

tarLayerPrioritizedFiles, err := LayerFromFile("testdata/content.tar",
Expand Down Expand Up @@ -162,10 +161,10 @@ func TestLayerFromFileEstargz(t *testing.T) {
t.Errorf("expected digests to differ: %s", defaultDigest.String())
}

if descriptorDefaultCompression.Annotations[gestargz.TOCDigestKey] == descriptorPrioritizedFiles.Annotations[gestargz.TOCDigestKey] {
if descriptorDefaultCompression.Annotations[estargz.TOCJSONDigestAnnotation] == descriptorPrioritizedFiles.Annotations[estargz.TOCJSONDigestAnnotation] {
t.Errorf("wanted different toc digests got default: %s, prioritized: %s",
descriptorDefaultCompression.Annotations[gestargz.TOCDigestKey],
descriptorPrioritizedFiles.Annotations[gestargz.TOCDigestKey])
descriptorDefaultCompression.Annotations[estargz.TOCJSONDigestAnnotation],
descriptorPrioritizedFiles.Annotations[estargz.TOCJSONDigestAnnotation])
}
}

Expand Down

0 comments on commit aa8fc48

Please sign in to comment.