Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1952738

Summary: image-serve unable to work without namespace for images (usage with satellite)
Product: Red Hat OpenStack Reporter: Michele Valsecchi <mvalsecc>
Component: tripleo-ansibleAssignee: RHOS Maint <rhos-maint>
Status: CLOSED DUPLICATE QA Contact: Joe H. Rahme <jhakimra>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16.1 (Train)CC: tkajinam
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-23 02:49:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michele Valsecchi 2021-04-23 02:39:37 UTC
Description of problem:

undercloud image-serve is unable to serve image pulled from satellite

Version-Release number of selected component (if applicable):

tripleo-ansible-0.5.1-1.20201114030848.2.el8ost.noarch

How reproducible:

100%

Steps to Reproduce:
1. Use satellite to pull the containers
2. run  `sudo openstack tripleo container image prepare -e ~/containers-prepare-parameter.yaml` as per guide [3]
3. Install the undercloud
4. running `sudo openstack tripleo container image list ` will not return  the images
5. Note the 404 errors in image-serve logs
~~~
HEAD /v2/<[org]-[environment]-[content view]-[product]>-osp16_1_containers-openstack-ironic-conductor/blobs/sha256:505209649de3925b2fd4b70634942756afb5719a953414d5db57d9520dbabe07 # see [4]
~~~

Actual results:

- image-serve is unable to work properly if no namespace is set... and satellite does not have any

from [2]
~~~
Satellite server does not have an actual namespace in the url so the
container location is just host/container:tag. We need to be able to
properly set the headers on blobs without namespaces.

Change-Id: Ia6728d68305ba3c662e99ea067b4d4feef9eeea0
Related-Bug: #1913782
~~~

- Reason: latest RH rpm[1] does not include commit [2]

Expected results:

- undercloud image-serve should be able to serve images that are not in a namespace 

AI: Backport downstream commit [2]

Additional info:


FAIL example:
===
sudo ls /var/lib/image-serve/v2/* (when Satellite is used)
----------------------------------
/var/lib/image-serve/v2/_catalog
/var/lib/image-serve/v2/index.json

/var/lib/image-serve/v2/xxx-openstack-cron: <=== no namespace
blobs
manifests
tags

/var/lib/image-serve/v2/xxx-openstack-glance-api:
blobs
manifests
tags

SUCCESS example :
===
sudo ls /var/lib/image-serve/v2/* (when registry.redhat.io is used)
---------------------------------
/var/lib/image-serve/v2/_catalog  
/var/lib/image-serve/v2/index.json

/var/lib/image-serve/v2/rhosp-rhel8: <=== "rhosp-rhel8" is the namespace
openstack-aodh-api   

Apache (current) settings

~~~
...
    <LocationMatch "^/v2/.*/.*/blobs/sha256:.*$"> <== this needs a folder (i.e. namespace folder) to match
        SetEnvIf Request_URI "sha256:(.*)$" digest=sha256:$1
        Header set Docker-Content-Digest "%{digest}e"
        Header set ETag "%{digest}e"
        Header set Cache-Control "max-age=31536000"
        Header set Content-Type "application/octet-stream"
    </LocationMatch>
...
~~~

Apache settings with said commit backported 
~~~
    <LocationMatch "^/v2/.*/blobs/sha256:.*$"> <== this will match also match no-namespace case
        SetEnvIf Request_URI "sha256:(.*)$" digest=sha256:$1
        Header set Docker-Content-Digest "%{digest}e"
        Header set ETag "%{digest}e"
        Header set Cache-Control "max-age=31536000"
        Header set Content-Type "application/octet-stream"
    </LocationMatch>
~~~


[1] https://access.redhat.com/downloads/content/rhel---8/x86_64/9895/tripleo-ansible/0.5.1-1.20201114030848.2.el8ost/noarch/fd431d51/package-changelog
[2] https://github.com/openstack/tripleo-ansible/commit/bb797d940914c8ea971b55bd468385561c82f44b
[3] https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.1/html/director_installation_and_usage/preparing-for-director-installation#container-image-preparation-parameters
[4] https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.1/html/director_installation_and_usage/preparing-for-director-installation#preparing-a-satellite-server-for-container-images

Comment 1 Takashi Kajinami 2021-04-23 02:49:08 UTC

*** This bug has been marked as a duplicate of bug 1919445 ***