Description of problem: oc export will convert the file to v1 version when set --output-version to an invalid value Version-Release number of selected component (if applicable): oc v3.0.2.903-114-g2849767 kubernetes v1.2.0-alpha.1-1107-g4c8e6f4 How reproducible: Always Steps to Reproduce: 1. Convert the v1 version file to an non-exist version # oc export -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/deployment/deployment1v1beta3.json -o json --output-version=invalid Acutal results: The oc export cmd will convert the file to v1 version by default with any warning message. $ oc export -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/deployment/deployment1v1beta3.json -o json --output-version=invalid { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "hooks", "creationTimestamp": null, "labels": { "name": "mysql" <--------------------snip------------------------> Expected results: It is better to inform user that the out-version is not valid.
Hmm, "oc get" also has this problem with "--output-version" given invalid value.
Related PR: https://github.com/openshift/origin/pull/11239
Updated PR to glog an info message any time versioned objects fail to be converted to the version specified: https://github.com/openshift/origin/pull/11239
Test on latest origin, still not show any warning info when --output-version set to invalid # oc version oc v1.4.0-alpha.1+64f88d7-121 kubernetes v1.4.0+776c994 [root@ip-172-18-11-67 ~]# oc get pod -o yaml --output-version=invalid apiVersion: v1 items: - apiVersion: v1 kind: Pod metadata: annotations: openshift.io/scc: anyuid creationTimestamp: 2016-11-09T02:27:36Z labels: name: hello-pod name: hello-pod namespace: default resourceVersion: "509" selfLink: /api/v1/namespaces/default/pods/hello-pod uid: 1434ae69-a624-11e6-b9f5-0ee10c50d580 spec: containers: - image: bmeng/hello-openshift imagePullPolicy: Always name: hello-pod resources: {} securityContext: capabilities: drop: - MKNOD - SYS_CHROOT privileged: false seLinuxOptions: level: s0:c5,c0 terminationMessagePath: /dev/termination-log volumeMounts: - mountPath: /var/run/secrets/kubernetes.io/serviceaccount name: default-token-qflf6 readOnly: true dnsPolicy: ClusterFirst imagePullSecrets: - name: default-dockercfg-fcebv nodeName: ip-172-18-11-67.ec2.internal restartPolicy: Always securityContext: seLinuxOptions: level: s0:c5,c0 serviceAccount: default serviceAccountName: default terminationGracePeriodSeconds: 30 volumes: - name: default-token-qflf6 secret: defaultMode: 420 secretName: default-token-qflf6 status: conditions: - lastProbeTime: null lastTransitionTime: 2016-11-09T02:27:36Z status: "True" type: Initialized - lastProbeTime: null lastTransitionTime: 2016-11-09T02:27:36Z message: 'containers with unready status: [hello-pod]' reason: ContainersNotReady status: "False" type: Ready - lastProbeTime: null lastTransitionTime: 2016-11-09T02:27:36Z status: "True" type: PodScheduled containerStatuses: - image: bmeng/hello-openshift imageID: "" lastState: {} name: hello-pod ready: false restartCount: 0 state: waiting: reason: ContainerCreating hostIP: 172.18.11.67 phase: Pending startTime: 2016-11-09T02:27:36Z kind: List metadata: {}
yadu sorry about the confusion. The warning is printed in `--loglevel=1` or greater. Tried the command below and worked as expected: ``` $ oc get pod idling-echo-1-2x8kx -o yaml --output-version=invalid --loglevel=1 | head I1109 09:36:44.589247 2926 result.go:241] info: the output version specified is invalid. Defaulting to "v1" apiVersion: v1 kind: Pod metadata: annotations: kubernetes.io/created-by: | {"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicationController","namespace":"default","name":"idling-echo-1","uid":"8225fcde-a601-11e6-a78d-507b9dac96e1","apiVersion":"v1","resourceVersion":"71806"}} openshift.io/deployment-config.latest-version: "1" openshift.io/deployment-config.name: idling-echo openshift.io/deployment.name: idling-echo-1 openshift.io/scc: restricted ```
(In reply to Juan Vallejo from comment #5) > yadu sorry about the confusion. The warning is printed in > `--loglevel=1` or greater. Tried the command below and worked as expected: > > ``` > $ oc get pod idling-echo-1-2x8kx -o yaml --output-version=invalid > --loglevel=1 | head > I1109 09:36:44.589247 2926 result.go:241] info: the output version > specified is invalid. Defaulting to "v1" > apiVersion: v1 > kind: Pod > metadata: > annotations: > kubernetes.io/created-by: | > > {"kind":"SerializedReference","apiVersion":"v1","reference":{"kind": > "ReplicationController","namespace":"default","name":"idling-echo-1","uid": > "8225fcde-a601-11e6-a78d-507b9dac96e1","apiVersion":"v1","resourceVersion": > "71806"}} > openshift.io/deployment-config.latest-version: "1" > openshift.io/deployment-config.name: idling-echo > openshift.io/deployment.name: idling-echo-1 > openshift.io/scc: restricted > ``` # oc version oc v1.3.0-rc1+a24ab26-1350-dirty kubernetes v1.4.0+776c994 features: Basic-Auth Server https://10.13.137.149:8443 openshift v1.3.0-rc1 kubernetes v1.3.0+52492b4
Issue have been fixed. Move bug to verified. Thanks! # oc get pod -o yaml --output-version=invalid --loglevel=1 | head I1110 15:17:12.196785 8923 result.go:241] info: the output version specified is invalid. Defaulting to "v1"