redhat-developer / odo

odo - Developer-focused CLI for fast & iterative container-based application development on Podman and Kubernetes. Implementation of the open Devfile standard.
https://odo.dev
Apache License 2.0
788 stars 243 forks source link

Support `odo dev` on MicroShift #7032

Closed datho7561 closed 1 year ago

datho7561 commented 1 year ago

/kind feature

Which functionality do you think we should add?

It would be really cool if odo supported dev mode on crc using the MicroShift preset.

Currently from my testing, odo dev freezes before it reaches the "Use Ctrl+C to stop and p to manually refresh". Also, according to k9s/oc get, the corresponding pod never starts. (I'll do a bit more experimenting to see if I can figure out what's preventing it from launching).

Since MicroShift removes many OpenShift features in order to reduce its footprint, it might be impossible or very difficult to get odo dev to work on the cluster.

Why is this needed?

Many developers don't have enough RAM/CPU/disk space to run a full crc OpenShift instance. MicroShift is one potential method to allow these developers to start a cluster where they can experiment with their application on OpenShift/Kubernetes.

rm3l commented 1 year ago

@datho7561 Can you please share the project you used for testing? And the output of odo version? Maybe I missed something, but I just tried to use odo against MicroShift, and it worked successfully ( see the logs below). I remember I tried it successfully several months ago when I was looking for a lightweight cluster to use locally - I also tried Kind, but more recently have been using k3d, all without any issues.

Logs ``` $ crc version WARN A new version (2.25.0) has been published on https://developers.redhat.com/content-gateway/file/pub/openshift-v4/clients/crc/2.25.0/crc-linux-amd64.tar.xz CRC version: 2.24.1+81aeeb OpenShift version: 4.13.6 Podman version: 4.4.4 $ crc config set preset microshift Changes to configuration property 'preset' are only applied when the CRC instance is created. If you already have a running CRC instance with different preset, then for this configuration change to take effect, delete the CRC instance with 'crc delete', setup it with `crc setup` and s tart it with 'crc start'. $ crc config get preset preset : microshift $ crc setup INFO Using bundle path /home/asoro/.crc/cache/crc_microshift_libvirt_4.13.6_amd64.crcbundle INFO Checking if running as non-root [...] INFO Checking if /home/asoro/.crc/cache/crc_microshift_libvirt_4.13.6_amd64.crcbundle exists INFO Getting bundle for the CRC executable INFO Downloading bundle: /home/asoro/.crc/cache/crc_microshift_libvirt_4.13.6_amd64.crcbundle... INFO Uncompressing /home/asoro/.crc/cache/crc_microshift_libvirt_4.13.6_amd64.crcbundle Your system is correctly setup for using CRC. Use 'crc start' to start the instance $ crc start [...] Started the MicroShift cluster. Use the 'oc' command line interface: $ eval $(crc oc-env) $ oc COMMAND ☸ microshift (default) in /t/nodejs on  main [!] via  v20.4.0 took 59s $ odo create namespace test1 --wait=false ✓ Creating the namespace "test1" [21ms] ✓ Namespace "test1" is ready for use ✓ New namespace created and now using namespace: test1 ☸ microshift (test1) in /t/nodejs on  main [!] via  v20.4.0 $ odo list namespaces ACTIVE NAME default kube-node-lease kube-public kube-system openshift-dns openshift-infra openshift-ingress openshift-kube-controller-manager openshift-ovn-kubernetes openshift-route-controller-manager openshift-service-ca openshift-storage * test1 ☸ microshift (test1) in /t/nodejs on  main [!] via  v20.4.0 [0/190] $ odo dev __ / \__ Developing using the "my-nodejs-app" Devfile \__/ \ Namespace: test1 / \__/ odo version: v3.13.0 \__/ ↪ Running on the cluster in Dev mode ✓ Web console accessible at http://localhost:20000/ ✓ API Server started at http://localhost:20000/api/v1 ✓ API documentation accessible at http://localhost:20000/swagger-ui/ • Waiting for Kubernetes resources ... ✓ Added storage vol-1 to component ⚠ Pod is Pending ✓ Pod is Running ✓ Syncing files into the container [107ms] ✓ Building your application in container (command: install) [5s] • Executing the application (command: run) ... ✓ Waiting for the application to be ready [1s] - Forwarding from 127.0.0.1:20001 -> 3000 ↪ Dev mode Status: Watching for changes in the current directory /tmp/nodejs Web console accessible at http://localhost:20000/ Keyboard Commands: [Ctrl+c] - Exit and delete resources from the cluster [p] - Manually apply local changes to the application on the cluster ``` ``` ☸ microshift (test1) in /t/nodejs on  main [!] via  v20.4.0 took 17m32s $ curl http://localhost:20001/ Hello from Node.js Starter Application!% ```
datho7561 commented 1 year ago

I'll try it again

datho7561 commented 1 year ago

I've been trying https://github.com/openshift-evangelists/Wild-West-Backend with the Spring Boot Devfile. I also ran into the same issue on k3s. I was using odo 3.12.0 before, but upgraded to 3.13.0 and faced the same problem.

I tried the Angular and Go sample projects as well, with the same result.

I'll try updating my crc, maybe that's the issue.

datho7561 commented 1 year ago

I updated my crc to 2.25.0, and that didn't change anything. I also tried increasing the cluster memory.

datho7561 commented 1 year ago

Wait, I got it to work, but I changed nothing...

datho7561 commented 1 year ago

It seems the issue was that I was using the default namespace. I got odo to work on microshift and k3s

rm3l commented 1 year ago

It seems the issue was that I was using the default namespace. I got odo to work on microshift and k3s

Ah yes, indeed, odo might not play well with the default namespace/project (due to potential restrictions, e.g.: https://github.com/redhat-developer/odo/issues/6849), hence the warning message we display in this case (https://github.com/redhat-developer/odo/issues/5591). Anyway, great that you figured out the cause of this issue. ~This makes me think that we could document this on our Troubleshooting page.~ (the warning message we display in the odo dev output should actually serve as a troubleshooting guide, as it clearly states what the issue is and how to fix it - so no need IMO to duplicate this elsewhere).