Bug 1473455 - oadm manage-node --list-pods -o yaml output format change in 3.6
oadm manage-node --list-pods -o yaml output format change in 3.6
Status: VERIFIED
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
3.x
All Linux
high Severity high
: ---
: ---
Assigned To: Juan Vallejo
Xingxing Xia
: NeedsTestCase
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-20 19:50 EDT by Joel Smith
Modified: 2017-08-02 04:15 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
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)

  None (edit)
Description Joel Smith 2017-07-20 19:50:26 EDT
Description of problem:

The format of oadm manage-node --list-pods <node> -o yaml has changed in 3.6. As a result, -o go-template output format strings that worked in 3.5 and earlier are also broken in 3.6.

Evident in the actual results below is the following:

* most stuff has had the first letter in the field name capitalized
* all fields are listed even if they have a null value
* there is no metadata section, but the fields from the metadata section are now at the same level of the hierarchy where metadata should be


Version-Release number of selected component (if applicable): 3.6


How reproducible: 100%


Steps to Reproduce:
1. oc get node
2. Select a node from the output, and use it for the next command
3. oadm manage-node --list-pods <node> -o yaml

Actual results: (excerpt)

Items:
- Spec:
    ActiveDeadlineSeconds: null
    Affinity: null
    AutomountServiceAccountToken: null
    Containers:
    - Args: null
      Command: null
      Env: null
      EnvFrom: null
      Image: docker.io/deshuai/hello-pod:latest
      ImagePullPolicy: Always
      Lifecycle: null
      LivenessProbe: null
      Name: hello-pod
# ...
  creationTimestamp: 2017-07-20T19:20:55Z
  generateName: hello-statefulset-
  labels:
    app: hello-pod
  name: hello-statefulset-0
  namespace: "10475"
# ...


Expected results: (excerpt)

items:
- metadata:
    creationTimestamp: 2017-07-20T19:20:55Z
    generateName: hello-statefulset-
    labels:
      app: hello-pod
    name: hello-statefulset-0
    namespace: "10475"
# ...
  spec:
    containers:
    - image: docker.io/deshuai/hello-pod:latest
      imagePullPolicy: Always
      name: hello-pod
# ...


Additional info:

As mentioned above, because the field names have all changed, go-template and jsonpath are also affected. For example, here's my go-template command that I run from a node that works on 3.5 that is now broken:

node_name=$(grep -Po '(?<=^nodeName: ).*' /etc/origin/node/node-config.yaml )

oadm --config /etc/origin/node/system:node:${node_name}.kubeconfig \
    manage-node --list-pods $node_name \
    -o go-template='{{range $index, $pod := .items}}{{range .status.containerStatuses}}{{if not .state.terminated}}{{.containerID}} {{$pod.metadata.namespace}} {{$pod.metadata.name}}{{printf "\n"}}{{end}}{{end}}{{end}}'


I had to re-write it like this to make it so it would work on 3.5 and 3.6:

oadm --config /etc/origin/node/system:node:${node_name}.kubeconfig \
    manage-node  --list-pods $node_name \
    -o go-template='{{if .Items}}{{range $index, $pod := .Items}}{{range .Status.ContainerStatuses}}{{if and (not .State.Terminated) .ContainerID}}{{.ContainerID}} {{$pod.namespace}} {{$pod.name}} {{.Name}}{{printf "\n"}}{{end}}{{end}}{{end}}{{else}}{{range $index, $pod := .items}}{{range .status.containerStatuses}}{{if not .state.terminated}}{{.containerID}} {{$pod.metadata.namespace}} {{$pod.metadata.name}} {{.name}}{{printf "\n"}}{{end}}{{end}}{{end}}{{end}}'
Comment 1 Clayton Coleman 2017-07-20 20:53:47 EDT
CLI regression, breaks existing scripting, this is a release blocker.
Comment 2 Juan Vallejo 2017-07-21 15:06:14 EDT
Related PR: https://github.com/openshift/origin/pull/15411
Comment 3 Joel Smith 2017-07-27 16:19:26 EDT
If this is a 3.6 release blocker, does that mean it needs to be merged and backported to the 3.6 before tomorrow?
Comment 4 Juan Vallejo 2017-07-27 18:32:45 EDT
Current PR against master the process of merging: https://github.com/openshift/origin/pull/15411

Backport against 3.6 is waiting for lgtm: https://github.com/openshift/origin/pull/15519
Comment 5 Juan Vallejo 2017-08-01 11:11:42 EDT
PR against master [1] has merged; waiting on backport.
Moving this to ON_QA for now


1. https://github.com/openshift/origin/pull/15411
Comment 6 Juan Vallejo 2017-08-01 16:44:58 EDT
backport [1] has merged

1. https://github.com/openshift/origin/pull/15519
Comment 7 Xingxing Xia 2017-08-02 04:15:37 EDT
Verified in
$ oadm version
oadm v3.6.173.0.2
kubernetes v1.6.1+5115d708d7

Verification result:
$ oadm manage-node --list-pods $NODE_NAME -o yaml
apiVersion: v1
items:
- metadata:
    annotations:
      kubernetes.io/created-by: |
        {"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicationController","namespace":"default","name":"docker-registry-3","uid":"ba9f1799-772e-11e7-a865-fa163e18a74e","apiVersion":"v1","resourceVersion":"2866"}}
      openshift.io/deployment-config.latest-version: "3"
      openshift.io/deployment-config.name: docker-registry
      openshift.io/deployment.name: docker-registry-3
      openshift.io/scc: hostnetwork
    creationTimestamp: 2017-08-02T03:00:26Z
    generateName: docker-registry-3-
    labels:
      deployment: docker-registry-3
      deploymentconfig: docker-registry
      docker-registry: default
    name: docker-registry-3-bt607
    namespace: default
    ownerReferences:
    - apiVersion: v1
      blockOwnerDeletion: true
      controller: true
... snipped ...

Search via "^ *[A-Z]", found NO first letter capitalized.

Run above `oadm ... -o go-template='{{range $index, $pod := .items}} ...`, can get fields' results:
docker://d15e0dcb6e286f52f4f9939ff76d1f3c694d71e54bedde7c79b79f8e42a5d46f default docker-registry-3-9mhbx
docker://1ae1eac13a51b87609126c212f8c086120faeebdd3e60c5c31b010d9c6276e7c default router-1-jt5pj
docker://0f1000dbc9ab8c295e991c8c24b2861a5c0188548b857e770794d5a44e5e7976 install-test mongodb-1-gw0gj
docker://685a774f500a7f632f3219f18517a56e8c31beae2da88a38e1753a34662aff15 install-test nodejs-mongodb-example-1-h3kt0
... snipped ...

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