-
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
deployapi: Refactor internal objects to match versioned #6246
deployapi: Refactor internal objects to match versioned #6246
Conversation
wip because tests need to be updated |
The usage changes look pretty straightforward. |
return nil | ||
} | ||
|
||
func convert_v1beta3_DeploymentConfigSpec_To_api_DeploymentConfigSpec(in *DeploymentConfigSpec, out *newer.DeploymentConfigSpec, s conversion.Scope) error { |
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 really close to what the generator would produce. Can you highlight the difference for me?
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's because I have a bachelor on conversion now. Will do.
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, actually all this code is here because we were doing manual conversion from the internal to out and vice versa. After running the generator though, all the conversions have been updated with these conversions. So should I drop manual? @ironcladlou ?
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.
It's hard for me to keep up with the API conversion stuff in between the times I'm actually working on the API, so at this point I have no reason to believe the manual stuff is necessary. I'd stick with the generator by default unless a problem arises...
[test] |
@@ -143,24 +206,6 @@ func convert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImage | |||
if err := s.Convert(&in.From, &out.From, 0); err != nil { | |||
return err | |||
} | |||
switch in.From.Kind { |
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.
Do we know for sure it's okay to stop supporting ancient triggers stored with those kinds?
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 kinds are still copied as part of the object reference. This part seems to be for populating the deprecated internal fields (RepositoryName and 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.
I am going over the generated conversions and they seem to be covering all of the manual so I'll probably remove these.
@ironcladlou we currently require the name of an object (imagestream, istag) in Also do we still support imageRepository kinds? |
Another thing regarding |
How about reusing ValidateImageStreamName? |
I don't think so. @smarterclayton? Ultimately I think conversion needs to resolve every possible trigger kind/name to an ImageStream at this point. Agree? |
Yeah, I think that also needs cleaned up. |
We do not. On Thu, Dec 10, 2015 at 10:07 AM, Dan Mace [email protected] wrote:
|
Right now when it's v1->api, we switch istags to is and when it's api->v1, we switch to istags. So image stream references exist only internally. Is there a reason to favor image stream references over istags? I thought the intention was to switch to the latter as buildConfigs do. |
I was thinking of a combination between this and SplitImageStreamTag. Something like: name, _, ok := SplitImageStreamTag(toBeValidated)
if !ok {
// append error
}
if ok := ValidateImageStreamName(name); !ok {
// append error
} If we end up switching to istags as default. There is a comment about defaults but the actual default is different. |
Ref issue: #2511 |
Sounds good to me. |
I tried two different ways to verify this on master:
In both cases I see ImageStreamTag afterwards. Went ahead and switched to use only istags - addressing #2511 as part of this api cleanup. |
Finally got a clean unit test run locally. This is ready for reviews @ironcladlou @openshift/api-review |
The image change controller for deployments never cared (prior and after this PR) about the kind of the object reference in the imageChangeParams of an ICT and since so far we allow ImageRepository references in our validation, any DC with ImageRepository set instead of {ImageStream, ImageStreamTag} is working like a charm. The validation changes in this PR break this behavior. Is this ok? Should we make oc status warn about ImageRepository references (and any kind of deprecated references in general)? |
What does it actually do? Does it treat it as an ImageStream? |
Yes. |
Seems like there's a reasonable case for silently coercing it. Why would we want to support returning the old value from a GET? Do old clients not handle both? |
All green here. Two outstanding issues:
|
Correct me if I'm wrong but we've been storing the original Kind values (which could include ImageStream or even DockerImage) even though we do conversions on the other fields. So we do need to support dealing with the old stored Kinds, but I don't know that we need to accept anything but ImageStreamTag through the API... @deads2k @liggitt? |
ImageRepository kinds still have to be supported in triggers until you On Mon, Dec 14, 2015 at 9:31 AM, Michail Kargakis [email protected]
|
@deads2k func TestDCPodTemplateSpecNode(t *testing.T) {
// other stuff
edges := g.Edges()
// other stuff
if edges[0].From().ID() != dcNode.ID() {
t.Errorf("expected %v (id: %d), got %v (id: %d)", dcNode, dcNode.ID(), edges[0].From(), edges[0].From().ID())
t.Errorf("EDGES: %v", edges)
}
podTemplateNode := edges[0].To()
if _, ok := podTemplateNode.(*kubetypes.PodTemplateSpecNode); !ok {
t.Errorf("expected a PodTemplate from the DC node")
t.Errorf("got %v (id: %d)", edges[0].To(), edges[0].To().ID())
}
podSpecNode := edges[1].To()
if _, ok := podSpecNode.(*kubetypes.PodSpecNode); !ok {
t.Errorf("expected a PodSpec from the PodTemplate node")
t.Errorf("got %v (id: %d)", edges[1].To(), edges[1].To().ID())
}
}
|
I opened #6394 and will refactor the test to just check for the nodes for the time being. |
[test] |
Two "normal" choices:
|
Nice! That topo package is golden. Updated the graph test, PTAL |
lgtm, squash it in for merge. |
|
lgtm [merge] |
flake #6419 [merge] |
imagestreamtag ❄️ |
[merge] |
[merge] |
flake #6065 re[merge] |
again? 👻 [merge] 👻 |
[merge] |
ui flake [merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/4458/) (Image: devenv-rhel7_3020) |
#6149 flake |
[test] |
Evaluated for origin test up to 05e2052 |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/8065/) |
Tests passed at once but this still won't [merge] :') |
Evaluated for origin merge up to 05e2052 |
Merged by openshift-bot
Forked from #6233
@deads2k the PR you asked for.
cc: @ironcladlou @liggitt
TODO:
Fixes #2511