Skip to content

Commit 7bece14

Browse files
authored
Merge pull request #167 from imeoer/nydus-with-referrer
nydus: support with_referrer option
2 parents 03885a3 + 8b36f1f commit 7bece14

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

misc/config/config.nydus.ref.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ converter:
5151

5252
# convert to OCI-referenced nydus zran image.
5353
oci_ref: true
54+
55+
# with this option, we can track all nydus images associated with
56+
# an OCI image. For example, in Harbor we can cascade to show nydus
57+
# images linked to an OCI image, deleting the OCI image can also delete
58+
# the corresponding nydus images. At runtime, nydus snapshotter can also
59+
# automatically upgrade an OCI image run to nydus image.
60+
with_referrer: true
5461
rules:
5562
# add suffix to tag of source image reference as target image reference
5663
- tag_suffix: -nydus-oci-ref

misc/config/config.nydus.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ converter:
5252
# convert to OCI-referenced nydus zran image.
5353
# oci_ref: false
5454

55+
# with this option, we can track all nydus images associated with
56+
# an OCI image. For example, in Harbor we can cascade to show nydus
57+
# images linked to an OCI image, deleting the OCI image can also delete
58+
# the corresponding nydus images. At runtime, nydus snapshotter can also
59+
# automatically upgrade an OCI image run to nydus image.
60+
with_referrer: true
61+
5562
# specify nydus format version, possible values: `5`, `6` (EROFS-compatible), default is `6`
5663
# fs_version: 6
5764

pkg/driver/nydus/nydus.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ type Driver struct {
7878
backend backend.Backend
7979
platformMC platforms.MatchComparer
8080
encryptRecipients []string
81+
withReferrer bool
8182
}
8283

8384
func detectBuilderVersion(ctx context.Context, builder string) string {
@@ -175,6 +176,11 @@ func New(cfg map[string]string, platformMC platforms.MatchComparer) (*Driver, er
175176
return nil, errors.Wrap(err, "invalid oci_ref option")
176177
}
177178

179+
withReferrer, err := parseBool(cfg["with_referrer"])
180+
if err != nil {
181+
return nil, errors.Wrap(err, "invalid with_referrer option")
182+
}
183+
178184
encryptRecipients := []string{}
179185
if cfg["encrypt_recipients"] != "" {
180186
encryptRecipients = strings.Split(cfg["encrypt_recipients"], ",")
@@ -201,6 +207,7 @@ func New(cfg map[string]string, platformMC platforms.MatchComparer) (*Driver, er
201207
backend: _backend,
202208
platformMC: platformMC,
203209
encryptRecipients: encryptRecipients,
210+
withReferrer: withReferrer,
204211
}, nil
205212
}
206213

@@ -263,6 +270,7 @@ func (d *Driver) convert(ctx context.Context, provider accelcontent.Provider, so
263270
OCI: d.docker2oci,
264271
OCIRef: packOpt.OCIRef,
265272
EncryptRecipients: d.encryptRecipients,
273+
WithReferrer: d.withReferrer,
266274
}
267275
convertHookFunc := func(
268276
ctx context.Context, cs content.Store, orgDesc ocispec.Descriptor, newDesc *ocispec.Descriptor,

0 commit comments

Comments
 (0)