Skip to content

Allow importing tags from ImageStreams pointing to external registries - #4853

Merged
openshift-bot merged 1 commit into
openshift:masterfrom
soltysh:card514
Oct 26, 2015
Merged

openshift-bot merged 1 commit into
openshift:masterfrom
soltysh:card514

Conversation

@soltysh

@soltysh soltysh commented Sep 29, 2015

Copy link
Copy Markdown
Contributor

This is the initial version of improved importer, to address card 514.

@ncdc I know it's bit messy still, I'm working on getting it DRY-ed and most importantly fully tested, still I'd appreciate first raw pass, if this makes sense. The general flow is following:

  1. if no tags are defined import all from default spec
  2. if tags are defined import only the ones defined, both from default spec and from external repos

@pweil- fyi

@ncdc

ncdc commented Sep 29, 2015

Copy link
Copy Markdown
Contributor

cc @pweil- @miminar

Comment thread pkg/image/controller/controller.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/registry/image repository/

@soltysh soltysh changed the title [WIP] platformmanagement_public_514 - Allow importing tags from ImageStreams pointing to external registries Allow importing tags from ImageStreams pointing to external registries Oct 1, 2015
@soltysh

soltysh commented Oct 1, 2015

Copy link
Copy Markdown
Contributor Author

I'm done with the implementation, @ncdc ptal.

Comment thread pkg/image/controller/controller.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/no provided/not provided/

@soltysh

soltysh commented Oct 5, 2015

Copy link
Copy Markdown
Contributor Author

@ncdc comments addressed and reorganized the code per your suggestion. ptal.

[test] in the mean time.

Comment thread pkg/image/api/v1beta3/types.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if true consider this tag a reference only and do not attempt to import metadata about the image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@ncdc

ncdc commented Oct 6, 2015

Copy link
Copy Markdown
Contributor

I will review this tomorrow morning when I'm back from PTO.

Comment thread pkg/image/controller/controller.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer the case where it should terminate an import. Instead, you need to make as much progress as possible and then fail at the end. It would be better to accumulate errors and continue. c.done() should not be invoked in this loop. This iteration of the loop should be extracted into a function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have any reasonable error handling for IS. Do we want to use
events for that or you're talking about just logging errors here? I agree
we should process as much as possible, but still we want to inform user
about import problems in a reasonable way.
On Oct 6, 2015 8:51 PM, "Clayton Coleman" [email protected] wrote:

In pkg/image/controller/controller.go
#4853 (comment):

  •   var dockerImage *dockerregistry.Image
    
  •   if image, ok := retrieved[ref.ID]; ok {
    
  •       dockerImage = image
    
  •   } else {
    
  •       // TODO insecure applies to the stream's spec.dockerImageRepository, not necessarily to an external one!
    
  •       conn, err := client.Connect(ref.Registry, insecure)
    
  •       if err != nil {
    
  •           return err
    
  •       }
    
  •       if len(ref.ID) > 0 {
    
  •           dockerImage, err = conn.ImageByID(ref.Namespace, ref.Name, ref.ID)
    
  •       } else {
    
  •           dockerImage, err = conn.ImageByTag(ref.Namespace, ref.Name, ref.Tag)
    
  •       }
    
  •       switch {
    
  •       case dockerregistry.IsRepositoryNotFound(err), dockerregistry.IsRegistryNotFound(err):
    

This is no longer the case where it should terminate an import. Instead,
you need to make as much progress as possible and then fail at the end. It
would be better to accumulate errors and continue. c.done() should not be
invoked in this loop. This iteration of the loop should be extracted into a
function.

—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/4853/files#r41306035.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do, it goes in the annotation. But you don't even need to do more than
report the first error.

On Tue, Oct 6, 2015 at 5:36 PM, Maciej Szulik [email protected]
wrote:

In pkg/image/controller/controller.go
#4853 (comment):

  •   var dockerImage *dockerregistry.Image
    
  •   if image, ok := retrieved[ref.ID]; ok {
    
  •       dockerImage = image
    
  •   } else {
    
  •       // TODO insecure applies to the stream's spec.dockerImageRepository, not necessarily to an external one!
    
  •       conn, err := client.Connect(ref.Registry, insecure)
    
  •       if err != nil {
    
  •           return err
    
  •       }
    
  •       if len(ref.ID) > 0 {
    
  •           dockerImage, err = conn.ImageByID(ref.Namespace, ref.Name, ref.ID)
    
  •       } else {
    
  •           dockerImage, err = conn.ImageByTag(ref.Namespace, ref.Name, ref.Tag)
    
  •       }
    
  •       switch {
    
  •       case dockerregistry.IsRepositoryNotFound(err), dockerregistry.IsRegistryNotFound(err):
    

We don't have any reasonable error handling for IS. Do we want to use
events for that or you're talking about just logging errors here? I agree
we should process as much as possible, but still we want to inform user
about import problems in a reasonable way.
… <#1503f1535551d805_>
On Oct 6, 2015 8:51 PM, "Clayton Coleman" [email protected]
wrote: In pkg/image/controller/controller.go <
https://github.com/openshift/origin/pull/4853#discussion_r41306035>: > +
var dockerImage *dockerregistry.Image > + if image, ok :=
retrieved[ref.ID]; ok { > + dockerImage = image > + } else { > + // TODO
insecure applies to the stream's spec.dockerImageRepository, not
necessarily to an external one! > + conn, err :=
client.Connect(ref.Registry, insecure) > + if err != nil { > + return err >

  • } > + if len(ref.ID) > 0 { > + dockerImage, err =
    conn.ImageByID(ref.Namespace, ref.Name, ref.ID) > + } else { > +
    dockerImage, err = conn.ImageByTag(ref.Namespace, ref.Name, ref.Tag) > + }

—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/4853/files#r41325904.

@0xmichalis

Copy link
Copy Markdown
Contributor

Is this ready for review @soltysh ?

@soltysh

soltysh commented Oct 17, 2015

Copy link
Copy Markdown
Contributor Author

I'm closing and reopening to kick travis, I'll also kick the jenkins to have it retested. All of the failures are passing on my local machine.

@soltysh

soltysh commented Oct 20, 2015

Copy link
Copy Markdown
Contributor Author

This seems to fail only with hack/test-end-to-end-docker.sh, the local version works as expected. Let's give a jenkins another try.

@soltysh
soltysh force-pushed the card514 branch 2 times, most recently from 85f449a to 5d8530f Compare October 20, 2015 17:32
@soltysh

soltysh commented Oct 20, 2015

Copy link
Copy Markdown
Contributor Author

I had to use ParseDockerImageReference instead of the initial DockerImageReferenceForStream in getTags method. ParseDockerImageReference was used in the original implementation, whereas the other one came from a discussion with @ncdc.

@soltysh

soltysh commented Oct 20, 2015

Copy link
Copy Markdown
Contributor Author

re-[test] the errors are flake, I can't repro locally.

@smarterclayton

Copy link
Copy Markdown
Contributor

The test failure in hack/test-cmd.sh may be your changes. Can you run it on a loop on your laptop and verify it completes? Did not see that failure before your changes.

@soltysh

soltysh commented Oct 21, 2015

Copy link
Copy Markdown
Contributor Author

@smarterclayton I can't reproduce the error from hack/test-cmd.sh, it's working ok, I'll try to run that in the loop as you proposed, though. What worries me more is the hack/test-end-to-end-docker.sh which runs perfectly ok as hack/test-end-to-end.sh but the docker version fails on AWS. I'm working on it... stilll...

@soltysh

soltysh commented Oct 21, 2015

Copy link
Copy Markdown
Contributor Author

@smarterclayton I figured out what is causing this problem. Due to my changes in the import the time needed for importing the image is a bit longer than previously. This infects the flow in registry, where if IS is missing upon ISM creation we create new IS and right after that ISM, which is getting version mismatch error: Error creating image stream mapping: imageStream \"ruby-20-centos7\" cannot be updated: the object has been modified; please apply your changes to the latest version and try again. I've talked with @miminar and @ncdc I'm working on adding a retry to the ISM creation, that should solve our problem.

@soltysh

soltysh commented Oct 22, 2015

Copy link
Copy Markdown
Contributor Author

I'm waiting for #5301 to land and then I'll rebase to catch the solution to failing tests in this PR.

@openshift-bot openshift-bot removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 22, 2015
@soltysh

soltysh commented Oct 26, 2015

Copy link
Copy Markdown
Contributor Author

Rebased to pick up the solution to failing tests.

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to e496c31

@soltysh

soltysh commented Oct 26, 2015

Copy link
Copy Markdown
Contributor Author

Finally, 👊 upon having 2 LGTMs:
[merge]

@pweil-

pweil- commented Oct 26, 2015

Copy link
Copy Markdown

🎉 🎈 🍰

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to e496c31

openshift-bot pushed a commit that referenced this pull request Oct 26, 2015
@openshift-bot
openshift-bot merged commit a410188 into openshift:master Oct 26, 2015
@soltysh
soltysh deleted the card514 branch October 27, 2015 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants