/kind user-story
As a user I should be able to use the devfile features without having experimental mode enabled. The decision between devfile and s2i will be made based on which config file is present locally.
[ ] resolve broken tests
Feature Request:
/kind user-story
Note:
/area devfile
I'm implementing Devfile by default in time for the August 4th Alpha release without the experimental mode enabled. There are commands that are not implemented such as:
How do you think we should hide this in the UX / UI when Devfile is by default? What if a user wants to deploy / edit an S2I deployment? Should I just update the help usage to say (FOR S2I ONLY) beside the command or something?
- storag
odo storage is WIP in https://github.com/openshift/odo/issues/3398
- link
component->service was implemented in https://github.com/openshift/odo/pull/3557
component->component link is planned in https://github.com/openshift/odo/issues/3423 (This probably won't be implemented in time for 2.0)
ping @dharmit
- unlink
planned for this sprint https://github.com/openshift/odo/issues/3563
- update
this command should be deprecated in favor of using odo config
I thought that I opened an issue about this, but I can't find it :-/
- describe
Looks like we forgot about this one :-( We need to implement this before 2.0 release
component->component link is planned in #3423 (This probably won't be implemented in time for 2.0)
ping @dharmit
Indeed, this is not a priority for 2.0.
- unlink
planned for this sprint #3563
Intend to open a PR soon now that #3557 is in.
- update
this command should be deprecated in favor of using odo config
I thought that I opened an issue about this, but I can't find it :-/
- update
this command should be deprecated in favor of using odo config
I thought that I opened an issue about this, but I can't find it :-/2688?
That is one part of that. But I was convinced that I explicitly wrote a user story about deprecating odo update. But It looks like I did not :-/
Found it https://github.com/openshift/odo/issues/3396
For devfile component, it shows the following message
โถ odo update
Experimental mode is enabled, use at your own risk
โ 'odo update' command is not available for Devfile based components
for s2i component, there is a deprecation warning
WARNING: odo update is not available for Devfile based components and will be removed in the future odo versions.
opened https://github.com/openshift/odo/issues/3644 to cover odo describe
I have a proposal. Implementing https://github.com/openshift/odo/pull/3634 has been very difficult with rebasing as well as https://github.com/openshift/odo/pull/3545 being added.
One major UX / UI concern is with regards to the --help output.
With Devfile being the default and --s2i being added as an extra paramter to odo create it's creating an issue where --help is overwhelming to the user with a ton of parameters that only work with certain features (Devfile vs S2I parameters).
What I propose is that instead of adding a parameter (--s2i) we add an preference config similar to how we use odo preference set experimental true
For example:
odo preference set deployment s2i
odo preference set deployment devfile
If we don't do this, --help will have to still show all the parameters / examples and options of both Devfile and S2I which is quite frankly, way too overwhelming. See below:
Examples:
# Create new Node.js component with the source in current directory.
Note: When you use odo with experimental mode enabled and create devfile component, if you want to use existing devfile the first argument will be the component name
# Create new Node.js component with existing devfile
odo create mynodejs (devfile exists in current working directory)
odo create mynodejs --devfile ./devfile.yaml (devfile exists in any other directory)
odo create mynodejs --devfile https://raw.githubusercontent.com/elsony/devfile-registry/master/devfiles/nodejs/devfile.yaml (devfile exists in network)
# Create new Node.js component
odo create nodejs
# Create new Node.js component named 'frontend' with the source in './frontend' directory
odo create nodejs frontend --context ./frontend
# Create new Java component with binary named sample.jar in './target' directory
odo create java:8 --binary target/sample.jar
# Create new Node.js component with source from remote git repository
odo create nodejs --git https://github.com/openshift/nodejs-ex.git
# Create new Node.js component with custom ports, additional environment variables and memory and cpu limits
odo create nodejs --port 8080,8100/tcp,9100/udp --env key=value,key1=value1 --memory 4Gi --cpu 2
# Create new Node.js component and download the sample project named nodejs-starter
odo create nodejs --starter=nodejs-starter
Flags:
--app string Application, defaults to active application
-b, --binary string Create a binary file component component using given artifact. Works only with Java components. File needs to be in the context directory.
--context string Use given context directory as a source for component settings
--cpu string Amount of cpu to be allocated to the component. ex. 100m or 0.1 (sets min-cpu and max-cpu to this value)
--devfile string Path to the user specify devfile
--env strings Environmental variables for the component. For example --env VariableName=Value
-g, --git string Create a git component using this repository.
-h, --help Help for create
--max-cpu string Limit maximum amount of cpu to be allocated to the component. ex. 1
--max-memory string Limit maximum amount of memory to be allocated to the component. ex. 100Mi
--memory string Amount of memory to be allocated to the component. ex. 100Mi (sets min-memory and max-memory to this value)
--min-cpu string Limit minimum amount of cpu to be allocated to the component. ex. 100m
--min-memory string Limit minimum amount of memory to be allocated to the component. ex. 100Mi
--now Push changes to the cluster immediately
-p, --port strings Ports to be used when the component is created (ex. 8080,8100/tcp,9100/udp)
--project string Project, defaults to active project
-r, --ref string Use a specific ref e.g. commit, branch or tag of the git repository (only valid for --git components)
--registry string Create devfile component from specific registry
--s2i Path to the user specify devfile
--starter string[="devfile-project-name"] Download a project specified in the devfile
--token string Token to be used when downloading devfile from the devfile path that is specified via --devfile
I suggest we add this preference and document this in the --help usage at the very top as well as in our documentation.
This makes it much easier to differentiate between s2i and devfile.
Ping @dharmit @girishramnani @kadel
Another thing to note too. Our "IsExperimentalModeEnabled" code is heavily embedded in our code. If I were to make Devfile default (taking it out of experimental mode) it would cause a lot of refactoring. You can already see this in my current code here: https://github.com/openshift/odo/pull/3634 where I've had to refactor url.go code.
Have a quick search here: https://github.com/openshift/odo/search?q=IsExperimentalModeEnabled&unscoped_q=IsExperimentalModeEnabled and you'll see that if the IsExperimentalModeEnabled is located anywhere outside pkg/odo/cli it'll have to be refactored and an alternative way to determine if Devfile should be detected on it.
For example, code such as here: https://github.com/openshift/odo/blob/d8a529fce4efd46f4719aca81abaceb2f456b730/pkg/occlient/occlient.go#L755 in the occlient.go file would have to be refactored and a parameter added to https://github.com/openshift/odo/blob/d8a529fce4efd46f4719aca81abaceb2f456b730/pkg/occlient/occlient.go#L714 most likely a bool parameter determining isS2i or not. We are able to detect if a Devifle exists, but only in the /cli package where we have access to the devfilePath variables https://github.com/openshift/odo/blob/32ef163aa6e7605aadd2f5888c2db381c870a643/pkg/odo/cli/component/update.go#L81 Thus we would have to find an alternative way to pass in a way to safely determine if we should use devfile or s2i.
All of this could be solved by simply adding a preference configuration instead of having to continue to determine if a devfile exists in the directory or not.
Another problem is the following. Say we were to use odo catalog list components in our home directory, in a non-odo directory. How do we determine to list s2i components or Devfile? We can't. We've taken devfile out of experimental and now we cannot determine whether to list s2i or not.
The way to solve that too would be a preference configuration. Otherwise, the only way to determine if Devfile is enabled or not is by checking the current directory for devfile.yaml. But if you're outside of your development directory, what would we list?
The only problem case is if the user is developing multiple components at the same time with a mixed components of s2i and devfiles. Having said that, I think most user will be using one or another instead of a mix of s2i and devfile components at the same time. Therefore, I think it is fine with adding the preference on setting the deployment flag to determine if the user wants s2i or devfile support.
FWIW...For "Problem 2", I don't think it is a problem even if we don't introduce the preference flag. During catalog list, the user hasn't indicate which mode to add yet so we can just show both type of components (maybe provide a flag to filter to specific type if we need to)
@cdrage
The first reference in oc client was added there https://github.com/openshift/odo/pull/3265, we can solve this at cli layer with --s2i flag, so it could be removed.
Not sure about other places, i agree it is a cumbersome task.
If we are going with preference option then we do not need --s2i flag either.
After having a long discussion with tomas and we trying to verified if s2i components work in experimental mode correctly or not.
So the TLDR of the outcome was - we propose a two fold solution.
IsExperimental() to IsDevfile() which can check in the context if there is a devfile.yaml present.listing of anything or doesn't depend on context directory likeodo listodo catalog list componentsodo app listodo project listodo url listodo catalog describeodo storage listodo registry listwe would require some work like instead of depending on experimental mode depend on the Is<Resource>Supported() to list respective resources for oc and kube.
Now the longer explaination to the solution - We are gonna break it into two parts:
odo create or odo create --s2i )Now the reasoning behind this two fold approach is that for everything that requires context - the workflows are quite disjoint with two exceptions
odo list - this needs to list both devfile and s2i even if the context is s2i. ( and there is an issue which takes care of that https://github.com/openshift/odo/issues/3521 )odo url list - as devfile components can have both ingress and route kind of URLs so this needs work.So at every other place like odo push and odo watch and other context dependent command if we just checked if the directory has devfile.yaml present or not to trigger devfile. It should work.
Outside of a component directory there are limited commands that work - mostly are about listing and describing. We them we need to show legacy and experimental resources . The commands we care about right now are ( with possible solutions ) -
odo list: issue for this already https://github.com/openshift/odo/issues/3521odo catalog list components: should just show both devfile and s2i components either way. odo app list: should detect if isApplicationSupported and only then list odo project list : already have a PR for this https://github.com/openshift/odo/pull/3647odo url list : we need to use the isRouteSupported to list both route and ingress either wayodo catalog describe: should just show what the user has asked for - go through both s2i and devfile components descriptions in any caseodo storage list: issue for this already present https://github.com/openshift/odo/issues/3398odo registry list: this doesn't require much work as s2i doesn't have registry so we just remove experimental checkNote - its not a mistake that odo list shows up in context dependent and independent list, its intentional because odo list behaves differently when its inside a component directory and when its not.
If we don't do this,
--helpwill have to still show all the parameters / examples and options of both Devfile and S2I which is quite frankly, way too overwhelming. See below:
What about the help? Even if we implement those, what is the plan for the help. We should probably establish a pattern for showing help text that make it clear on what applies to s2i, devfile and both. e.g.:
(s2i)(devfile)(s2i only) is to shorten the text but not sure skipping "only" is clear enough.Ping @dharmit @girishramnani @kadel
See below for commands that have been tested. There are a lot left out. But below can at least get the basic functionality of alpha out.
PR RELATED TO THE BELOW COMMANDS LOCATED HERE: #3634
List of commands confirmed working (with odo create nodejs --starter in the directory):
WORKING
_component_
_url_
_preference_
_project_
_registry_
_test_
NOT WORKING:
_component_
_config_
_service_
_debug_
_storage_
_catalog_
odoodo createWorks as intended
โถ odo create --starter nodejs
Validation
โ Checking devfile existence [48701ns]
โ Checking devfile compatibility [91890ns]
โ Creating a devfile component from registry: DefaultDevfileRegistry [115381ns]
โ Validating devfile component [273144ns]
Project
โ Downloading project from https://github.com/odo-devfiles/nodejs-ex.git [289ms]
Please use `odo push` command to create the component with source deployed
odo deleteWorks as intended
~/openshift/test
โถ odo delete
? Are you sure you want to delete the devfile component: nodejs? Yes
โ Deleting devfile component nodejs [105ms]
โ Successfully deleted component
odo execWorks as intended
~/openshift/test
โถ odo exec -- ls -lah
total 28K
drwxrwxr-x 1 default root 4.0K Jul 30 19:50 .
drwxrwxr-x 1 default root 4.0K Jun 4 10:38 ..
drwx------ 3 root root 4.0K Jul 30 19:50 .config
drwxr-xr-x 4 default root 4.0K Jul 30 19:50 .npm
drwxr-xr-x 2 default root 4.0K Jul 30 19:50 .npm-global
drwxrwxr-x 1 default root 4.0K Jun 3 15:55 .pki
odo linkUnable to confirm functionality
odo logWorks as intended
~/openshift/test
โถ odo log
Dtime="2020-07-30T19:50:42Z" level=info msg="create process:devrun"
Ftime="2020-07-30T19:50:42Z" level=info msg="create process:debugrun"
@time="2020-07-30T19:50:45Z" level=debug msg="no auth required"
Ptime="2020-07-30T19:50:45Z" level=info msg="stop the program" program=debugrun
Ntime="2020-07-30T19:50:45Z" level=info msg="stop the program" program=devrun
Ytime="2020-07-30T19:50:45Z" level=info msg="force to kill the program" program=debugrun
Wtime="2020-07-30T19:50:45Z" level=info msg="force to kill the program" program=devrun
@time="2020-07-30T19:50:45Z" level=debug msg="no auth required"
Ntime="2020-07-30T19:50:45Z" level=debug msg="succeed to find process:devrun"
Rtime="2020-07-30T19:50:45Z" level=info msg="try to start program" program=devrun
Vtime="2020-07-30T19:50:45Z" level=info msg="success to start program" program=devrun
ODO_COMMAND_RUN is npm start
Changing directory to /project
+Executing command cd /project && npm start
&> [email protected] start /project
> node server.js
App started on PORT 3000
Ptime="2020-07-30T19:50:46Z" level=debug msg="wait program exit" program=devrun
odo pushWorks as intended
~/openshift/test
โถ odo push
Validation
โ Validating the devfile [24568ns]
Initialization
โ Initializing the component [3s]
Creating Docker resources for component nodejs
โ Pulling image registry.access.redhat.com/ubi8/nodejs-12:1-45 [2s]
โ Starting container for registry.access.redhat.com/ubi8/nodejs-12:1-45 [532ms]
Syncing to component nodejs
โ Checking files for pushing [871259ns]
โ Syncing files to the component [407ms]
Executing devfile commands for component nodejs
โ Executing install command "npm install" [3s]
โ Executing run command "npm start" [1s]
Pushing devfile component nodejs
โ Changes successfully pushed to component
odo updateWorks as intended
~/openshift/test
โถ odo update
โ 'odo update' command is not available for Devfile based components.
odo watchWorks as intended
~/openshift/test
โถ odo watch
Waiting for something to change in /home/wikus/openshift/test
File /home/wikus/openshift/test/foo.txt changed
Pushing files...
Validation
โ Validating the devfile [29845ns]
Creating Kubernetes resources for component nodejs
โ Waiting for component to start [34ms]
Applying URL changes
โ URLs are synced with the cluster, no changes are required.
Syncing to component nodejs
โ Syncing files to the component [746ms]
Executing devfile commands for component nodejs
โ Executing install command "npm install" [1s]
โ Executing run command "npm start" [3s]
Waiting for something to change in /home/wikus/openshift/test
odo debugodo debug infoodo debug port-forwardDOES NOT WORK.
```~/openshift/test โ
โถ odo debug port-forward
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x1790e86]
goroutine 1 [running]:
github.com/openshift/odo/pkg/debug.(DefaultPortForwarder).ForwardPorts(0xc0004a63f0, 0xc000a14a60, 0x9, 0xc00053e300, 0xc00053e360, 0x0, 0x0, 0x22)
/home/wikus/syncthing/files/dev/go/src/github.com/openshift/odo/pkg/debug/portforward.go:60 +0x56
github.com/openshift/odo/pkg/odo/cli/debug.PortForwardOptions.Run(0xc0005e3910, 0x6, 0x0, 0x0, 0xc0005e3928, 0x7, 0xc000a14a60, 0x9, 0x16e2, 0x0, ...)
/home/wikus/syncthing/files/dev/go/src/github.com/openshift/odo/pkg/odo/cli/debug/portforward.go:168 +0x31c
github.com/openshift/odo/pkg/odo/genericclioptions.GenericRun(0x2005e80, 0xc00063e3f0, 0xc000163b80, 0x30b8240, 0x0, 0x0)
/home/wikus/syncthing/files/dev/go/src/github.com/openshift/odo/pkg/odo/genericclioptions/runnable.go:31 +0x13c
github.com/openshift/odo/pkg/odo/cli/debug.NewCmdPortForward.func1(0xc000163b80, 0x30b8240, 0x0, 0x0)
/home/wikus/syncthing/files/dev/go/src/github.com/openshift/odo/pkg/odo/cli/debug/portforward.go:181 +0x5e
github.com/openshift/odo/vendor/github.com/spf13/cobra.(Command).execute(0xc000163b80, 0x30b8240, 0x0, 0x0, 0xc000163b80, 0x30b8240)
/home/wikus/syncthing/files/dev/go/src/github.com/openshift/odo/vendor/github.com/spf13/cobra/command.go:830 +0x2aa
github.com/openshift/odo/vendor/github.com/spf13/cobra.(Command).ExecuteC(0xc00042c780, 0x1df24a8, 0xc0006bc6c0, 0x2)
/home/wikus/syncthing/files/dev/go/src/github.com/openshift/odo/vendor/github.com/spf13/cobra/command.go:914 +0x2fb
github.com/openshift/odo/vendor/github.com/spf13/cobra.(Command).Execute(...)
/home/wikus/syncthing/files/dev/go/src/github.com/openshift/odo/vendor/github.com/spf13/cobra/command.go:864
main.main()
/home/wikus/syncthing/files/dev/go/src/github.com/openshift/odo/cmd/odo/odo.go:67 +0x330
### `odo service`
#### `odo service create`
Unable to confirm functionality. Please confirm @dharmit
#### `odo service delete`
Unable to confirm functionality. Please confirm @dharmit
#### `odo service list`
Unable to confirm functionality. Please confirm @dharmit
### `odo url`
#### `odo url create`
Works as intended
```sh
~/openshift/test โ
โถ odo url create
โ URL nodejs-3000 created for component: nodejs
To apply the URL configuration changes, please use `odo push`
~/openshift/test
โถ odo push
Validation
โ Validating the devfile [142132ns]
Creating Kubernetes resources for component nodejs
โ Waiting for component to start [40ms]
Applying URL changes
โ URL nodejs-3000: http://nodejs-3000-testing.e8ca.engint.openshiftapps.com created
Syncing to component nodejs
โ Checking file changes for pushing [3ms]
โ Syncing files to the component [692ms]
Executing devfile commands for component nodejs
โ Executing install command "npm install" [2s]
โ Executing run command "npm start" [3s]
Pushing devfile component nodejs
โ Changes successfully pushed to component
Proof of curl:
โถ curl http://nodejs-3000-testing.e8ca.engint.openshiftapps.com
Hello from Node.js Starter Application!%
odo url deleteWorks as intended
~/openshift/test
โถ odo url delete nodejs-3000
? Are you sure you want to delete the url nodejs-3000 Yes
โ URL nodejs-3000 removed from the env file
To delete the URL on the cluster, please use `odo push`
~/openshift/test
โถ push
~/openshift/test โ
โถ odo push
Validation
โ Validating the devfile [144494ns]
Creating Kubernetes resources for component nodejs
โ Waiting for component to start [43ms]
Applying URL changes
โ URL nodejs-3000 successfully deleted
Syncing to component nodejs
โ Checking file changes for pushing [2ms]
โ No file changes detected, skipping build. Use the '-f' flag to force the build.
Pushing devfile component nodejs
โ Changes successfully pushed to component
odo url describeWorks as intended
~/openshift/test โ
โถ odo url describe nodejs-3000
NAME STATE URL PORT SECURE KIND
nodejs-3000 Pushed http://nodejs-3000-testing.e8ca.engint.openshiftapps.com 3000 false route
odo url list~/openshift/test โ
โถ odo url list
Found the following URLs for component nodejs
NAME STATE URL PORT SECURE KIND
nodejs-3000 Pushed http://nodejs-3000-testing.e8ca.engint.openshiftapps.com 3000 false route
LINK TO PR: https://github.com/openshift/odo/pull/3634
List of commands confirmed working (with odo create nodejs --s2i in the directory):
TO TEST
_component_
_url_
_preference_
_project_
_registry_
_test_
_config_
_service_
_debug_
_storage_
_catalog_
For odo service and odo link/odo unlink commands, I'll be doing it as a part of #3595. These commands are more concerned with the cluster's capability of support resources of type ClusterServiceVersion than anything specific to devfile.
New update: Alpha release has gone out! https://github.com/openshift/odo/releases/tag/v2.0.0-alpha
I'm updating https://github.com/openshift/odo/issues/3550#issuecomment-667109411 to note what works and what does not work.
Most helpful comment
After having a long discussion with tomas and we trying to verified if s2i components work in experimental mode correctly or not.
So the TLDR of the outcome was - we propose a two fold solution.
IsExperimental()toIsDevfile()which can check in the context if there is a devfile.yaml present.listingof anything or doesn't depend on context directory likeodo listodo catalog list componentsodo app listodo project listodo url listodo catalog describeodo storage listodo registry listwe would require some work like instead of depending on experimental mode depend on the
Is<Resource>Supported()to list respective resources for oc and kube.Now the longer explaination to the solution - We are gonna break it into two parts:
Inside component Directory with context ( after
odo createorodo create --s2i)Now the reasoning behind this two fold approach is that for everything that requires context - the workflows are quite disjoint with two exceptions
odo list- this needs to list both devfile and s2i even if the context is s2i. ( and there is an issue which takes care of that https://github.com/openshift/odo/issues/3521 )odo url list- as devfile components can have both ingress and route kind of URLs so this needs work.So at every other place like
odo pushandodo watchand other context dependent command if we just checked if the directory hasdevfile.yamlpresent or not to trigger devfile. It should work.Outside of component Directory
Outside of a component directory there are limited commands that work - mostly are about
listinganddescribing. We them we need to show legacy and experimental resources . The commands we care about right now are ( with possible solutions ) -odo list: issue for this already https://github.com/openshift/odo/issues/3521odo catalog list components: should just show both devfile and s2i components either way.odo app list: should detect ifisApplicationSupportedand only then listodo project list: already have a PR for this https://github.com/openshift/odo/pull/3647odo url list: we need to use theisRouteSupportedto list both route and ingress either wayodo catalog describe: should just show what the user has asked for - go through both s2i and devfile components descriptions in any caseodo storage list: issue for this already present https://github.com/openshift/odo/issues/3398odo registry list: this doesn't require much work as s2i doesn't have registry so we just removeexperimentalcheckNote - its not a mistake that
odo listshows up in context dependent and independent list, its intentional becauseodo listbehaves differently when its inside a component directory and when its not.