Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1455115 - oc run valid image by dry run flag raises mess error
oc run valid image by dry run flag raises mess error
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
3.6.0
Unspecified Unspecified
medium Severity medium
: ---
: 3.7.0
Assigned To: Juan Vallejo
Xingxing Xia
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-05-24 06:02 EDT by XiaochuanWang
Modified: 2017-11-28 16:56 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-11-28 16:56:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:3188 normal SHIPPED_LIVE Moderate: Red Hat OpenShift Container Platform 3.7 security, bug, and enhancement update 2017-11-28 21:34:54 EST

  None (edit)
Description XiaochuanWang 2017-05-24 06:02:21 EDT
Description of problem:
This is failed with mess error output "oc run mysql --image=mysql --dry-run"
This is succeed "oc run mysql --image=mysql "

Version-Release number of selected component (if applicable):
oc v3.6.76
kubernetes v1.6.1+5115d708d7

How reproducible:
Always

Steps to Reproduce:
1. # oc run mysql --image=mysql 
2. # oc run mysql --image=mysql --dry-run

Actual results:
2. # oc run mysql --image=mysql --dry-run
NAME      KIND
error: unknown type &v1.DeploymentConfig{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"mysql", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{sec:0, nsec:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string{"run":"mysql"}, Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:v1.DeploymentConfigSpec{Strategy:v1.DeploymentStrategy{Type:"", CustomParams:(*v1.CustomDeploymentStrategyParams)(nil), RecreateParams:(*v1.RecreateDeploymentStrategyParams)(nil), RollingParams:(*v1.RollingDeploymentStrategyParams)(nil), Resources:v1.ResourceRequirements{Limits:v1.ResourceList(nil), Requests:v1.ResourceList(nil)}, Labels:map[string]string(nil), Annotations:map[string]string(nil), ActiveDeadlineSeconds:(*int64)(nil)}, MinReadySeconds:0, Triggers:v1.DeploymentTriggerPolicies(nil), Replicas:1, RevisionHistoryLimit:(*int32)(nil), Test:false, Paused:false, Selector:map[string]string{"run":"mysql"}, Template:(*v1.PodTemplateSpec)(0xc4204b1680)}, Status:v1.DeploymentConfigStatus{LatestVersion:0, ObservedGeneration:0, Replicas:0, UpdatedReplicas:0, AvailableReplicas:0, UnavailableReplicas:0, Details:(*v1.DeploymentDetails)(nil), Conditions:[]v1.DeploymentCondition(nil), ReadyReplicas:0}}

Expected results:
Step 3 should be succeed without error.

Additional info:
Comment 1 Michal Fojtik 2017-05-30 05:58:58 EDT
[@dev] .../openshift/origin # oc run mysql --image=mysql --dry-run
NAME      REVISION   DESIRED   CURRENT   TRIGGERED BY
mysql     0          1         0

What is the server version?
Comment 2 Tomáš Nožička 2017-06-07 10:10:22 EDT
I can reproduce it and also with kubectl.

There is a bug when selecting a printer with dry-run. It select a wrong printer and that doesn't have a handler for generated types. I am working on a fix.
Comment 3 Tomáš Nožička 2017-06-12 07:00:16 EDT
As it showed this is because printers have real issues with objects in multiple versions (v1, v1beta, ...). This was caused by last rebase to upstream. Waiting for upstream decision here: https://github.com/kubernetes/kubernetes/issues/47180
Comment 4 Tomáš Nožička 2017-06-28 03:14:11 EDT
As this is a problem with HumanReadablPrinter the easiest workaround is to use '-o yaml'

oc run mysql --image=mysql --dry-run -o yaml
Comment 7 Juan Vallejo 2017-08-29 14:29:06 EDT
It appears that there are already changes in the upstream humanreadable printer to handle the case seen in this bug without outputting a lengthy error [1].

These changes will be brought in with the next rebase. Closing PRs from comment 6, and tagging this bug as UpcomginRelease

1. https://github.com/kubernetes/kubernetes/blob/master/pkg/printers/humanreadable.go#L331
Comment 8 Juan Vallejo 2017-10-16 15:30:10 EDT
Picked patch from upstream [1] that adds the changes mentioned in comment 7 [2]

1. https://github.com/kubernetes/kubernetes/commit/6bd0c38908daed2d4e59a3b2540d3f0564f87068

2. https://github.com/kubernetes/kubernetes/blob/master/pkg/printers/humanreadable.go#L331

This patch should fix the output of any resource without a custom printer handler by adding a default printer handler that prints object metadata as a fallback.

Example:

```
$ oc run mysql --image=mysql --dry-run -o yaml
NAME      AGE
mysql     <unknown>
```
Comment 9 Juan Vallejo 2017-10-16 15:30:26 EDT
Origin PR: https://github.com/openshift/origin/pull/16892
Comment 11 XiaochuanWang 2017-10-22 22:43:08 EDT
$ oc run mysql --image=mysql --dry-run
NAME      AGE
mysql     <unknown>


Verified on OCP: oc v3.7.0-0.174.0
Comment 14 errata-xmlrpc 2017-11-28 16:56:17 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:3188

Note You need to log in before you can comment on or make changes to this bug.