Skip to content

Commit

Permalink
[installer]: add endpoint and region to registry s3 bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Emms authored and roboquat committed Jun 13, 2022
1 parent 85c66e3 commit e709308
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion install/installer/cmd/mirror_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ func renderAllKubernetesObject(cfgVersion string, cfg *configv1.Config) ([]strin
},
},
S3Storage: &configv1.S3Storage{
Bucket: "some-bucket",
Bucket: "some-bucket",
Region: "some-region",
Endpoint: "some-url",
Certificate: configv1.ObjectRef{
Kind: configv1.ObjectRefSecret,
Name: "value",
Expand Down
7 changes: 6 additions & 1 deletion install/installer/pkg/components/docker-registry/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,23 @@ var Helm = common.CompositeHelmFunc(

inCluster := pointer.BoolDeref(cfg.Config.ContainerRegistry.InCluster, false)
s3Storage := cfg.Config.ContainerRegistry.S3Storage
enablePersistence := "true"

if inCluster && s3Storage != nil {
enablePersistence = "false"
registryValues = append(registryValues,
helm.KeyValue("docker-registry.s3.region", cfg.Config.Metadata.Region),
helm.KeyValue("docker-registry.s3.region", s3Storage.Region),
helm.KeyValue("docker-registry.s3.bucket", s3Storage.Bucket),
helm.KeyValue("docker-registry.s3.regionEndpoint", s3Storage.Endpoint),
helm.KeyValue("docker-registry.s3.encrypt", "true"),
helm.KeyValue("docker-registry.s3.secure", "true"),
helm.KeyValue("docker-registry.storage", "s3"),
helm.KeyValue("docker-registry.secrets.s3.secretRef", s3Storage.Certificate.Name),
)
}

registryValues = append(registryValues, helm.KeyValue("docker-registry.persistence.enabled", enablePersistence))

return &common.HelmConfig{
Enabled: inCluster,
Values: &values.Options{
Expand Down
2 changes: 2 additions & 0 deletions install/installer/pkg/config/v1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ type ContainerRegistryExternal struct {

type S3Storage struct {
Bucket string `json:"bucket" validate:"required"`
Region string `json:"region" validate:"required"`
Endpoint string `json:"endpoint" validate:"required"`
Certificate ObjectRef `json:"certificate" validate:"required"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
# Licensed under the GNU Affero General Public License (AGPL).
# See License-AGPL.txt in the project root for license information.

docker-registry:
persistence:
enabled: true
docker-registry: {}

0 comments on commit e709308

Please sign in to comment.