lensapp / lens

Lens - The way the world runs Kubernetes
https://k8slens.dev/
MIT License
22.55k stars 1.47k forks source link

Extension samples out of date #8118

Open AnthonyDewhirst opened 1 week ago

AnthonyDewhirst commented 1 week ago

Describe the bug I am trying to install the Trivy extension, but I believe it to be very out of date. This isn't the issue :-) The issue is that I am not a node developer, but decided I would try tp update the extension for them. So I went to your documentation to see if I could work out what the issue was. I started in on your getting started samples for extensions, but firstly, there doesn't seem to be windows documentation and it assumes linux/mac. But the samples haven't been touched in 3 years it seems and now I am spending my time trying to work out/ remember node work to get a working dev env for this and then to get even the sample working. Ironically, the error I get from the sample is the same issue I get from the trivy extension

To Reproduce Steps to reproduce the behavior:

  1. clone the sample repo for the extensions https://github.com/lensapp/lens-extension-samples
  2. follow the instructions within the repo to get the helloworld-sample working
  3. Get lots of errors!
  4. I have updated the devDependencies, slowly figured out which version of node to use and got a build
  5. Then in lens nothing, but the console shows an exception

Expected behavior the build to work and can see the extension working in lens.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Lens: 2024.8.291605-latest Extension API: 6.10.39 Electron: 27.3.11 Chrome: 118.0.5993.159 Node: 18.17.1

Logs: When you run the application executable from command line you will see some logging output. Please paste them here:

Your logs go here...
renderer.js:2 You are loading @emotion/react when it is already loaded. Running multiple instances may cause problems. This can happen if multiple versions are used, or if multiple builds of the same version are used.
70917 @ renderer.js:2
BrowserConsole.js:47 [EXTENSIONS-LOADER]: can't load renderer for "@k8slens/helloworld-sample": Error: Cannot find module 'C:\Users\lrsdev\AppData\Roaming\Lens\node_modules\@k8slens\helloworld-sample\dist\renderer.js'
Require stack:
- electron/js2c/renderer_init
    at node:internal/modules/cjs/loader:1084:15
    at Function._resolveFilename (node:electron/js2c/renderer_init:2:4971)
    at node:internal/modules/cjs/loader:929:27
    at Function.<anonymous> (node:electron/js2c/node_init:2:13357)
    at Function._load (node:electron/js2c/renderer_init:2:33264)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at ExtensionLoader.requireExtension (https://cdaf444b089902000a2306b644aab238.lens.app:59290/build/lens.js?1375bf64dca9fa8f02f9:581234:21)
    at https://cdaf444b089902000a2306b644aab238.lens.app:59290/build/lens.js?1375bf64dca9fa8f02f9:581187:43
    at Array.map (<anonymous>) Object
push../node_modules/winston-transport-browserconsole/dist/BrowserConsole.js.BrowserConsole.log @ BrowserConsole.js:47

**Kubeconfig:**
Quite often the problems are caused by malformed kubeconfig which the application tries to load. Please share your kubeconfig, remember to remove any secret and sensitive information.

your kubeconfig here



**Additional context**
Add any other context about the problem here.
Christiaanvdl commented 3 days ago

Hello @AnthonyDewhirst thank you for reaching out ! I have contacted our development team about your issue

dechegaray commented 3 days ago

Hello @AnthonyDewhirst. You are right, our documentation for extensions development is outdated. We did major changes to our architecture throughout this year and we are currently working on a new API that will be exposed for these purposes. When that work is finally completed we'll publish a new documentation for our users working on this area.

It would be a bit difficult to get the sample extension working given the changes we have been implementing, so my recommendation would be to wait for the new API and documentation to come out. We'll make sure it is more accurate and easier to follow.

AnthonyDewhirst commented 3 days ago

Hi Daniel,

That's great to hear. I am loving Lens so far and look forward to this...however... I actually wasn't looking to write my own extension, only that I can't get any extensions to work at the moment as they don't seem to install.

I have been trying to use the Trivy extension and it, like another I tried, just get stuck in installing. As I would really like to use the Trivy extension and it didn't seem to be working and their devs haven't responded in a while it seems, I decided that I would try to get it working again. Hence why I started looking at what it takes to write one and if there had been changes since they wrote it.

Circling back, this brings me to a few questions:

Trivy extension at: https://github.com/aquasecurity/trivy-operator-lens-extension

Any help would be very much appreciated.

Thanks Anthony

On Tue, 12 Nov 2024 at 18:21, Daniel Echegaray @.***> wrote:

Hello @AnthonyDewhirst https://github.com/AnthonyDewhirst. You are right, our documentation for extensions development is outdated. We did major changes to our architecture throughout this year and we are currently working on a new API that will be exposed for these purposes. When that work is finally completed we'll publish a new documentation for our users working on this area.

It would be a bit difficult to get the sample extension working given the changes we have been implementing, so my recommendation would be to wait for the new API and documentation to come out. We'll make sure it is more accurate and easier to follow.

— Reply to this email directly, view it on GitHub https://github.com/lensapp/lens/issues/8118#issuecomment-2471257953, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE44CIB5F4D4P4NJBFGAX32AJBJFAVCNFSM6AAAAABRI4DDB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZRGI2TOOJVGM . You are receiving this because you were mentioned.Message ID: @.***>

dechegaray commented 3 days ago

Understood @AnthonyDewhirst.

- Should existing extensions work with Lens as it is currently or are they broken? In general, existing extensions should still work in the version of Lens you are using. 2024.8.291605-latest is our legacy version (a bit old already) still supporting the old extension architecture, so they should work. Having said that, since this is a third-party extension, not maintained by us, we cannot guarantee that it is operational. To be honest, given how long ago it was the last commit, not sure since when this has not been fully functional. It would be the responsibility of the author to ensure it works.

- When do you expect the work to be completed? We shipped recently a fully redesigned Lens (available through downloads only at https://k8slens.dev/) and there is an even better beta version we released last week https://forums.k8slens.dev/t/lens-2024-11-51849-beta-beta-release/3825. We are still stabilizing this new version, so as soon as that work is done we'll have a better idea on when we could ship the new extension support (still TBD).

- If the first point is the problem, how can I then go about trying to get extensions to work and know what to do to fix the Trivy one? If you are in need of some vulnerability reporting within Lens, we do offer as part of our Pro subscription a Security Center that leverages Trivy for all kind of security reporting (images, roles, kube resources, etc) -> https://docs.k8slens.dev/security-center/. You could check if it is an option for you.

You could also fork the repo and try to fix the extension yourself, but it might be a hassle given our docs are outdated, and we currently don't have the bandwidth to fix remaining issues for the legacy version on this area given the changes we are aiming to bring very soon.

We apologize for that.