-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Fix imagestream bugs #20666
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
Fix imagestream bugs #20666
Conversation
|
/assign bparees |
|
/retest |
| sort.Sort(sort.Reverse(sort.IntSlice(tagsToRemove))) | ||
| for _, objIndex := range tagsToRemove { | ||
| objects = append(objects[:objIndex], objects[objIndex+1:]...) | ||
| } |
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.
this looks overly cute (and is probably incorrect. each time you change objects, objIndex becomes invalid for the next reference). Just iterate the original list and copy the ones that aren't in "tagsToRemove" into a new list.
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.
updated in current push
| } | ||
| if len(r.ObjectName) > 0 { | ||
| return "" | ||
| } |
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.
??
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.
updated in current push
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.
still here, still not clear why?
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.
regressed, will be removed in next push
pkg/oc/lib/newapp/cmd/newapp.go
Outdated
|
|
||
| objectsToKeep := app.Objects{} | ||
| for i, obj := range objects { | ||
| if _, ok := objectsToRemove[i]; ok { |
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.
why not just key objectsToRemove by the "namespace/name" value?
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.
(that would seem less fragile to me)
|
@bparees ptal, comments have been addressed |
|
/retest |
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: istname, | ||
| Annotations: map[string]string{"openshift.io/imported-from": r.Reference.Exact()}, | ||
| Namespace: r.SuggestNamespace(), |
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.
why is this no longer needed? it seems like a useful disambiguation.
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.
setting namespace in another function to c.OriginNamespace if one doesn't exist
pkg/oc/lib/newapp/cmd/newapp.go
Outdated
| istNamespace = c.OriginNamespace | ||
| } | ||
| streamName, tagName, ok := imageapi.SplitImageStreamTag(ist.Name) | ||
| if ok { |
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.
needs to do something(throw an error?) if !ok
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.
updated in next push
| if ist, ok := obj.(*imageapi.ImageStreamTag); ok { | ||
| istNamespace := ist.Namespace | ||
| if len(istNamespace) == 0 { | ||
| istNamespace = c.OriginNamespace |
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.
i guess this is why/how you got rid of the suggestnamespace logic.
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.
correct.
test/cmd/newapp.sh
Outdated
| os::cmd::expect_failure 'oc get dc/php' | ||
| os::cmd::expect_success_and_text 'oc new-app -f test/testdata/template-without-app-label.json -o yaml' 'app: ruby-helloworld-sample' | ||
|
|
||
| # remove duplicate imagestream tags before creating objects |
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.
how is this testing that?
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.
updated in current push
|
existing imagestreams/tags: scenarios: that's the sort of scenarios i'd expect to see test coverage for (and anything else you've stumbled across while working on this). i'd expect them to be well defined and more explicit than what you currently have. |
|
@bparees ptal, updates tests, hopefully that is more what you are looking for. |
test/cmd/newapp.sh
Outdated
| os::cmd::expect_success_and_text 'oc new-app openshift/ruby-22-centos7 https://github.com/openshift/ruby-hello-world --strategy=docker --loglevel=5' 'Removing duplicate tag from object list: myproject/ruby-22-centos7:latest' | ||
| os::cmd::expect_success 'oc delete all -l app=ruby-22-centos7' | ||
|
|
||
| # create imagestreams in the correct 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.
why would this invocation create an imagestream at all?
test/cmd/newapp.sh
Outdated
| # should succeed and create the php:latest tag in the current namespace | ||
| os::cmd::expect_success 'oc new-app --docker-image=library/php https://github.com/sclorg/cakephp-ex --strategy=source' | ||
| os::cmd::try_until_success 'oc get imagestreamtag php:latest -n test-imagestreams' | ||
| os::cmd::expect_success 'oc create imagestreamtag php:latest -n openshift' |
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.
this is valid? what does it do? (what does php:latest point to?)
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.
fixed in next push
test/cmd/newapp.sh
Outdated
| os::cmd::expect_success 'oc create imagestreamtag php:latest -n openshift' | ||
|
|
||
| # create a new tag for an existing imagestream in the current namespace | ||
| os::cmd::expect_success 'oc create imagestreamtag perl:5.0' |
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.
same question here
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.
fixed in next push
| os::cmd::try_until_success 'oc get imagestreamtag perl:latest -n test-imagestreams' | ||
|
|
||
| # remove redundant imagestream tag before creating objects | ||
| os::cmd::expect_success_and_text 'oc new-app openshift/ruby-22-centos7 https://github.com/openshift/ruby-hello-world --strategy=docker --loglevel=5' 'Removing duplicate tag from object list' |
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.
what redundant tag is being removed? I would expect this invocation to create a new imagetream named "ruby-22-centos7" with a tag named "latest" pointing to the image "docker.io/openshift/ruby-22-centos7:latest", in the current 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.
Based on bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1612723
Command output: Removing duplicate tag from object list: myproject/ruby-22-centos7:latest
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.
ah, this was the case where the processing creates both the imagestreamtag and the imagestream containing the tag?
|
|
||
| # create imagestream in the correct namespace | ||
| os::cmd::expect_success 'oc new-app --name=mytest --image-stream=mysql --env=MYSQL_USER=test --env=MYSQL_PASSWORD=redhat --env=MYSQL_DATABASE=testdb -l app=mytest' | ||
| os::cmd::try_until_success 'oc get is mytest -n test-imagestreams' |
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.
why would this create an imagestream? you asked new-app to create an app based on an existing imagestream (named mysql, located in either this namespace or the openshift namespace). I wouldn't expect it to ever create an imagestream though (you haven't pointed to an image, so what image would the imagestream reference?)
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.
I have based this test off of this bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1611462
This command was trying to create the imagestream in the openshift namespace, now it creates it in the users namespace (and it does create an imagestream)
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.
hm. it's odd to me that new-app creates a new imagestream in this scenario (rather than pointing the openshift/mysql imagestream) but i guess it's one of the many mysteries of new-app.
test/cmd/newapp.sh
Outdated
|
|
||
| # don't create an unnecessary imagestream | ||
| os::cmd::expect_success 'oc new-app https://github.com/sclorg/nodejs-ex' | ||
| os::cmd::expect_failure_and_text 'oc get is nodejs:10 -n test-imagestreams' 'not found' |
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.
the imagestream name (if created) would be nodejs, nodejs:10 is an istag name. actually it might be "nodejs-ex" too.
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.
updated in next push
| os::cmd::expect_success 'oc project cmd-newapp' | ||
| os::cmd::expect_success 'oc delete project test-imagestreams' | ||
|
|
||
| # end imagestream/tag creation and reuse |
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.
where's the test that ensures that if you've already got a "nodejs" imagestream in the current namespace, but it doesn't contain a "nodejs:10" tag, the "nodejs:10" tag is added to the existing "nodejs" imagestream and you don't get an error trying to create a new "nodejs" imagestream?
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.
restored in next push
| os::cmd::expect_success "oc new-build -D $'FROM node:8\nRUN echo \"Test\"' --name=node8" | ||
| os::cmd::try_until_success 'oc get imagestreamtags node:8' | ||
| os::cmd::expect_success "oc new-build -D $'FROM node:10\nRUN echo \"Test\"' --name=node10" | ||
| os::cmd::try_until_success 'oc get imagestreamtags node:10' |
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.
per my comment above, i think these 4 lines should be retained/restored. I don't think this behavior is covered/tested in what you have above.
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.
restored in next push
|
@bparees updated per your comments, also responded to your comments about specific sections and why they are there |
|
/retest |
|
/refresh |
|
/retest |
bparees
left a comment
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.
one more question/comment and then i think this will be good to go
test/cmd/newapp.sh
Outdated
|
|
||
| # don't create an unnecessary imagestream | ||
| os::cmd::expect_success 'oc new-app https://github.com/sclorg/nodejs-ex' | ||
| os::cmd::expect_failure_and_text 'oc get istag node:10 -n test-imagestreams' 'not found' |
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.
should this be "nodejs:10"? "nodejs" is the name of the imagestream in openshift, at least.
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.
also should probably just look for the "nodejs" imagestream (the imagestream shouldn't be created at all, right?), not a specific tag.
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.
fixed in current push
|
@bparees updated per your comment |
|
/refresh |
|
/retest |
|
@bparees ptal |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bparees, coreydaley The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@bparees @coreydaley any chance we could have this PR wait for #20645? It definitely overlaps with this one and I'd like to avoid having to rebase that if at all possible |
|
/hold Would like to wait for a response to above comment |
|
@juanvallejo this fixes two bugs for QE, how soon will your PR go in? |
Just need to get tests passing for it, will try to have it mergeable by end of day today. If I encounter any problems between now and end of day that might delay it from merging any longer, I'll just go ahead and unhold this one and take the rebase on mine |
|
ok
…On Mon, Aug 20, 2018 at 3:28 PM, Juan Vallejo ***@***.***> wrote:
@bparees <https://github.com/bparees>
this fixes two bugs for QE, how soon will your PR go in?
Just need to get tests passing for it, will try to have it mergeable by
end of day today. If I encounter any problems between now and end of day
that might delay it from merging any longer, I'll just go ahead and unhold
this one and take the rebase on mine
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#20666 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEvl3gRAubrsMMDLCSOOtMulP6rpmUKqks5uSw3zgaJpZM4V_Pzh>
.
--
Ben Parees | OpenShift
|
|
/hold cancel Will keep working on my PR, will rebase since this will most likely merge first |
Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1612723
https://bugzilla.redhat.com/show_bug.cgi?id=1611462