redhat-developer / vscode-openshift-tools

OpenShift extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=redhat.vscode-openshift-connector
MIT License
93 stars 60 forks source link

"message": "no deployable components found" when create a new component in vscode #2498

Open d95776 opened 2 years ago

d95776 commented 2 years ago

I installed the openshift connector extension for vscode. I tried to deploy a spring boot restful api java application to openshift cluster. When I did "create a new component", get the following error. What settings I have to configure such that the extension can find a deployable component?

Command failed: "/Users/hchen/.vscode/extensions/redhat.vscode-openshift-connector-0.4.0-darwin-x64/out/tools/darwin/odo" catalog list components -o json { "kind": "Error", "apiVersion": "odo.dev/v1alpha1", "metadata": { "creationTimestamp": null }, "message": "no deployable components found" }

mohitsuman commented 2 years ago

@d95776 thanks for raising this. Can you please help us with which OpenShift cluster you are connected to? (CRC, OpenShift DevConsole, Sandbox)

d95776 commented 2 years ago

I connected to our company's openshift cluster.

d95776 commented 2 years ago

any comments?

dgolovin commented 2 years ago

@d95776 Do you see any items it Registries View? You should see the same item as on screenshot. Default registry URL is https://registry.devfile.io/viewer. You might have no access to it because you are behind proxy server and odo cli cannot fetch list of components form the registry server. image

d95776 commented 2 years ago

yes, I see the same items on the screen except I can't create or see components. I am able to login to our OCP server and see my namespace. is there a way to setup a proxy?

Screen Shot 2022-08-18 at 9 26 48 AM
dgolovin commented 2 years ago

The only supported way right now is through env variables

Just setup it globally and restart VSCode to pick it up.

d95776 commented 2 years ago

there's no proxy between the vscode ide and our openshift clusters. if I setup http proxy, the openshift clusters even can't be reached. without proxy, at least I can see my project on the cluster but just not see any component. I guess there's some issue with the extension. The kubernets extension works fine.

dgolovin commented 2 years ago

@d95776 That is a good point. I'll open issue for related project. Can you see the components from the registry with env variables set?

dgolovin commented 2 years ago

@d95776 I forgot to mention you can also use NOPROXY env var to exclude your openshift cluster from being connected through proxy.

d95776 commented 2 years ago

May I ask what registry do you refer to? I can see the cluster and my namespace. But can't see any items under the namespace.

d95776 commented 2 years ago

Do you refer to DefaultDevfileRegistry?

d95776 commented 2 years ago

even set NO_PROXY, I get the same result. I think if we can connect to the openshift cluster and my namespace, then there would not be proxy issue and also Kubernetes extension works fine

dgolovin commented 2 years ago

Under namespace or project extension shows only 'Deployment' resources. There are two kinds of deployments:

So if you see nothing under namespace there are no Deployment resources in it.

In issue description you mentioned 'odo catalog list' reports "no deployable components available" that means extension cannot load so called components or devfiles from the registry here https://registry.devfile.io/viewer.

dgolovin commented 2 years ago

If you click image do you see anything in opened editor?

d95776 commented 2 years ago

when I click on it, see message "Loading Registry View" and it hangs for long time. looks like I can't get registry view

d95776 commented 2 years ago

once I setup https_proxy, we got error Devfile Registry is not accessible.

dgolovin commented 2 years ago

It seems that odo losing error info when requesting devfiles from registry could you run command from issue description with -v 10 and see if there are any errors related to communication with registry?

d95776 commented 2 years ago

could you please tell the command and from where to run it?

dgolovin commented 2 years ago

use terminal view in vscode and run this: "/Users/hchen/.vscode/extensions/redhat.vscode-openshift-connector-0.4.0-darwin-x64/out/tools/darwin/odo" catalog list components -o json -v 10

d95776 commented 2 years ago

The command I found is a little bit different from you provided. Here's the result "/Users/hchen/.vscode/extensions/redhat.vscode-openshift-connector-0.6.0-darwin-x64/out/tools/darwin/odo-darwin-amd64" catalog list components -o json -v 10 I0829 19:04:01.029677 92576 util.go:795] HTTPGetRequest: https://raw.githubusercontent.com/redhat-developer/odo/master/build/VERSION I0829 19:04:01.029790 92576 implem.go:107] The path for preference file is /Users/hchen/.odo/preference.yaml I0829 19:04:01.031362 92576 util.go:816] Response will be cached in /var/folders/1w/spg6p9ns2l71rt48yvkv107c7l6swt/T/odohttpcache for 1h0m0s ? Help odo improve by allowing it to collect usage data. Read about our privacy statement: https://developers.redhat.com/article/tool-data-collection. You can change your preference later by changing the ConsentTelemetry preference. (Y/n) I0829 19:04:01.616292 92576 version.go:143] Error checking if newer odo release is available: unable to get latest release tag: error getting latest release: fail to retrive https://raw.githubusercontent.com/redhat-developer/odo/master/build/VERSION: Not Found ? Help odo improve by allowing it to collect usage data. Read about our privacy statement: https://developers.redhat.com/article/tool-data-collection. You can change your preference later by changing the ConsentTelemetry preference. Yes I0829 19:05:03.759284 92576 segment.go:251] Checking telemetry enable status

{ "kind": "Error", "apiVersion": "odo.dev/v1alpha1", "metadata": { "creationTimestamp": null }, "message": "no deployable components found" }

dgolovin commented 2 years ago

I don't see anything specific to registry, it looks like registry literally has no components. What does command below print out?

"/Users/hchen/.vscode/extensions/redhat.vscode-openshift-connector-0.4.0-darwin-x64/out/tools/darwin/odo" registry list
d95776 commented 2 years ago

run /Users/hchen/.vscode/extensions/redhat.vscode-openshift-connector-0.6.0-darwin-x64/out/tools/darwin/odo-darwin-amd64 registry list get the following NAME URL SECURE DefaultDevfileRegistry https://registry.devfile.io No

d95776 commented 1 year ago

any one could still look at the issue?

dgolovin commented 1 year ago

@d95776 yes. Please try latest release of the CLI we use under the hood.

https://developers.redhat.com/content-gateway/file/pub/openshift-v4/clients/odo/v3.1.0/odo-darwin-amd64.tar.gz

odo-darwin-amd64 registry list

It supposed to show underlying cause when it cannot required info from the registry.

d95776 commented 1 year ago

./odo-darwin-amd64 registry list ⚠ Registry DefaultDevfileRegistry is not set up properly with error: Get "https://registry.devfile.io/index": context deadline exceeded (Client.Timeout exceeded while awaiting headers), please check the registry URL, and credential and remove add the registry again (refer to odo preference add registry --help)

✗ no deployable components found

d95776 commented 1 year ago

there's a proxy and how to pass it

dgolovin commented 1 year ago

@d95776 thanks! At least it shows the error now not just saying 'no components found'.

Could you check if you can access the registry with HTTPS_PROXY env var set as it is shown below?

HTTPS_PROXY=https://url-to-proxy odo-darwin-amd64 registry list

If that works I'll provide the setting to setup proxy for accessing the registry and you would be able to use the extension.

d95776 commented 1 year ago

tried HTTPS_PROXY=https://url-to-proxy odo-darwin-amd64 registry list and get same error. our proxy also requires certificate. for this request, how to set it up?

dgolovin commented 1 year ago

@d95776 I have no solution for that yet. There seems not way to configure sert using env vars. How do you configure that in OS?

d95776 commented 1 year ago

proxy are not set at OS level. we set proxy for each application. However, a lot of applications use env var http_proxy and certificate store is set differently for different app. May I ask why we need to access registry even we use on prem openshift? also can registry be a file and can be uploaded into the plugin?

dgolovin commented 1 year ago

May I ask why we need to access registry even we use on prem openshift? also can registry be a file and can be uploaded into the plugin?

Registry is a set of templates to start. If you already have your source code you you can just download devfile.yaml from the registry website and put it into project's root folder. Your project should be recognized as 'Component' and you would be able to run all applicable commands.

Another option is to deploy the registry on the same cluster and update default registry url to new one.

proxy are not set at OS level. we set proxy for each application. However, a lot of applications use env var http_proxy and certificate store is set differently for different app.

I suspect the lib used to communicate with registry is not looking up for any certs, but I have to confirm that with other team. That should be fixed.

d95776 commented 1 year ago

For < Registry is a set of templates to start. If you already have your source code you you can just download devfile.yaml from the registry website and put it into project's root folder. Your project should be recognized as 'Component' and you would be able to run all applicable commands.

I downloaded a java springboot devfile.yaml to one of my springboot application project's root. right click on the file, I can see a menu "Start Dev". My question now is what's the next step to make my sprngboot app deployed to openshift by using this tool? is there any step by step tutorial?

mohitsuman commented 1 year ago

@d95776 Once the component is available in the components View, do the following:

  1. Start Dev -> This will open up a terminal and you can see K8s resources getting created. Once they are done, the component will have Dev Running . You can see the component now in the Application Explorer, something like this.
Screenshot 2022-11-16 at 3 38 43 AM
  1. You can stop the component running in development mode by running Stop Dev command. This will also clear up the resources created in the cluster.

  2. If your spring-boot devfile has deploy and debug configurations, you can deploy the component on the cluster, by clicking the Deploy command. This will basically deploy your app on the cluster.

  3. Show Logs and Follow Logs work as previously to showcase the logs of the running container.

  4. Open in Browser will open the application using port-forwarding with the ports specified in the devfile.

We are going to add Step by Step Tutorial soon in the repository discussing all the scenarios.

dgolovin commented 1 year ago

@d95776 extension is built on top of OpenShift Do CLI. Please look at documentation here.