Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

kevinrizza
Copy link
Member

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

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
@ecordell
Copy link
Contributor

ecordell commented Dec 17, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 17, 2020
@kevinrizza
Copy link
Member Author

@sttts @smarterclayton Can I get a quick review on this? It's needed for this oc bz:

openshift/oc#673

@ecordell
Copy link
Contributor

ecordell commented Jan 5, 2021

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ecordell, kevinrizza
To complete the pull request process, please assign smarterclayton after the PR has been reviewed.
You can assign the PR to them by writing /assign @smarterclayton in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jianzhangbjz
Copy link

/cc

@jianzhangbjz
Copy link

/assign @smarterclayton

@deads2k
Copy link
Contributor

deads2k commented Jan 6, 2021

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.

@ecordell
Copy link
Contributor

ecordell commented Jan 8, 2021

@dmage
Copy link
Member

dmage commented Jan 12, 2021

/hold

Name should always be set. quay.io is a shorthand for docker.io/library/quay.io, i.e. quay.io in this case should be placed into Name.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 12, 2021
@ecordell
Copy link
Contributor

@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 quay.io is really docker.io/library/quay.io then we have no option to force the parser to read quay.io as quay.io.

But if quay.io is incorrectly assumed to be quay.io when it should be docker.io/library/quay.io, you then have the option to fully specify the name as an escape hatch.

(not the mention all the caveats around configurable default registry names).

@dmage
Copy link
Member

dmage commented Jan 12, 2021

@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:

From: "rocket.chat",
String: "rocket.chat"

This image reference should be parseable and OpenShift should understand it as docker.io/library/rocket.chat (assuming docker.io is used as a default registry).

@@ -217,6 +213,15 @@ func (r DockerImageReference) Exact() string {
if len(r.Namespace) != 0 {
s += r.Namespace + "/"
Copy link
Contributor

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)

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 9, 2021
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 8, 2021
@openshift-bot
Copy link

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 8, 2021

@openshift-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

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.

@openshift-ci openshift-ci bot closed this Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants