Skip to content
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

print typed podlist for correct serialization #15411

Conversation

juanvallejo
Copy link
Contributor

@juanvallejo juanvallejo commented Jul 21, 2017

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1473455

Pass a typed list of pods to the printer in order to have correctly
serialized output.

Before

$ oadm manage-node --list-pods localhost -o yaml | head -n 20

Items:
- Spec:
    ActiveDeadlineSeconds: null
    Affinity: null
    AutomountServiceAccountToken: null
    Containers:
    - Args: null
      Command: null
      Env:
      - Name: REGISTRY_HTTP_ADDR
        Value: :5000
        ValueFrom: null
      - Name: REGISTRY_HTTP_NET
        Value: tcp
        ValueFrom: null
      - Name: REGISTRY_HTTP_SECRET
        Value: oQg1bMYH9dGM4S7D4p4W6eXG+wA91syQdJMIjB0v52A=
        ValueFrom: null
      - Name: REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_ENFORCEQUOTA
...

After

$ oadm manage-node --list-pods localhost -o yaml | head -n 20

apiVersion: v1
items:
- metadata:
    creationTimestamp: null
  spec:
    containers:
    - env:
      - name: REGISTRY_HTTP_ADDR
        value: :5000
      - name: REGISTRY_HTTP_NET
        value: tcp
      - name: REGISTRY_HTTP_SECRET
        value: oQg1bMYH9dGM4S7D4p4W6eXG+wA91syQdJMIjB0v52A=
      - name: REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_ENFORCEQUOTA
        value: "false"
      image: openshift/origin-docker-registry:v3.6.0-alpha.2
      imagePullPolicy: IfNotPresent
      livenessProbe:
        failureThreshold: 3
        httpGet:
...

cc @openshift/cli-review @smarterclayton

errList = append(errList, err)
continue
}
err = json.Unmarshal(b, typedPod)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabianofranz not sure if we have a more streamlined way of converting from internal to external type?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deads2k would you suggest something different here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kapi.Scheme.Convert

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just do a Get with the "right" type of client" a few lines up?

@juanvallejo
Copy link
Contributor Author

[test]

@fabianofranz
Copy link
Member

@juanvallejo thanks! Could you add a test to avoid future regressions? test/cmd/admin.sh works for me.

@fabianofranz
Copy link
Member

re[test]

@juanvallejo juanvallejo force-pushed the jvallejo/print-typed-podlist-oadm-manage-node branch from f0d52c1 to c100b12 Compare July 21, 2017 21:53
@openshift-merge-robot openshift-merge-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 24, 2017
@juanvallejo
Copy link
Contributor Author

@deads2k switched to using restclient and making "get" call directly, ptal

pods, err := l.Options.KubeClient.Core().Pods(metav1.NamespaceAll).List(metav1.ListOptions{LabelSelector: labelSelector.String(), FieldSelector: fieldSelector.String()})
pods := &kapiv1.PodList{}

restClient := l.Options.KubeClient.Core().RESTClient()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking more like, why don't you have an external client ado the .List() on that.

@openshift-merge-robot openshift-merge-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 24, 2017
@juanvallejo
Copy link
Contributor Author

@deads2k thanks for the feedback; switched to using external client

@juanvallejo juanvallejo force-pushed the jvallejo/print-typed-podlist-oadm-manage-node branch 2 times, most recently from 86349db to 79c27e1 Compare July 24, 2017 21:52
@smarterclayton
Copy link
Contributor

smarterclayton commented Jul 24, 2017 via email

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 79c27e1

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test Running (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/3465/) (Base Commit: 49df2d6) (PR Branch Commit: 79c27e1)

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS

@deads2k
Copy link
Contributor

deads2k commented Jul 25, 2017

This has to be back ported to 3.6 - are also of these changes necessary for
that?

@smarterclayton Didn't break in the recent rebase? This change is more correct than the previous one and 30 lines isn't too bad.

@deads2k
Copy link
Contributor

deads2k commented Jul 26, 2017

lgtm, squash

/retest
/approve no-issue

@deads2k
Copy link
Contributor

deads2k commented Jul 26, 2017

/test all

@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 26, 2017
@deads2k
Copy link
Contributor

deads2k commented Jul 26, 2017

/assign fabianofranz
/unassign

@juanvallejo juanvallejo force-pushed the jvallejo/print-typed-podlist-oadm-manage-node branch from 79c27e1 to baf9b6e Compare July 26, 2017 13:53
@fabianofranz
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 26, 2017
@juanvallejo
Copy link
Contributor Author

juanvallejo commented Jul 26, 2017

extended_conformance_gce flaked on #13973

/test extended_conformance_gce

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 27, 2017
Pass a typed list of pods to the printer in order to have correctly
serialized output.
@juanvallejo juanvallejo force-pushed the jvallejo/print-typed-podlist-oadm-manage-node branch from baf9b6e to 62baba1 Compare July 27, 2017 15:02
@openshift-merge-robot openshift-merge-robot removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 27, 2017
@fabianofranz
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 27, 2017
@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, fabianofranz, juanvallejo

Associated issue requirement bypassed by: deads2k

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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@juanvallejo
Copy link
Contributor Author

/test extended_conformance_gce
/test extended_conformance_install_update

@openshift-merge-robot
Copy link
Contributor

/test all [submit-queue is verifying that this PR is safe to merge]

@openshift-ci-robot
Copy link

@juanvallejo: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/integration 62baba1 link /test integration
ci/openshift-jenkins/extended_conformance_install_update 62baba1 link /test extended_conformance_install_update

Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 15447, 15411, 15483, 15478, 15481)

@openshift-merge-robot openshift-merge-robot merged commit 803bc25 into openshift:master Jul 28, 2017
@juanvallejo juanvallejo deleted the jvallejo/print-typed-podlist-oadm-manage-node branch August 1, 2017 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants