Disable namespacing

We don't strictly need namespacing in order to have a buildset registry
serve as multiple registries.  If we don't configure it in zuul-registry
itself, and treat dockerhub images as non-namespaced, then both docker
and oci configurations can use the same buildset registry.  We would
configure docker to talk to the registry as normal and it will fetch
unqualified image names, but we would set up containers/registries.conf
to prepend urls for non-dockerhub registries, and it would not prepend
anything for dockerhub.

In this way, both configurations can use the same buildset registry.

Change-Id: I8af4ea0f5da5ad835384400108250e14a8435656
This commit is contained in:
James E. Blair 2019-10-17 09:54:22 -07:00
parent 0f76a0a09d
commit 8772465ecc
10 changed files with 28 additions and 55 deletions

View File

@ -20,9 +20,9 @@
register: docker_restart
failed_when: docker_restart is failed and not 'Could not find the requested service' in docker_restart.msg
- name: Start the standard registry
- name: Start the registry
shell:
cmd: docker-compose -f standard-compose.yaml up -d
cmd: docker-compose up -d
chdir: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry/playbooks/functional-test"
- name: Wait for registry to come up
@ -84,9 +84,9 @@
- name: Remove the test image from the local cache
command: docker rmi alpine
- name: Stop the standard registry
- name: Stop the registry
shell:
cmd: docker-compose -f standard-compose.yaml down
cmd: docker-compose down
chdir: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry/playbooks/functional-test"
- name: Clean up docker volumes

View File

@ -6,7 +6,7 @@ services:
registry:
image: zuul/zuul-registry
volumes:
- "./standard-conf/:/conf/:z"
- "./conf/:/conf/:z"
- "/tmp/registry-test/tls/:/tls:z"
ports:
- "9000:9000"

View File

@ -1,8 +1,8 @@
# Test push and pull from the standard registry
- name: Start the standard registry
- name: Start the registry
shell:
cmd: docker-compose -f standard-compose.yaml up -d
cmd: docker-compose up -d
chdir: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry/playbooks/functional-test"
- name: Print list of images
@ -19,7 +19,7 @@
- name: Log in to registry
command: docker login localhost:9000 -u testuser -p testpass
- name: Push the test image to the standard registry
- name: Push the test image to the registry
command: docker push localhost:9000/test/image
- name: Remove the test image from the local cache
@ -30,7 +30,7 @@
register: image_list
failed_when: "'test/image' in image_list.stdout"
- name: Pull the image from the standard registry
- name: Pull the image from the registry
command: docker pull localhost:9000/test/image
- name: Print list of images
@ -46,9 +46,9 @@
- name: Remove the test image from the local cache
command: docker rmi localhost:9000/test/image
- name: Stop the standard registry
- name: Stop the registry
shell:
cmd: docker-compose -f standard-compose.yaml down
cmd: docker-compose down
chdir: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry/playbooks/functional-test"
- name: Clean up docker volumes

View File

@ -5,7 +5,7 @@ prefix = "docker.io"
location = "docker.io"
[[registry.mirror]]
location = "localhost:9000/docker.io"
location = "localhost:9000"
[[registry.mirror]]
location = "docker.io"

View File

@ -1,13 +0,0 @@
# Version 2 is the latest that is supported by docker-compose in
# Ubuntu Xenial.
version: '2'
services:
registry:
image: zuul/zuul-registry
volumes:
- "./namespaced-conf/:/conf/:z"
- "/tmp/registry-test/storage/:/storage:z"
- "/tmp/registry-test/tls/:/tls:z"
ports:
- "9000:9000"

View File

@ -6,9 +6,9 @@
src: files/registries.conf
become: true
- name: Start the namespaced registry
- name: Start the registry
shell:
cmd: docker-compose -f namespaced-compose.yaml up -d
cmd: docker-compose up -d
chdir: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry/playbooks/functional-test"
- name: Wait for registry to come up
@ -35,13 +35,13 @@
content: "{{ new_user_config | to_nice_json }}"
dest: "/run/user/{{ ansible_user_uid }}/auth.json"
- name: Copy the test image into the buildset registry
- name: Copy the test image into the registry
command: >
skopeo copy --dest-creds testuser:testpass
docker-archive:{{ workspace }}/test.img
docker://localhost:9000/docker.io/test/image:latest
docker://localhost:9000/test/image:latest
- name: Copy the test image into the buildset registry
- name: Copy the test image into the registry
command: >
skopeo copy --dest-creds testuser:testpass
docker-archive:{{ workspace }}/test.img
@ -55,7 +55,7 @@
- "'test/quay-image' in image_list.stdout"
- "'alpine' in image_list.stdout"
- name: Pull the shadowed docker image from the buildset registry
- name: Pull the shadowed docker image from the registry
command: podman pull test/image
- name: Print list of images
@ -66,7 +66,7 @@
- name: Remove the test image from the local cache
command: podman rmi docker.io/test/image
- name: Pull the shadowed quay image from the buildset registry
- name: Pull the shadowed quay image from the registry
command: podman pull quay.io/test/quay-image
- name: Print list of images
@ -104,9 +104,9 @@
- name: Remove the test image from the local cache
command: podman rmi quay.io/0xff/alpine-sshd
- name: Stop the namespaced registry
- name: Stop the registry
shell:
cmd: docker-compose -f namespaced-compose.yaml down
cmd: docker-compose down
chdir: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry/playbooks/functional-test"
- name: Clean up docker volumes

View File

@ -1,8 +1,8 @@
# Test push and pull from the standard registry
- name: Start the standard registry
- name: Start the registry
shell:
cmd: docker-compose -f standard-compose.yaml up -d
cmd: docker-compose up -d
chdir: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry/playbooks/functional-test"
- name: Print list of images
@ -19,7 +19,7 @@
- name: Log in to registry
command: podman login localhost:9000 -u testuser -p testpass
- name: Push the test image to the standard registry
- name: Push the test image to the registry
command: podman push localhost:9000/test/image
- name: Remove the test image from the local cache
@ -33,7 +33,7 @@
register: image_list
failed_when: "'test/image' in image_list.stdout"
- name: Pull the image from the standard registry
- name: Pull the image from the registry
command: podman pull localhost:9000/test/image
- name: Print list of images
@ -46,9 +46,9 @@
register: result
failed_when: result.rc != 125
- name: Stop the standard registry
- name: Stop the registry
shell:
cmd: docker-compose -f standard-compose.yaml down
cmd: docker-compose down
chdir: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry/playbooks/functional-test"
- name: Clean up podman volumes

View File

@ -1,14 +0,0 @@
registry:
address: '0.0.0.0'
port: 9000
public-url: https://localhost:9000
tls-cert: /tls/cert.pem
tls-key: /tls/cert.key
secret: test_token_secret
users:
- name: testuser
pass: testpass
access: write
storage:
driver: filesystem
root: /storage

View File

@ -320,7 +320,7 @@ class RegistryServer:
route_map = cherrypy.dispatch.RoutesDispatcher()
api = RegistryAPI(self.store,
self.conf.get('namespaced', False),
False,
authz)
cherrypy.tools.check_auth = authz