Skip to content

Commit

Permalink
Prefer X-Registry-Supports-Signatures to lookaside
Browse files Browse the repository at this point in the history
In general, a single server should never have both, so the order mostly
doesn't matter.  The one place where the difference is important is
the ability of lookside to have a global default; if lookaside is preferred,
such a global default makes X-R-S-S impossible to use.

The disadvantage of this is that simply upgrading a registry to a server
version which supports X-R-S-S breaks any previously configured lookaside
for the server.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
  • Loading branch information
mtrmac committed May 7, 2018
1 parent a1a9391 commit f2040a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions docker/docker_image_dest.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ func (d *dockerImageDestination) SupportsSignatures(ctx context.Context) error {
return err
}
switch {
case d.c.signatureBase != nil:
return nil
case d.c.supportsSignatures:
return nil
case d.c.signatureBase != nil:
return nil
default:
return errors.Errorf("X-Registry-Supports-Signatures extension not supported, and lookaside is not configured")
}
Expand Down Expand Up @@ -276,10 +276,10 @@ func (d *dockerImageDestination) PutSignatures(ctx context.Context, signatures [
return err
}
switch {
case d.c.signatureBase != nil:
return d.putSignaturesToLookaside(signatures)
case d.c.supportsSignatures:
return d.putSignaturesToAPIExtension(ctx, signatures)
case d.c.signatureBase != nil:
return d.putSignaturesToLookaside(signatures)
default:
return errors.Errorf("X-Registry-Supports-Signatures extension not supported, and lookaside is not configured")
}
Expand Down
4 changes: 2 additions & 2 deletions docker/docker_image_src.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ func (s *dockerImageSource) GetSignatures(ctx context.Context, instanceDigest *d
return nil, err
}
switch {
case s.c.signatureBase != nil:
return s.getSignaturesFromLookaside(ctx, instanceDigest)
case s.c.supportsSignatures:
return s.getSignaturesFromAPIExtension(ctx, instanceDigest)
case s.c.signatureBase != nil:
return s.getSignaturesFromLookaside(ctx, instanceDigest)
default:
return [][]byte{}, nil
}
Expand Down

0 comments on commit f2040a5

Please sign in to comment.