Bug 1987257 - Go-http-client user-agent being used for oc adm mirror requests
Summary: Go-http-client user-agent being used for oc adm mirror requests
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.8
Hardware: All
OS: All
Target Milestone: ---
: 4.10.0
Assignee: Maciej Szulik
QA Contact: zhou ying
: 1987260 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2021-07-29 10:54 UTC by Timothy Rees
Modified: 2022-12-08 10:28 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: User agent string incorrect in some mirror requests Consequence: The default Go user agent string is used instead of the user agent string for oc Fix: Set the correct user agent string for all mirror requests Result: The expected oc user agent string is now sent to registries
Clone Of:
Last Closed: 2022-03-11 18:15:11 UTC
Target Upstream Version:

Attachments (Terms of Use)
Kibana screenshot for quay.io logs (717.20 KB, image/png)
2021-07-29 10:54 UTC, Timothy Rees
no flags Details

System ID Private Priority Status Summary Last Updated
Github openshift oc pull 915 0 None None None 2021-09-01 00:50:51 UTC

Description Timothy Rees 2021-07-29 10:54:24 UTC
Created attachment 1807043 [details]
Kibana screenshot for quay.io logs

Created attachment 1807043 [details]
Kibana screenshot for quay.io logs

Description of problem:

oc command is inconsistent with user-agent when making requests to registries for mirroring OCP4 core payload.  There was an attempt to address this with https://github.com/openshift/oc/pull/841 , but it has only caught one of the 2 registry requests which show in quay.io logs.

Attached is the screenshot for 2 log entries which are created on quay.io when oc adm mirror is run, along with the kibana json outputs for each request.

Command which I ran:

oc adm release mirror -a ${LOCAL_SECRET_JSON} \

Environment vars:
export OCP_RELEASE=4.8.2
export LOCAL_REGISTRY="registry.redacted.com"
export LOCAL_REPOSITORY=trees/openshift48
export PRODUCT_REPO='openshift-release-dev'
export LOCAL_SECRET_JSON='/Users/trees/tmp/secret.json'
export RELEASE_NAME="ocp-release"
export ARCHITECTURE="x86_64"

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

oc 4.8.2

How reproducible:


Steps to Reproduce:
1.  Run oc adm mirror per the openshift docs
2.  Verify on the logs for the container registry (quay.io) the user-agent used

Actual results:

First log entry for user-agent is 'Go-http-client/2.0'
Second log entry for user-agent is 'oc/4.8.0 (darwin/amd64) kubernetes/1077b05'

Expected results:

Both log entries for user-agent is 'oc/4.8.0 (darwin/amd64) kubernetes/1077b05'

Comment 3 Maciej Szulik 2021-08-19 14:07:27 UTC
Ross I did some initial changes in https://github.com/openshift/oc/pull/841 but Tim claims there's one more edge case not covered.

Comment 9 Arda Guclu 2022-12-08 10:28:54 UTC
*** Bug 1987260 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.