Bug 2227902

Summary: Satellite Capsule clamps reply to a max of 100 tags when listing the tags (break RHOSP)
Product: Red Hat Satellite Reporter: Odilon Sousa <osousa>
Component: Container Management - ContentAssignee: Ian Ballou <iballou>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.12.4CC: iballou, osousa, pdudley, rlavi, vsedmik
Target Milestone: 6.12.5Keywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-smart_proxy_container_gateway-1.0.8-1.el8sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2221407 Environment:
Last Closed: 2023-08-24 18:24:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Odilon Sousa 2023-07-31 19:27:21 UTC
+++ This bug was initially created as a clone of Bug #2221407 +++

Description of problem:

We're using Satellite 6.12.4.1 (Satellite + Capsule) to serve RHOSP content (rpms and containers).

I've noticed that the capsule -clamps- the list of tags to 100 and the sonsequence is that this breaks 'openstack undercloud install' and the automation around it.

Version-Release number of selected component (if applicable):
6.12.4.1 on RHEL8.8

How reproducible:
100%

Steps to Reproduce:
1. Add RHOSP16 container repos to a satellite CV, promote and sync to the capsule.
2. List the container tags from the Satellite + Capsule.
3. All of the replies from the capsule are clamped to '100'.

* Satellite:
# skopeo list-tags docker://w0617ialabrhsat01.iaas.tdlab.ca:443/test-openstack-test_osp16-nfvi-evo-osp16-nfvi-evo-osp16-openstack-nova-api|grep '16\.[0-9]'|wc -l
102
# skopeo list-tags docker://w0617ialabrhsat01.iaas.tdlab.ca:443/test-openstack-test_osp16-nfvi-evo-osp16-nfvi-evo-osp16-openstack-nova-compute-ironic|grep '16\.[0-9]'|wc -l
112


* Capsule:
# skopeo list-tags docker://satellite-capsule01.maas:443/test-openstack-test_osp16-nfvi-evo-osp16-nfvi-evo-osp16-openstack-nova-api|grep '16\.[0-9]'|wc -l
100
# skopeo list-tags docker://satellite-capsule01.maas:443/test-openstack-test_osp16-nfvi-evo-osp16-nfvi-evo-osp16-openstack-nova-compute-ironic|grep '16\.[0-9]'|wc -l
100

--- Additional comment from  on 2023-07-08T23:01:59Z 

The issue here is on Capsules only. On Satellite, the results seem to be retrieved by Foreman from it's own DB. On a Capsule that doesn't exist so foreman-proxy asks Pulp to return the list. Once there the request for tags/list defines this `pagination_class = ContainerTagListPagination`, which just loops back to `api_settings.PAGE_SIZE:`, and we can find this in;
~~~
[root@capsule1 ~]# grep PAGE_SIZE /usr/lib/python3.9/site-packages/pulpcore/app/settings.py
    "PAGE_SIZE": 100,
~~~

You can see there Pulp defaults to returning 100 lines per page, and we need to increase that to get beyond this problem, at least temporarily.

--- Additional comment from  on 2023-07-10T13:13:41Z 

The fix can likely be to introduce paging here: https://github.com/Katello/smart_proxy_container_gateway/blob/main/lib/smart_proxy_container_gateway/container_gateway_main.rb#L46

--- Additional comment from  on 2023-07-26T21:42:51Z 

Created redmine issue https://projects.theforeman.org/issues/36616 from this bug

--- Additional comment from  on 2023-07-27T00:03:15Z 

Upstream bug assigned to iballou

--- Additional comment from  on 2023-07-27T00:03:17Z 

Upstream bug assigned to iballou

Comment 1 Bryan Kearney 2023-08-02 16:03:31 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36616 has been resolved.

Comment 2 Vladimír Sedmík 2023-08-08 08:01:47 UTC
Verified in 6.12.5 snap 2 (with rubygem-smart_proxy_container_gateway-1.0.8-1.el8sat.noarch)

Steps:
1) Sync some big container repo to Satellite. (I used jetstack/cert-manager-controller from quay.io which had 821 tags)
2) Register an external Capsule to the Satellite, add to Library LCE and sync it.
3) Using skopeo, list the tags on both instances and compare:
[user@localhost ~]$ skopeo list-tags --tls-verify=false --username=admin --password=toviszejo docker://satellite.redhat.com/bz-2227902-jetstack-jetstack_cert-manager-controller | grep '"' | wc -l
823
[user@localhost ~]$ skopeo list-tags --tls-verify=false --username=admin --password=toviszejo docker://capsule.redhat.com/bz-2227902-jetstack-jetstack_cert-manager-controller | grep '"' | wc -l
823
[user@localhost ~]$ diff <(skopeo list-tags --tls-verify=false --username=admin --password=toviszejo docker://satellite.redhat.com/bz-2227902-jetstack-jetstack_cert-manager-controller | sort) \
> <(skopeo list-tags --tls-verify=false --username=admin --password=toviszejo docker://capsule.redhat.com/bz-2227902-jetstack-jetstack_cert-manager-controller | sort)
608c608
<     "Repository": "satellite.redhat.com/bz-2227902-jetstack-jetstack_cert-manager-controller",
---
>     "Repository": "capsule.redhat.com/bz-2227902-jetstack-jetstack_cert-manager-controller",

Expected and actual results:
Both instances provided the same tags, the count was higher than 100 and matched the expected tags count.

Note:
The `wc -l` gave two more since we got these two extra lines, which is expected:
   "Repository": "capsule.redhat.com/bz-2227902-jetstack-jetstack_cert-manager-controller",
   "Tags": [

Comment 7 errata-xmlrpc 2023-08-24 18:24:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Satellite 6.12.5 Async Update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:4749