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:
[@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?
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.
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
As this is a problem with HumanReadablPrinter the easiest workaround is to use '-o yaml' oc run mysql --image=mysql --dry-run -o yaml
Origin PR: https://github.com/openshift/origin/pull/16020 Upstream PR: https://github.com/kubernetes/kubernetes/pull/51477
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
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> ```
Origin PR: https://github.com/openshift/origin/pull/16892
$ oc run mysql --image=mysql --dry-run NAME AGE mysql <unknown> Verified on OCP: oc v3.7.0-0.174.0
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