Skip to content

Commit

Permalink
nydusify: support --with-referrer option
Browse files Browse the repository at this point in the history
With this option, we can track all nydus images associated with
an OCI image. For example, in Harbor we can cascade to show nydus
images linked to an OCI image, deleting the OCI image can also delete
the corresponding nydus images. At runtime, nydus snapshotter can also
automatically upgrade an OCI image run to nydus image.

Prior to this PR, we had enabled this feature by default. However,
it is now known that Docker Hub does not yet support Referrer.

Therefore, adding this option to disable this feature by default,
to ensure broad compatibility with various image registries.

Fix dragonflyoss#1363.

Signed-off-by: Yan Song <[email protected]>
  • Loading branch information
imeoer authored and adamqqqplay committed Aug 3, 2023
1 parent b1c6ebf commit 94f42fe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions contrib/nydusify/cmd/nydusify.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,12 @@ func main() {
Usage: "Convert to OCI-referenced nydus zran image",
EnvVars: []string{"OCI_REF"},
},
&cli.BoolFlag{
Name: "with-referrer",
Value: false,
Usage: "Associate a reference to the source image, see https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers",
EnvVars: []string{"WITH_REFERRER"},
},
&cli.BoolFlag{
Name: "oci",
Value: false,
Expand Down Expand Up @@ -497,6 +503,7 @@ func main() {
ChunkSize: c.String("chunk-size"),

OCIRef: c.Bool("oci-ref"),
WithReferrer: c.Bool("with-referrer"),
AllPlatforms: c.Bool("all-platforms"),
Platforms: c.String("platform"),
}
Expand Down
1 change: 1 addition & 0 deletions contrib/nydusify/pkg/converter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func getConfig(opt Opt) map[string]string {
cfg["docker2oci"] = strconv.FormatBool(opt.Docker2OCI)
cfg["merge_manifest"] = strconv.FormatBool(opt.MergePlatform)
cfg["oci_ref"] = strconv.FormatBool(opt.OCIRef)
cfg["with_referrer"] = strconv.FormatBool(opt.WithReferrer)

cfg["prefetch_patterns"] = opt.PrefetchPatterns
cfg["compressor"] = opt.Compressor
Expand Down
1 change: 1 addition & 0 deletions contrib/nydusify/pkg/converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Opt struct {
ChunkSize string
PrefetchPatterns string
OCIRef bool
WithReferrer bool

AllPlatforms bool
Platforms string
Expand Down

0 comments on commit 94f42fe

Please sign in to comment.