Skip to content

Commit

Permalink
pkg/dockerregistry/server/configuration: remove OPENSHIFT_DEFAULT_REG…
Browse files Browse the repository at this point in the history
…ISTRY support

also remove support for DOCKER_REGISTRY_SERVICE_HOST and DOCKER_REGISTRY_SERVICE_PORT
env vars.
  • Loading branch information
flavianmissi committed Sep 4, 2023
1 parent ecf8505 commit c664aef
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
18 changes: 0 additions & 18 deletions pkg/dockerregistry/server/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ const (
// DEPRECATED: Use the REGISTRY_OPENSHIFT_SERVER_ADDR instead.
openShiftDockerRegistryURLEnvVar = "REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_DOCKERREGISTRYURL"

// openShiftDefaultRegistryEnvVar overrides the dockerRegistryURLEnvVar as in OpenShift the
// default registry URL is controlled by this environment variable.
// DEPRECATED: Use the REGISTRY_OPENSHIFT_SERVER_ADDR instead.
openShiftDefaultRegistryEnvVar = "OPENSHIFT_DEFAULT_REGISTRY"

// enforceQuotaEnvVar is a boolean environment variable that allows to turn quota enforcement on or off.
// By default, quota enforcement is off. It overrides openshift middleware configuration option.
// Recognized values are "true" and "false".
Expand Down Expand Up @@ -324,13 +319,6 @@ func setDefaultMiddleware(config *configuration.Configuration) {
func getServerAddr(options configuration.Parameters, cfgValue string) (registryAddr string, err error) {
var found bool

if len(registryAddr) == 0 {
registryAddr, found = os.LookupEnv(openShiftDefaultRegistryEnvVar)
if found {
log.Infof("DEPRECATED: %q is deprecated, use the 'REGISTRY_OPENSHIFT_SERVER_ADDR' instead", openShiftDefaultRegistryEnvVar)
}
}

if len(registryAddr) == 0 {
registryAddr, found = os.LookupEnv(dockerRegistryURLEnvVar)
if found {
Expand All @@ -350,12 +338,6 @@ func getServerAddr(options configuration.Parameters, cfgValue string) (registryA
registryAddr = cfgValue
}

// TODO: This is a fallback to assuming there is a service named 'docker-registry'. This
// might change in the future and we should make this configurable.
if len(registryAddr) == 0 && len(os.Getenv("DOCKER_REGISTRY_SERVICE_HOST")) > 0 && len(os.Getenv("DOCKER_REGISTRY_SERVICE_PORT")) > 0 {
registryAddr = os.Getenv("DOCKER_REGISTRY_SERVICE_HOST") + ":" + os.Getenv("DOCKER_REGISTRY_SERVICE_PORT")
}

if len(registryAddr) == 0 {
err = fmt.Errorf("REGISTRY_OPENSHIFT_SERVER_ADDR variable must be set when running outside of Kubernetes cluster")
}
Expand Down
8 changes: 0 additions & 8 deletions pkg/dockerregistry/server/configuration/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,6 @@ openshift:
setenv: []env{{name: "DOCKER_REGISTRY_URL", value: "DOCKER_REGISTRY_URL"}},
expected: "DOCKER_REGISTRY_URL",
},
{
setenv: []env{{name: "OPENSHIFT_DEFAULT_REGISTRY", value: "OPENSHIFT_DEFAULT_REGISTRY"}},
expected: "OPENSHIFT_DEFAULT_REGISTRY",
},
}

for _, test := range testCases {
Expand Down Expand Up @@ -663,10 +659,6 @@ openshift:
setenv: []env{{name: "DOCKER_REGISTRY_URL", value: "DOCKER_REGISTRY_URL"}},
expected: "DOCKER_REGISTRY_URL",
},
{
setenv: []env{{name: "OPENSHIFT_DEFAULT_REGISTRY", value: "OPENSHIFT_DEFAULT_REGISTRY"}},
expected: "OPENSHIFT_DEFAULT_REGISTRY",
},
}

for _, test := range testCases {
Expand Down

0 comments on commit c664aef

Please sign in to comment.