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

Review JSON output for all odo commands #1739

Closed
2 tasks
kadel opened this issue May 16, 2019 · 16 comments
Closed
2 tasks

Review JSON output for all odo commands #1739

kadel opened this issue May 16, 2019 · 16 comments
Labels
area/json-output Issues or PRs related to JSON output (machine readable output) estimated-size/XL (40-60) Rough sizing for Epics. About 3 sprints of work for a person kind/epic An issue categorized as a high-level Epic. Needs to be scoped and broken down in 1+ stories/tasks lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/Medium Nice to have issue. Getting it done before priority changes would be great. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@kadel
Copy link
Member

kadel commented May 16, 2019

One more acceptance criteria would be to

  • JSON Output for devfile needs to have long term design as we cannot break it after v2

  • review existing commands as mentioned below

List of all commands that vscode adapter uses - https://github.com/redhat-developer/vscode-openshift-tools/blob/8b9baa56a77d02a54a37fd4532a3d1948ed53a01/src/odo.ts#L36

listProjects

vscode plugin executes: oc get project -o jsonpath="{range .items[?(.status.phase == \\"Active\\" )]}{.metadata.name}{\\"\\n\\"}{end}"'

odo project list -o json

Note: (we don't need/have --project flag for odo project list )

Question: do we need this flag to retrieve specific project (equivalent can be odo project get)

{
    "kind": "List",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {},
    "items": [
        {
            "kind": "Project",
            "apiVersion": "odo.openshift.io/v1alpha1",
            "metadata": {
                "name": "myproject",
            },
            "spec": {
                "apps": [
                    "myapp",
                ]
            },
           "status": {
              "active": false
            }
        }
    ]
}

TODO:

  • remove status.active field

listApplications

vscode plugin executes: odo application list --project ${project} -o json

{
    "kind": "List",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "items": [
        {
            "kind": "Application",
            "apiVersion": "odo.openshift.io/v1alpha1",
            "metadata": {
                "name": "app",
                "namespace": "myproject"
            },
            "spec": {
                "components": [
                    "java-jpxy",
                    "nodejs-ngrl",
                    "nodejs-yvnq"
                ]
            }
        }
    ]
}

TODO:

deleteProject

vscode plugin executes: odo project delete ${name} -f

odo project delete ${name} -f -o json
On success:

  • exitcode 0, and no other output on stdout or stderr.

On failure:

  • exitcode >0, json output on stderr
{
    "kind": "Error",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "namespace": "myproject",
    },
    "message": "Unable to delete project myproject"
}

TODO:

  • Add -o json

waitForProjectToBeGone

vscode plugin executes: oc wait project/${project} --for delete

This command should not be needed, as odo project delete should wait for the project to be deleted.

TODO:

  • implement --wait flag

createProject

vscode plugin executes: odo project create ${name}

odo project create ${name} -o json

{
    "kind": "Project",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "name": "myproject",
        "namespace": "myproject",
    }
}

if error, return error exit code (>0) and stderr :

{
    "kind": "Error",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "namespace": "myproject",
    },
    "message": "Unable to create project myproject"
}

TODO:

  • implement -o json

listComponents

odo list --app ${app} --project ${project} -o json

STATUS: we already have this

listCatalogComponents

odo catalog list components

STATUS: we already have this & we don't need json for this

listCatalogServices

odo catalog list services

STATUS: we already have this & we don't need json for this

listStorageNames

odo storage list --app ${app} --project ${project} --component ${component} -o json

listServiceInstances:

oc get ServiceInstance -o jsonpath="{range .items[?(.metadata.labels.app == \\"${app}\\")]}{.metadata.labels.app\\.kubernetes\\.io/component-name}{\\"\\n\\"}{end}" --namespace ${project}

createApplication

odo app create ${app} --project ${project}

describeApplication

odo app describe ${app} --project ${project}

STATUS: we already have this command and json output

deleteApplication

odo app delete ${app} --project ${project} -f,

createStorage

odo storage create ${storageName} --path=${mountPath} --size=${storageSize} --project ${project} --app ${app} --component ${component}

deleteStorage

odo storage delete ${storage} -f --project ${project} --app ${app} --component ${component}

waitForStorageToBeGone

oc wait pvc/${storage}-${app}-pvc --for=delete --namespace ${project}

deleteComponent

odo delete ${component} -f --app ${app} --project ${project}

describeComponent

odo describe ${component} --app ${app} --project ${project}

STATUS: we already have this command & json output

describeService

odo catalog describe service ${service}

STATUS: we already have this command & we don't need json output for this

showLog

odo log ${component} --app ${app} --project ${project}

STATUS: we already have this command & we don't need json output for this

showLogAndFollow

odo log ${component} -f --app ${app} --project ${project}

STATUS: we already have this command & we don't need json output for this

listComponentPorts

oc get service ${component}-${app} --namespace ${project} -o jsonpath="{range .spec.ports[*]}{.port}{','}{end}"

STATUS: I think #1828 will solve this problem partially. as after this PR, odo create will get all the ports and put it in localconfig files, from their, vscode extensions can grab.

linkComponentTo

odo project set ${project} && odo application set ${app} && odo component set ${component} && odo link ${componentToLink} --wait${port ? ' --port ' + port : ''}

pushComponent

odo push ${component} --app ${app} --project ${project}

ALERT:

  • we don't have --app and --project flag to odo push instead we have --context flag

pushLocalComponent

${Command.pushComponent(project, app, component)} --local ${location}

watchComponent

odo watch ${component} --app ${app} --project ${project}

STATUS: we already have this & we don't need json output for this

getRouteHostName

oc get route --namespace ${namespace} -o jsonpath="{range .items[?(.metadata.labels.app\\.kubernetes\\.io/component-name=='${component}')]}{.spec.host}{end}"

TODO:

equivalent command should be odo url list --component nodejs-zeaa --project myproject -q

  • here, we need to add -q flag which will return url

createLocalComponent

odo create ${type}:${version} ${name} --local ${folder} --app ${app} --project ${project}

createGitComponent

odo create ${type}:${version} ${name} --git ${git} --ref ${ref} --app ${app} --project ${project}

createBinaryComponent

odo create ${type}:${version} ${name} --binary ${binary} --app ${app} --project ${project}

createService

odo service create ${template} --plan ${plan} ${name} --app ${app} --project ${project} -w

deleteService

odo service delete ${name} -f --project ${project} --app ${app}

getServiceTemplate

oc get ServiceInstance ${service} --namespace ${project} -o jsonpath="{$.metadata.labels.app\\.kubernetes\\.io/component-type}"

waitForServiceToBeGone

oc wait ServiceInstance/${service} --for delete --namespace ${project}

createComponentCustomUrl

odo url create ${name} --port ${port} --project ${project} --app ${app} --component ${component}

STATUS: odo url create just modifies local config, so I think we don't need json output

getComponentUrl

odo url list --component ${component} --app ${app} --project ${project} -o json

STATUS: we already have this

getComponentJson

oc get service ${component}-${app} --namespace ${project} -o json

QUERY: why we need output of service ?

@kadel kadel changed the title Review JSON output for all odo commands Work In Progress: Review JSON output for all odo commands May 16, 2019
@kadel kadel self-assigned this Jun 7, 2019
@kadel kadel added this to For consideration in Sprint 168 Jun 10, 2019
@girishramnani girishramnani moved this from For consideration to To do in Sprint 168 Jun 10, 2019
@kadel
Copy link
Member Author

kadel commented Jun 12, 2019

/priority high

@openshift-ci-robot openshift-ci-robot added the priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). label Jun 12, 2019
@surajnarwade
Copy link
Contributor

listProjects
vscode plugin executes: oc get project -o jsonpath="{range .items[?(.status.phase == \"Active\" )]}{.metadata.name}{\"\n\"}{end}"'

odo project list --project ${project} -o json

if we want single project json, we can use odo project get

@girishramnani girishramnani added the estimated-size/S (5-10) Rough sizing for Epics. Less then one sprint of work for one person label Jun 12, 2019
@kadel kadel added this to the 1.0 milestone Jun 20, 2019
@surajnarwade
Copy link
Contributor

surajnarwade commented Jun 25, 2019

Tracking

@kadel kadel added this to For consideration in Sprint 169 via automation Jun 25, 2019
@kadel kadel removed their assignment Jun 25, 2019
@surajnarwade surajnarwade moved this from To do to In progress in Sprint 168 Jun 25, 2019
@cdrage cdrage self-assigned this Jun 26, 2019
@cdrage
Copy link
Member

cdrage commented Jun 27, 2019

Charlie's list

Other stuff being done:

Functions to go over

Crossed out = it's done / PR merged in

Other todo:

  • Update documentation on machine readable output

@kadel kadel changed the title Work In Progress: Review JSON output for all odo commands Review JSON output for all odo commands Jun 28, 2019
@kadel
Copy link
Member Author

kadel commented Jun 28, 2019

listComponentPorts

oc get service ${component}-${app} --namespace ${project} -o jsonpath="{range .spec.ports[*]}{.port}{','}{end}"

STATUS: I think #1828 will solve this problem partially. as after this PR, odo create will get all the ports and put it in localconfig files, from their, vscode extensions can grab.

odo will need command to display this information. The extensions should never read the localconfig files directly.
I think that odo component describe is a good place where this information should be shown

@kadel
Copy link
Member Author

kadel commented Jun 28, 2019

getRouteHostName

oc get route --namespace ${namespace} -o jsonpath="{range .items[?(.metadata.labels.app\\.kubernetes\\.io/component-name=='${component}')]}{.spec.host}{end}"

TODO:

equivalent command should be odo url list --component nodejs-zeaa --project myproject -q

  • here, we need to add -q flag which will return url

-q won't be needed.
It should be possible to pick up the hostname from odo url list --component nodejs-zeaa --project myproject -o json output

@girishramnani girishramnani removed this from In progress in Sprint 168 Jul 3, 2019
@girishramnani girishramnani moved this from For consideration to In progress in Sprint 169 Jul 3, 2019
@cdrage
Copy link
Member

cdrage commented Jul 3, 2019

Hey @dgolovin I'm going over deleteProject right now...

I was thinking of this in terms of implementation, or of course something similar, this is a super rough draft...

    "kind": "Success",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "namespace": "myproject",
    },
    "message": "Deleted foobar"
    "project": foobar,
}

Or is there something specific we should implement in a certain way?

@cdrage
Copy link
Member

cdrage commented Jul 10, 2019

Update:

So currently I have to implement a few changes in order to correctly add creation / deletion json output for odo project create/delete commands. I just want to give a quick update to both @surajnarwade @tkral and @degolovi that in order to do so I have to:

  • Add a json global parameter so we can detect if we are indeed doing machine readable output. This would of been added anyways since we have to have json output for (almost) every command for odo
  • Change how logging works by detecting if we're using -o json and disabling ANY form of logging in order to prevent malformed json (normal output + json)

@girishramnani girishramnani removed this from In progress in Sprint 172 Sep 25, 2019
@girishramnani girishramnani moved this from For consideration to In progress in Sprint 173 Sep 25, 2019
@kadel kadel removed this from the 1.0 milestone Oct 9, 2019
@girishramnani girishramnani added this to For consideration in Sprint 174 via automation Oct 16, 2019
@girishramnani girishramnani removed this from In progress in Sprint 173 Oct 16, 2019
@girishramnani girishramnani moved this from For consideration to In progress in Sprint 174 Oct 16, 2019
@cdrage cdrage moved this from In progress to To do in Sprint 174 Oct 18, 2019
@girishramnani girishramnani added this to For consideration in Sprint 175 via automation Nov 6, 2019
@girishramnani girishramnani removed this from To do in Sprint 174 Nov 6, 2019
@girishramnani girishramnani moved this from For consideration to To do in Sprint 175 Nov 6, 2019
@kadel kadel removed this from To do in Sprint 175 Nov 6, 2019
@kadel
Copy link
Member Author

kadel commented Dec 5, 2019

/label points/13

/unassign @cdrage

@openshift-ci-robot
Copy link
Collaborator

@kadel: The label(s) /label points/13 cannot be applied. These labels are supported: platform/aws, platform/azure, platform/baremetal, platform/google, platform/libvirt, platform/openstack, ga

In response to this:

/label points/13

/unassign @cdrage

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.

@girishramnani girishramnani added the area/json-output Issues or PRs related to JSON output (machine readable output) label Jan 2, 2020
@kadel kadel added triage/needs-information Indicates an issue needs more information in order to work on it. and removed state/In Analysis labels Feb 14, 2020
@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 14, 2020
@openshift-bot
Copy link

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci-robot openshift-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 13, 2020
@cdrage
Copy link
Member

cdrage commented Jun 17, 2020

/lifecycle frozen

@openshift-ci-robot openshift-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jun 17, 2020
@kadel
Copy link
Member Author

kadel commented Feb 24, 2022

This issues is not valid anymore. With coming v3 the json output will have to be reworked in a completely different way.

2 similar comments
@kadel
Copy link
Member Author

kadel commented Feb 24, 2022

This issues is not valid anymore. With coming v3 the json output will have to be reworked in a completely different way.

@kadel
Copy link
Member Author

kadel commented Feb 24, 2022

This issues is not valid anymore. With coming v3 the json output will have to be reworked in a completely different way.

@kadel kadel closed this as completed Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/json-output Issues or PRs related to JSON output (machine readable output) estimated-size/XL (40-60) Rough sizing for Epics. About 3 sprints of work for a person kind/epic An issue categorized as a high-level Epic. Needs to be scoped and broken down in 1+ stories/tasks lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/Medium Nice to have issue. Getting it done before priority changes would be great. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

6 participants