-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
add imagestream refs for custom and docker strategies #1693
Conversation
[test] |
@smarterclayton so i'm adding objectrefs for imagestreams to docker and custom strategies (to align with STI strategy). i know we talked about using imagestreamtags for all this at some point...do you have a problem proceeding with this for now and coming back around to use imagestreamtags? alternatively, are we in a position where it makes sense for me to switch all this to imagestreamtags? is it a large effort? (i'm hoping to jam this change in for beta3) |
It probably would make sense to do this now. We should probably take this code, clean it up a bit so it's more usable to the outside, and export it so you can use it https://github.com/openshift/origin/blob/master/pkg/image/registry/imagestream/strategy.go#L191-L204 |
The rationale being why make 2 changes if you can only make 1 instead? |
@ncdc yeah the only reason i'd consider doing this now and that later is to get it in for beta3. if imagestreamtag is easy enough, i'm fine with doing it all in one shot. |
If you do ImageStreamTag, you'll have something like From: &kapi.ObjectReference{
Kind: "ImageStreamTag",
Namespace: "optional",
Name: "mycoolstream:latest",
} You'll have to look up the stream, then call |
sounds easy enough :) |
@ncdc ok I added the resolver and unit tests around it. I agree it could be in a more universal helper location, but we can refactor that later if you're ok with the implementation+tests. @smarterclayton added the conversion we talked about, ptal. |
05159a1
to
b123296
Compare
Realized image change triggers probably need an update for this too, given how we currently do matching. |
@ncdc is it even valid to watch for changes to an ImageStreamTag or an ImageStreamImage? If not, I think ICTs will need to stay as ImageStream references, but it makes the image change trigger story a bit ugly. |
Hrm... It should be possible to watch those.
|
I'll have to add support, but yeah Sent from my iPhone
|
Even without direct support, you could still watch the stream, get the latest event for the tag, and compare docker image refs. Sent from my iPhone
|
And ImageStreamImage is immutable, so it only makes sense to watch the tag Sent from my iPhone
|
Yeah there's some logic in how ICTs work that makes that uglier than it should be (we do some name matching so comparing an imagestream tag ref to an imagestream ref requires extra hoops and might lead us to do the wrong thing.) I'll summarize the situation later. |
ok I thought about it some more and I think we can compare ImageStream[Tag] to ImageStream[Tag] after all.. just requires that if we're comparing an ImageStream to an ImageStreamTag, we first append :latest or :[Tag field value] to the ImageStream name before comparing them. With that logic in place, and assuming we can watch ImageStreamTags along with the current logic to watch ImageStreams, i think we can retain the ICT logic for the most part. Which means we'll continue to trigger builds anytime the thing in your ICT changes, and the build that is triggered may or may not actually use the new image, depending on whether the BuildConfig Strategy From reference actually matches the From of the ICT that fired. |
The nice thing here is that the watch on tag/image can be short circuited to be more efficient.
|
@bparees do you need me to add watch support for ImageStreamTags, or can you live with just watching the stream? |
I think we need watch support on ImageStreamTags ----- Original Message -----
|
Ok, will do. |
ece9425
to
a6f1170
Compare
ok I think this is ready for a look again. i'm punting on handling ICTs for ImageStreamTags for now, but the Strategies do support ImageStream, ImageStreamTag, and ImageStreamImage. And you can have an ICT defined in terms of an ImageStream along with a strategy defined in terms of an ImageStreamTag and things should work. to be honest it's become a bit of a mess to maintain and there's an argument for doing away with all the matching logic and just saying "if you request an ICT, when that ICT fires you get built using that image, regardless of what From/Image/etc your Strategy specified" but I'm still concerned that's giving up a valuable use case. I suppose that use case could be mostly met via webhooks though ("run this build whenever image foo changes, even though this build doesn't directly consume foo") |
@smarterclayton this is failing the serialization_test because it fails roundtripping... we start out with a from reference with no Kind (meaning ImageStream) and return a from reference with a Kind of ImageStreamTag. that's intentional behavior on the part of my converter because we switch to the internal representation of ImageStreamTag and then we can't really know to go back to ImageStream (and for that matter it could have been an ImageRepository reference too, i think...pretty sure it all gets munged into ImageStreamTag) am I doing conversion wrong here, or do we need to be more lenient in our roundtrip tests? |
In your fuzz you just need to constrain the initial state to one that exactly round trips, and make sure in your individual conversion test you verify the round trip is correct for the other values (we don't have any clever "semantic equal" for fuzzing yet, although we should).
|
14b8530
to
ad53c59
Compare
[test] |
@smarterclayton @ncdc jenkins passing finally so i think this is ready for a final review. @Kargakis please take a look at the buildchain changes. I think i simplified it but i may have missed something. |
// namespace or in every namespace | ||
all = true | ||
// all the tags of all the imagestreams across all the namespaces | ||
for _, ns := range namespaces { |
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 would argue that it's better to extract our streams from the build configurations instead of iterating over all available namespaces for two reasons: 1) since we build dep trees based on ICTs, buildConfigs is where we want to look for streams, plus we might end up with more streams in our results than needed (can we have an imageStream around w/o a respective buildConfig?). 2) Searching through buildConfigs seems cheaper (no REST calls) vs GET streams for every namespace. Anyway, if you follow what you are doing right now, you should probably remove getRepos
since it won't be used anymore.
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.
Image streams definitely can exist by themselves.
Sent from my iPhone
On Apr 23, 2015, at 4:46 AM, Michail Kargakis notifications@github.com wrote:
In pkg/cmd/experimental/buildchain/buildchain.go:
@@ -186,14 +189,24 @@ func RunBuildChain(f *clientcmd.Factory, cmd *cobra.Command, args []string) erro
// Set the specified repo as the only one to output dependencies for
repos[repo] = tags
} else {
// Get all image repositories from build configurations
- repos = getRepos(buildConfigList)
// Make sure from now on that the --all flag is true
// since we are building dependency trees for every
// image repository available either in the current
// namespace or in every namespace
all = true
// all the tags of all the imagestreams across all the namespaces
I would argue that it's better to extract our streams from the build configurations instead of iterating over all available namespaces for two reasons: 1) since we build dep trees based on ICTs, buildConfigs is where we want to look for streams, plus we might end up with more streams in our results than needed (can we have an imageStream around w/o a respective buildConfig?). 2) Searching through buildConfigs seems cheaper (no REST calls) vs GET streams for every namespace. Anyway, if you follow what you are doing right now, you should probably remove getRepos since it's won't be used anymore.for _, ns := range namespaces {
—
Reply to this email directly or view it on GitHub.
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.
N calls to the server is going to be slower than 1 in almost every case (even per namespace). The overhead for network is too high.
----- Original Message -----
@@ -186,14 +189,24 @@ func RunBuildChain(f *clientcmd.Factory, cmd
*cobra.Command, args []string) erro
// Set the specified repo as the only one to output dependencies for
repos[repo] = tags
} else {
// Get all image repositories from build configurations
- repos = getRepos(buildConfigList)
// Make sure from now on that the --all flag is true
// since we are building dependency trees for every
// image repository available either in the current
// namespace or in every namespace
all = true
// all the tags of all the imagestreams across all the namespaces
for _, ns := range namespaces {
I would argue that it's better to extract our streams from the build
configurations instead of iterating over all available namespaces for two
reasons: 1) since we build dep trees based on ICTs, buildConfigs is where we
want to look for streams, plus we might end up with more streams in our
results than needed (can we have an imageStream around w/o a respective
buildConfig?). 2) Searching through buildConfigs seems cheaper (no REST
calls) vs GET streams for every namespace. Anyway, if you follow what you
are doing right now, you should probably removegetRepos
since it's won't
be used anymore.
Reply to this email directly or view it on GitHub:
https://github.com/openshift/origin/pull/1693/files#r28945900
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
----- Original Message -----
@@ -186,14 +189,24 @@ func RunBuildChain(f *clientcmd.Factory, cmd
*cobra.Command, args []string) erro
// Set the specified repo as the only one to output dependencies for
repos[repo] = tags
} else {
// Get all image repositories from build configurations
- repos = getRepos(buildConfigList)
// Make sure from now on that the --all flag is true
// since we are building dependency trees for every
// image repository available either in the current
// namespace or in every namespace
all = true
// all the tags of all the imagestreams across all the namespaces
for _, ns := range namespaces {
Image streams definitely can exist by themselves.
Sent from my iPhone
On Apr 23, 2015, at 4:46 AM, Michail Kargakis notifications@github.com
wrote:In pkg/cmd/experimental/buildchain/buildchain.go:
@@ -186,14 +189,24 @@ func RunBuildChain(f *clientcmd.Factory, cmd
*cobra.Command, args []string) erro
// Set the specified repo as the only one to output dependencies for
repos[repo] = tags
} else {
// Get all image repositories from build configurations
- repos = getRepos(buildConfigList)
// Make sure from now on that the --all flag is true
// since we are building dependency trees for every
// image repository available either in the current
// namespace or in every namespace
all = true
// all the tags of all the imagestreams across all the namespaces
I would argue that it's better to extract our streams from the buildfor _, ns := range namespaces {
configurations instead of iterating over all available namespaces for two
reasons: 1) since we build dep trees based on ICTs, buildConfigs is where
we want to look for streams, plus we might end up with more streams in our
results than needed (can we have an imageStream around w/o a respective
buildConfig?). 2) Searching through buildConfigs seems cheaper (no REST
calls) vs GET streams for every namespace. Anyway, if you follow what you
are doing right now, you should probably remove getRepos since it's won't
be used anymore.—
Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHub:
https://github.com/openshift/origin/pull/1693/files#r28956035
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.
You are already making a call per namespace to get the build configs. And you have to, thanks to our security model. (you cannot get all build configs across all visible namespaces.)
We can filter out streams with no dependencies if we want.
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.
We have to get the build configs in any case.
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.
Right, my point is its going from o(n) to o(2n) not from o(1). If we can't make calls per namespace, then we were already broken.
From: Michail Kargakis notifications@github.com
Sent: Apr 23, 2015 5:53 PM
To: openshift/origin
Cc: Ben Parees
Subject: Re: [origin] add imagestream refs for custom and docker strategies (#1693)
@@ -186,14 +189,24 @@ func RunBuildChain(f *clientcmd.Factory, cmd *cobra.Command, args []string) erro
// Set the specified repo as the only one to output dependencies for
repos[repo] = tags
} else {
// Get all image repositories from build configurations
- repos = getRepos(buildConfigList)
// Make sure from now on that the --all flag is true
// since we are building dependency trees for every
// image repository available either in the current
// namespace or in every namespace
all = true
// all the tags of all the imagestreams across all the namespaces
for _, ns := range namespaces {
We have to get the build configs in any case.
Reply to this email directly or view it on GitHub:
https://github.com/openshift/origin/pull/1693/files#r29007517
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.
@smarterclayton @Kargakis i went ahead and reworked this to not make an imagestream call per project, but as noted earlier, we are still (and always have been) making a buildconfig call per namespace because the API will not return "all buildconfigs for all projects I can view" in a single call.
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.
Now that makes me happy:) One more nit, but as are the changes in build-chain LGTM
86f606a
to
4f8d909
Compare
@smarterclayton added more conversion tests, reworked buildchain implementation... anything else? |
ada5017
to
283888b
Compare
@smarterclayton added second commit w/ the changes we discussed today... ptal and i'll squash if you're good with them. |
@smarterclayton the overall design is that the internal representation of a From is always ImageStreamTag or DockerImage now, and From.Name is always of the form "name:tag". I don't remember if we agreed that was a safe assumption, but i'm pretty sure that's what @ncdc had told me (that :tag is not optional on an ImageStreamTag name) I'm less certain about whether ImageStreamImage is being handled correctly everywhere, i'm not even sure if it can be done right until @ncdc 's v2 pull lands. |
Two small comments, then LGTM |
also adds from reference support to docker and custom strategies and updates to use DockerImage kind instead of Image fields internally
----- Original Message -----
Sounds correct mo e.
It probably isn't - the warning just prevents us from forgetting about this forever.
|
added the logging and changed the string compare. pushing merge and sending a note to the mailing lists. |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_openshift3/1719/) (Image: devenv-fedora_1393) |
Evaluated for origin up to 8f01437 |
Merged by openshift-bot
…service-catalog/' changes from b758460ba7..c3e3071633 c3e3071633 origin build: add origin tooling 97ddbab chart changes for v0.1.9 (openshift#1776) b5168a7 Add unit tests for class, instance, plan backends in svcat (openshift#1763) 97d11cb prometheus: only return catalog specific metrics (openshift#1774) 0fb00e3 Bump dependency on go-open-service-broker-client to 0.0.4 (openshift#1775) 0a9f1e4 Reset RemovedFromBrokerCatalog when broker re-adds a removed service class (openshift#1770) 28ec5ed Bump dependency on go-open-service-broker-client to 0.0.3 (openshift#1768) ca83d18 handle binding deletion that occurs during async bind (openshift#1760) 858d467 2 of 4 fixes for golang 1.10 (openshift#1764) 656156b Add unit tests for binding and broker backends in svcat ec05486 In svcat verify service instance exists on unbind (openshift#1750) e6315a4 fix indentation from openshift#1725 (openshift#1759) 62284da Publish svcat binaries during build (openshift#1725) 8f986ae also build with golang tip and allow tip to fail (openshift#1734) 127561e use pvc for etcd volume (openshift#1684) 7d155e5 Ensure only href-checker runs on docs only commit (openshift#1693) 4ea44c4 log the version and build date on server startup (openshift#1746) 0db9519 allow getting and describing plans with class/plan name combo in svcat (openshift#1743) b1da783 print schemas when describing plan in svcat (openshift#1740) 7a7fcce Add constraint for go-open-service-broker-client (openshift#1738) 3070003 Increase timeout for broker condition polling in e2e (openshift#1745) b6878f7 Avoid Setting Authentication header twice (openshift#1685) 5317111 wrap "rm -rf" with docker (openshift#1735) d7c0bf2 Allow upper case letters in Plan names (openshift#1668) 6b27ba6 Add a constraint on go-autorest (openshift#1732) b3de6ec Added validation for ServiceBinding spec ParametersFrom REVERT: b758460ba7 origin build: modify hard coded path REVERT: 871582f73a origin build: add origin tooling git-subtree-dir: cmd/service-catalog/go/src/github.com/kubernetes-incubator/service-catalog git-subtree-split: c3e3071633b91541cf9f1000d2d5115cdd31de1b
…service-catalog/' changes from b758460ba7..c3e3071633 c3e3071633 origin build: add origin tooling 97ddbab chart changes for v0.1.9 (openshift#1776) b5168a7 Add unit tests for class, instance, plan backends in svcat (openshift#1763) 97d11cb prometheus: only return catalog specific metrics (openshift#1774) 0fb00e3 Bump dependency on go-open-service-broker-client to 0.0.4 (openshift#1775) 0a9f1e4 Reset RemovedFromBrokerCatalog when broker re-adds a removed service class (openshift#1770) 28ec5ed Bump dependency on go-open-service-broker-client to 0.0.3 (openshift#1768) ca83d18 handle binding deletion that occurs during async bind (openshift#1760) 858d467 2 of 4 fixes for golang 1.10 (openshift#1764) 656156b Add unit tests for binding and broker backends in svcat ec05486 In svcat verify service instance exists on unbind (openshift#1750) e6315a4 fix indentation from openshift#1725 (openshift#1759) 62284da Publish svcat binaries during build (openshift#1725) 8f986ae also build with golang tip and allow tip to fail (openshift#1734) 127561e use pvc for etcd volume (openshift#1684) 7d155e5 Ensure only href-checker runs on docs only commit (openshift#1693) 4ea44c4 log the version and build date on server startup (openshift#1746) 0db9519 allow getting and describing plans with class/plan name combo in svcat (openshift#1743) b1da783 print schemas when describing plan in svcat (openshift#1740) 7a7fcce Add constraint for go-open-service-broker-client (openshift#1738) 3070003 Increase timeout for broker condition polling in e2e (openshift#1745) b6878f7 Avoid Setting Authentication header twice (openshift#1685) 5317111 wrap "rm -rf" with docker (openshift#1735) d7c0bf2 Allow upper case letters in Plan names (openshift#1668) 6b27ba6 Add a constraint on go-autorest (openshift#1732) b3de6ec Added validation for ServiceBinding spec ParametersFrom REVERT: b758460ba7 origin build: modify hard coded path REVERT: 871582f73a origin build: add origin tooling git-subtree-dir: cmd/service-catalog/go/src/github.com/kubernetes-incubator/service-catalog git-subtree-split: c3e3071633b91541cf9f1000d2d5115cdd31de1b
…service-catalog/' changes from b758460ba7..c3e3071633 c3e3071633 origin build: add origin tooling 97ddbab chart changes for v0.1.9 (openshift#1776) b5168a7 Add unit tests for class, instance, plan backends in svcat (openshift#1763) 97d11cb prometheus: only return catalog specific metrics (openshift#1774) 0fb00e3 Bump dependency on go-open-service-broker-client to 0.0.4 (openshift#1775) 0a9f1e4 Reset RemovedFromBrokerCatalog when broker re-adds a removed service class (openshift#1770) 28ec5ed Bump dependency on go-open-service-broker-client to 0.0.3 (openshift#1768) ca83d18 handle binding deletion that occurs during async bind (openshift#1760) 858d467 2 of 4 fixes for golang 1.10 (openshift#1764) 656156b Add unit tests for binding and broker backends in svcat ec05486 In svcat verify service instance exists on unbind (openshift#1750) e6315a4 fix indentation from openshift#1725 (openshift#1759) 62284da Publish svcat binaries during build (openshift#1725) 8f986ae also build with golang tip and allow tip to fail (openshift#1734) 127561e use pvc for etcd volume (openshift#1684) 7d155e5 Ensure only href-checker runs on docs only commit (openshift#1693) 4ea44c4 log the version and build date on server startup (openshift#1746) 0db9519 allow getting and describing plans with class/plan name combo in svcat (openshift#1743) b1da783 print schemas when describing plan in svcat (openshift#1740) 7a7fcce Add constraint for go-open-service-broker-client (openshift#1738) 3070003 Increase timeout for broker condition polling in e2e (openshift#1745) b6878f7 Avoid Setting Authentication header twice (openshift#1685) 5317111 wrap "rm -rf" with docker (openshift#1735) d7c0bf2 Allow upper case letters in Plan names (openshift#1668) 6b27ba6 Add a constraint on go-autorest (openshift#1732) b3de6ec Added validation for ServiceBinding spec ParametersFrom REVERT: b758460ba7 origin build: modify hard coded path REVERT: 871582f73a origin build: add origin tooling git-subtree-dir: cmd/service-catalog/go/src/github.com/kubernetes-incubator/service-catalog git-subtree-split: c3e3071633b91541cf9f1000d2d5115cdd31de1b
No description provided.