Odo: 'odo describe' does not include 'not pushed' URLs into output

Created on 31 Mar 2020  ·  16Comments  ·  Source: openshift/odo

/kind bug

What versions of software are you using?

Operating System:
Windows 10
Output of odo version:
odo v1.1.1 (02fbd3d08)

How did you run odo exactly?

  1. Created odo git nodejs component
  2. Added two urls
  3. Pushed to the cluster
  4. odo describe prints out both URLs
  5. odo url create url3

Actual behavior

odo describe still prints the same info as at step (4) no url3 int the list of URLs.

Expected behavior

odo describe reports all URLs pushed and not pushed.

Any logs, error output, etc?

N/A

arecomponent kinbug

All 16 comments

Sorry for late update, issue has been reproduced. You do not need a lot of URLs to reproduce this. If one URL is pushed, any further non pushed URLs are ignored

Working on fixing it

Ok i think i got it working. 'I' would not call it a clean solution, but it works. Guess we will need a lot more cleanup. Pushing PR though

❯ odo describe
Component Name: nodejs-nodejs-ex-2-cmsb
Type: nodejs
Environment Variables:
 · DEBUG_PORT=5858
URLs:
 · http://url1-app-mz-temp.apps.testocp4x.<redacted> exposed via 8080
 · URL named url2 will be exposed via 8080

@dgolovin ^

Human readable version LGTM. How '-o json' would look like?

Like I said, that will need a bit more work. The json output and human readable output are separate right now. Personally, it should be so that machine readable is generated first and if machine output is asked, it should be dumped as is else human readable should be generated from the machine output. It is not so for the moment.

Infact it's not just urls, we completely ignore local config information once a component is found on the cluster.

For now, I will focus on urls, but the component description needs a lot more cleanup. Should open a separate issue for that.

@girishramnani @kadel ^

FYI as a quick fixI could just output the localconfiginfo regardless while picking up status of cluster for son output But like i said it does not solve underlying problem

It doesn’t, can you please describe the problem with an example?

https://github.com/openshift/odo/blob/master/pkg/odo/cli/component/describe.go#L63-L74

If you see this condition, component description is taken from localconfig, only if it is not pushed, otherwise, we get the description from the cluster.

The way we detect if a component is pushed is by checking if the DC is present in the cluster.
https://github.com/openshift/odo/blob/master/pkg/component/component.go#L1329-L1339

Basically, if dc is in cluster we completely ignore local config

Hence if component is pushed once and if any action that modifies the localconfig (such as adding more URLs, storages etc, changing component type) happens without a push, it is completely invisible to describe.

Hence, this is incomplete information. and the root cause of this issue

I would suggest for now show url from both places, de duplicated.
Later we can think of diffing the cluster state vs local state and show ”Unpushed local changes" which considers all other things

I have already fixed url for normal describe on PR and am considering displaying localconfig component for json output.

And yea, this will not fix root cause though so I have opened an issue for that.

This is how it looks by the way, without the fix

❯ cat .odo/config.yaml
kind: LocalConfig
apiversion: odo.openshift.io/v1alpha1
ComponentSettings:
  Type: nodejs
  SourceLocation: ./
  SourceType: local
  Ports:
  - 8080/TCP
  Application: app
  Project: mz-temp
  Name: nodejs-nodejs-ex-2-rwbv
  Url:
  - Name: url1
    Port: 8080
  - Name: url2
    Port: 8080
❯ odo describe
Component Name: nodejs-nodejs-ex-2-rwbv
Type: nodejs
Environment Variables:
 · DEBUG_PORT=5858
URLs:
 · http://url1-app-mz-temp.apps.testocp4x.psiodo.net exposed via 8080
❯ odo describe -o json
{
    "kind": "Component",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "name": "nodejs-nodejs-ex-2-rwbv",
        "namespace": "mz-temp",
        "creationTimestamp": null
    },
    "spec": {
        "app": "app",
        "type": "nodejs",
        "url": [
            "url1"
        ],
        "env": [
            {
                "name": "DEBUG_PORT",
                "value": "5858"
            }
        ],
        "ports": [
            "8080/TCP"
        ]
    },
    "status": {
        "state": "Pushed"
    }
}


I would suggest to Follow the same solution For both human output and json output even if that means some changes to the json output

We will likely need to have a new struct that is given to the end-user to represent complete state, which combines information in the local struct as well as the cluster.

For now, I will keep it as a copy of the component description with exception of that will contain extra fields for URL (basically URLs will go from list of strings to a dict of dicts to show information that can be fetched from cluster). This should be dumped to the user for json output and used to describe the component as well.

It will, however, be independent of the Component struct

FYI as a quick fixI could just output the localconfiginfo regardless while picking up status of cluster for son output But like i said it does not solve underlying problem

I would prefer we do the right thing and fix the underlying problem

Ok I have managed to do something that makes progress towards fixing the larger problem without going too far but it will be a breaking change

❯ odo describe
Component Name: nodejs-nodejs-ex-2-rwbv
Type: nodejs
Source: file://./
URLs:
 · http://url1-app-mz-temp.apps.testocp4x.psiodo.net exposed via 8080
 · URL named url2 will be exposed via 8080/TCP
❯ odo describe -o json
{
    "kind": "Component",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "name": "nodejs-nodejs-ex-2-rwbv",
        "namespace": "mz-temp",
        "creationTimestamp": null
    },
    "spec": {
        "app": "app",
        "type": "nodejs",
        "source": "file://./",
        "sourceType": "local",
        "urls": {
            "kind": "List",
            "apiVersion": "odo.openshift.io/v1alpha1",
            "metadata": {},
            "items": [
                {
                    "kind": "url",
                    "apiVersion": "odo.openshift.io/v1alpha1",
                    "metadata": {
                        "name": "url1",
                        "creationTimestamp": null
                    },
                    "spec": {
                        "host": "url1-app-mz-temp.apps.testocp4x.psiodo.net",
                        "protocol": "http",
                        "port": 8080,
                        "secure": false
                    },
                    "status": {
                        "state": "Pushed"
                    }
                },
                {
                    "kind": "url",
                    "apiVersion": "odo.openshift.io/v1alpha1",
                    "metadata": {
                        "name": "url2",
                        "creationTimestamp": null
                    },
                    "spec": {
                        "port": 8080,
                        "secure": false
                    },
                    "status": {
                        "state": "Not Pushed"
                    }
                }
            ]
        },
        "ports": [
            "8080/TCP"
        ]
    },
    "status": {
        "state": "Pushed"
    }
}

@dgolovin wdyt?

@mohammedzee1000 LGTM, we wont be affected by this change.

Ok then I am going ahead to fix as much as i can. Including storages into the fold

❯ odo describe -o json
{
    "kind": "Component",
    "apiVersion": "odo.openshift.io/v1alpha1",
    "metadata": {
        "name": "nodejs-nodejs-ex-2-rwbv",
        "namespace": "mz-temp",
        "creationTimestamp": null
    },
    "spec": {
        "app": "app",
        "type": "nodejs",
        "source": "file://./",
        "sourceType": "local",
        "urls": {
            "kind": "List",
            "apiVersion": "odo.openshift.io/v1alpha1",
            "metadata": {},
            "items": [
                {
                    "kind": "url",
                    "apiVersion": "odo.openshift.io/v1alpha1",
                    "metadata": {
                        "name": "url1",
                        "creationTimestamp": null
                    },
                    "spec": {
                        "host": "url1-app-mz-temp.apps.testocp4x.psiodo.net",
                        "protocol": "http",
                        "port": 8080,
                        "secure": false
                    },
                    "status": {
                        "state": "Pushed"
                    }
                },
                {
                    "kind": "url",
                    "apiVersion": "odo.openshift.io/v1alpha1",
                    "metadata": {
                        "name": "url2",
                        "creationTimestamp": null
                    },
                    "spec": {
                        "port": 8080,
                        "secure": false
                    },
                    "status": {
                        "state": "Not Pushed"
                    }
                }
            ]
        },
        "storages": {
            "kind": "List",
            "apiVersion": "odo.openshift.io/v1alpha1",
            "metadata": {},
            "items": null
        },
        "ports": [
            "8080/TCP"
        ]
    },
    "status": {
        "state": "Pushed"
    }
}


Was this page helpful?
0 / 5 - 0 ratings