Skip to content

Commit

Permalink
feat(registry): enable delete image by digest
Browse files Browse the repository at this point in the history
  • Loading branch information
leonarliu authored and tke-robot committed Sep 25, 2020
1 parent 935aef7 commit e18a50d
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ data:
storage:
fileSystem:
rootDirectory: /storage
delete:
enabled: true
security:
tokenPrivateKeyFile: /etc/registry/private_key.pem
tokenPublicKeyFile: /etc/registry/public_key.crt
Expand Down
7 changes: 7 additions & 0 deletions pkg/registry/apis/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ type Storage struct {
InMemory *InMemoryStorage
// +optional
S3 *S3Storage
// +optional
Delete *Delete
}

type FileSystemStorage struct {
Expand Down Expand Up @@ -100,6 +102,11 @@ type S3Storage struct {
ObjectACL *string
}

// Delete cloud enable the deletion of image blobs and manifests by digest.
type Delete struct {
Enabled bool
}

type Security struct {
TokenPrivateKeyFile string
TokenPublicKeyFile string
Expand Down
7 changes: 7 additions & 0 deletions pkg/registry/apis/config/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ type Storage struct {
InMemory *InMemoryStorage `json:"inMemory,omitempty"`
// +optional
S3 *S3Storage `json:"s3,omitempty"`
// +optional
Delete *Delete `json:"delete,omitempty"`
}

type FileSystemStorage struct {
Expand Down Expand Up @@ -100,6 +102,11 @@ type S3Storage struct {
ObjectACL *string `json:"objectACL,omitempty"`
}

// Delete cloud enable the deletion of image blobs and manifests by digest.
type Delete struct {
Enabled bool `json:"enabled"`
}

type Security struct {
TokenPrivateKeyFile string `json:"tokenPrivateKeyFile"`
TokenPublicKeyFile string `json:"tokenPublicKeyFile"`
Expand Down
32 changes: 32 additions & 0 deletions pkg/registry/apis/config/v1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions pkg/registry/apis/config/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions pkg/registry/apis/config/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/registry/distribution/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,10 @@ func buildStorageConfiguration(opts *Options) map[string]configuration.Parameter

storage["s3"] = s3
}
if storageCfg.Delete != nil {
deleteDriver := make(map[string]interface{})
deleteDriver["enabled"] = storageCfg.Delete.Enabled
storage["delete"] = deleteDriver
}
return storage
}

0 comments on commit e18a50d

Please sign in to comment.