Skip to content

REGISTRY_OPENSHIFT_SERVER_ADDR env var does not appear to work #58

Closed

Description

@bparees

the registry does not appear to actually respect this value properly:

$ oc logs docker-registry-1-knwnf -n default | grep URL

time="2018-01-28T03:00:12.310853118Z" level=info msg="Using \"172.30.183.222:5000\" as Docker Registry URL" go.version=go1.9.2 instance.id=a82b7ca8-0b55-4567-92ef-2c1744e6074a 

$ oc get pod docker-registry-1-knwnf -o yaml | grep -A 2 ADDR 
--
    - name: REGISTRY_OPENSHIFT_SERVER_ADDR
      value: docker-registry.default.svc:5000

Activity

  1. added
    kind/bug
    on Jan 28, 2018
  2. bparees commented on Jan 29, 2018

    @bparees
    ContributorAuthor

    When this is fixed, we should un-revert openshift/openshift-ansible#6913

  3. legionus commented on Jan 29, 2018

    @legionus
    Contributor
    $ oc cluster up --version='latest'
    $ oc version
    oc v3.9.0-alpha.3+9ab7a71-232-dirty
    kubernetes v1.9.1+a0ce1bc657
    features: Basic-Auth GSSAPI Kerberos SPNEGO
    
    Server https://127.0.0.1:8443
    openshift v3.9.0-alpha.3+9ab7a71-232
    kubernetes v1.9.1+a0ce1bc657
    
    $ oc login -u system:admin
    
    $ oc rsh dc/docker-registry cat /proc/1/environ |tr '\0' '\n' |egrep '(DOCKER_REGISTRY_SERVICE_HOST|DOCKER_REGISTRY_SERVICE_POST|DOCKER_REGISTRY_URL|REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_DOCKERREGISTRYURL|OPENSHIFT_DEFAULT_REGISTRY|REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_DOCKERREGISTRYURL)'
    DOCKER_REGISTRY_SERVICE_HOST=172.30.1.1
    

    I do not know how you created the cluster, but in the cluster that is created by oc cluster up, a variable DOCKER_REGISTRY_SERVICE_HOST is set.

    $ oc env -n default dc/docker-registry REGISTRY_OPENSHIFT_SERVER_ADDR=foobar
    
    $ oc rsh dc/docker-registry cat /proc/1/environ |tr '\0' '\n' |egrep '(DOCKER_REGISTRY_SERVICE_HOST|DOCKER_REGISTRY_SERVICE_POST|DOCKER_REGISTRY_URL|REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_DOCKERREGISTRYURL|OPENSHIFT_DEFAULT_REGISTRY|REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_DOCKERREGISTRYURL|REGISTRY_OPENSHIFT_SERVER_ADDR)'
    REGISTRY_OPENSHIFT_SERVER_ADDR=foobar
    DOCKER_REGISTRY_SERVICE_HOST=172.30.1.1
    

    As you can see the DOCKER_REGISTRY_SERVICE_HOST variable is still set and it has a higher priority. To remove it you have to unset it explicitly:

    $ oc env -n default dc/docker-registry DOCKER_REGISTRY_SERVICE_HOST=''
    

    I have test for env variables: https://github.com/openshift/image-registry/blob/master/pkg/dockerregistry/server/configuration/configuration_test.go#L565
    In it, you can see the priorities of the environment variables.

    We can raise the priority of the REGISTRY_OPENSHIFT_SERVER_ADDR variable, but in that case we'll probably break old configurations that use old variables.

    So this is not a bug, but the expected behavior.

  4. legionus commented on Jan 29, 2018

    @legionus
    Contributor

    @bparees To be sure, please show the dockerregistry environment variables.

  5. dmage commented on Jan 29, 2018

    @dmage
    Contributor

    @legionus DOCKER_REGISTRY_SERVICE_HOST is always set by Kubernetes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugpriority/P1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions