[kind/bug]
odo version:odo v0.0.16 (HEAD)
$ odo create httpd
Component 'httpd-ex-httpd-ohbd' was created and ports 8080/TCP,8443/TCP were opened
To push source code to the component run 'odo push'
Component 'httpd-ex-httpd-ohbd' is now set as active component.
$ odo url create
Adding URL to component: httpd-ex-httpd-ohbd
'port' is required as the component httpd-ex-httpd-ohbd exposes 2 ports: 8080,8443
$ odo url create --port 8080
Adding URL to component: httpd-ex-httpd-ohbd
URL created for component: httpd-ex-httpd-ohbd
httpd-ex-httpd-ohbd - http://httpd-ex-httpd-ohbd-httpd-ex-pqgc-myproject.192.168.42.65.nip.io
$ odo url create --port 8443
The url httpd-ex-httpd-ohbd already exists in the application: httpd-ex-pqgc
$ odo url list
Found the following URLs for component httpd-ex-httpd-ohbd in application httpd-ex-pqgc:
NAME URL PORT
httpd-ex-httpd-ohbd http://httpd-ex-httpd-ohbd-httpd-ex-pqgc-myproject.192.168.42.65.nip.io 8080
$ odo url create --port 8443
Adding URL to component: httpd-ex-httpd-abcd
URL created for component: httpd-ex-httpd-abcd
httpd-ex-httpd-abcd - http://httpd-ex-httpd-abcd-httpd-ex-pqgc-myproject.192.168.42.65.nip.io
$ odo url list
Found the following URLs for component httpd-ex-httpd-ohbd in application httpd-ex-pqgc:
NAME URL PORT
httpd-ex-httpd-ohbd http://httpd-ex-httpd-ohbd-httpd-ex-pqgc-myproject.192.168.42.65.nip.io 8080
httpd-ex-httpd-abcd http://httpd-ex-httpd-ohbd-httpd-ex-pqgc-myproject.192.168.42.65.nip.io 8443
you can create two URLs for the same component, you just have to specify names for the url
The following should work:
odo url create myurl1 --port 8443
odo url create myurl2 --port 8080
We should make sure that port number is part of the url name when creating url with the automatically generated name (url name is not specified by the user).
odo url create --port 8443
# url name will be `<component name>-8443`
odo url create --port 8080
# url name will be `<component name>-8080`
We actually do something similar with secrets: https://github.com/redhat-developer/odo/blob/79925b638963bf072515ea6ad533b48c7efdc1b0/pkg/occlient/occlient.go#L766
When we link components, we add the port number to the secret name and also add an annotation which can be used when searching for the secrets
@kadel @surajnarwade In case of a single port component, should I add the port number to the component or leave it?
FWIW, for the secrets we also always add it (but of course secrets don't normally show up in odo, they are an implementation detail)
@kadel @surajnarwade In case of a single port component, should I add the port number to the component or leave it?
I would always add it to make it consistent.