-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix newapp resource convert for extensions and apps groups #15787
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 newapp resource convert for extensions and apps groups #15787
Conversation
pkg/cmd/util/cmd.go
Outdated
// if no preferred version found in the list of given GroupVersions, | ||
// attempt to convert to first GroupVersion that satisfies a preferred version | ||
if len(actualOutputVersion.Version) == 0 { | ||
for _, version := range preferredVersions { |
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 shouldn't even need to do this loop - you should be passing preferredVersions in to ConvertToVersion as a Versioner.
pkg/cmd/util/cmd.go
Outdated
// the given object is guaranteed to be at least part of one group by this point. | ||
if len(preferredVersions) == 0 { | ||
defaultGroupVersion := groups[0].GroupVersion | ||
convertedObject, err := kapi.Scheme.ConvertToVersion(obj, defaultGroupVersion) |
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 should just be passing in groupVersions to ConvertToVersion (you'll need to cast to the runtime schema type which handles Versioner).
Tests. |
/test extended_templates |
/test extended_conformance_gce |
@smarterclayton thanks for the feedback, review comments addressed |
test/cmd/newapp.sh
Outdated
os::cmd::expect_success_and_text 'oc new-app -f examples/prometheus/prometheus.yaml -o yaml' 'apiVersion: apps/v1beta1' | ||
# check that if an --output-version is requested on a list of varying resource kinds, an error is returned if | ||
# at least one of the resource groups does not support the given version | ||
os::cmd::expect_failure_and_text 'oc new-app -f examples/prometheus/prometheus.yaml -o yaml --output-version=v1' 'extensions.Deployment is not suitable for converting' |
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.
Minor comment, make it more defensive against future changes by just checking "not suitable for converting".
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.
Done!
338aad1
to
b9be10f
Compare
/lgtm |
b9be10f
to
385da29
Compare
385da29
to
2f39e7f
Compare
2f39e7f
to
d065082
Compare
Since |
/test unit |
/lgtm |
/approve
…On Mon, Aug 21, 2017 at 10:51 AM, OpenShift Merge Robot < ***@***.***> wrote:
[APPROVALNOTIFIER] This PR is *NOT APPROVED*
This pull-request has been approved by: *fabianofranz
<#15787 (comment)>*, *juanvallejo
<#15787#>*
We suggest the following additional approver: *smarterclayton*
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
<https://github.com/kubernetes/test-infra/blob/master/commands.md>.
Needs approval from an approver in each of these OWNERS Files:
- pkg/cmd/OWNERS
<https://github.com/openshift/origin/blob/master/pkg/cmd/OWNERS>
[fabianofranz]
- test/cmd/OWNERS
<https://github.com/openshift/origin/blob/master/test/cmd/OWNERS>
[fabianofranz]
- *test/testdata/OWNERS
<https://github.com/openshift/origin/blob/master/test/testdata/OWNERS>*
You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#15787 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p6IXoUQSeMiOYeCZVA0-thF1ate3ks5saZlggaJpZM4O4PuT>
.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fabianofranz, juanvallejo, smarterclayton The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
Fixes #15783
Before
After
cc @fabianofranz @smarterclayton