New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DockerImageReference String() fix #973
Conversation
Currently, the internal DockerImageReference type does not return the correct response when only the image name and not Registry field is set. It should return the Registry and Namespace even when name is not set This commit introduces a fix for the Exact() method called by String() to properly return the Registry + Namespace
/lgtm |
@sttts @smarterclayton Can I get a quick review on this? It's needed for this oc bz: |
/approve |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ecordell, kevinrizza The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cc |
/assign @smarterclayton |
Let's get fake bumps in openshift/openshift-apiserver and openshift/openshift-controller-manager and openshift/image-registry with this change and then get one of the image guys to weigh in. My memory is that the image code here is used in those three places. |
/hold Name should always be set. |
@dmage This PR didn't change that behavior, though an earlier one did. This was originally done for "bare" parsing of a registry name for re-homing a collection of images under a new registry (common in disconnected mirroring). To me that seems like the right assumption to make - if we always assume But if (not the mention all the caveats around configurable default registry names). |
@ecordell can you elaborate on re-homing? After this change, output of String() is not always understandable by Parse(). This is not desirable behavior. And it is incompatible with Docker/skopeo, please add one more test:
This image reference should be parseable and OpenShift should understand it as |
@@ -217,6 +213,15 @@ func (r DockerImageReference) Exact() string { | |||
if len(r.Namespace) != 0 { | |||
s += r.Namespace + "/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If name is not set, appending this slash is also not correct.
however, to Oleg’s point there should never be a scenario where name is empty but namespace is, because in that case name should be set to namespace. And likewise we can’t trust only registry because some registry values can be valid names (localhost:8080 is a valid name + tag)
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
Stale issues rot after 30d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle rotten |
Rotten issues close after 30d of inactivity. Reopen the issue by commenting /close |
@openshift-bot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Currently, the internal DockerImageReference type does not return the
correct response when only the image name and not Registry field is set.
It should return the Registry and Namespace even when name is not set
This commit introduces a fix for the Exact() method called by String()
to properly return the Registry + Namespace