Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to bring back Logs/Exec into node/pod buttons? #83

Closed
sanarena opened this issue Dec 27, 2022 · 27 comments
Closed

Is it possible to bring back Logs/Exec into node/pod buttons? #83

sanarena opened this issue Dec 27, 2022 · 27 comments

Comments

@sanarena
Copy link

Looking at OpenLens latest version here, lensapp/lens#6823 (comment), they've removed extension responsible for those buttons.
Is there anyway for us to bring them back into this fork? for example in pipeline, before building the binaries, add back the extension (possible?) and then build the binaries.

@sanarena sanarena changed the title Is it possible to bring back Logs/Exec into node/pod buttons back? Is it possible to bring back Logs/Exec into node/pod buttons? Dec 27, 2022
@gdlx
Copy link
Contributor

gdlx commented Dec 27, 2022

The easiest may be to revert the commits that remove the in-tree extensions. But that may eventually be hard to maintain.
The cleanest would be to include them as external extensions, that should be maintained on their own repos...

@onedr0p
Copy link

onedr0p commented Dec 27, 2022

@sanarena this repo isn't a fork it just builds Lens without the auth requirement. But maybe it's time for someone to fork Lens properly.

@gdlx
Copy link
Contributor

gdlx commented Dec 27, 2022

@sanarena this repo isn't a fork it just builds Lens without the auth requirement. But maybe it's time for someone to fork Lens properly.

This repo actually builds and packages OpenLens so, patching to restore in-tree extensions, or include external extensions into the package could be acceptable.

Forking and maintaining the whole Lens repo would be another kind of story...

We may also ask AWS/Azure to buy Mirantis and release Lens for free 😋

@sanarena
Copy link
Author

I was looking at how they removed it. They removed extensions folder. and changed packages.json to load extensions
Maybe if we checkout extensions folder from tag v6.2.5 into current release and add missing codes in package.json to latest version package.json files via pipeline, we can have those extensions back?

@jkroepke
Copy link
Collaborator

jkroepke commented Dec 27, 2022

I had the same idea. Pretty sure. lens will change the extension API just to make the old extensions non compatible.

Since this repository is not going to modify the source code, I personally prefer out of tree extensions, instead keeping them in-tree.

The current solution is to stay on 6.2.x and hope for a fork or complete Alternative solutions. Its basic a cat and mouse game now that the free version always lose.

@gdlx
Copy link
Contributor

gdlx commented Dec 27, 2022

One could actually just fork the missing extensions into distinct repos, that could be packaged here. I could take a look if it isn't much more than copy/paste/config but I'm no JS developer so I won't maintain the code.

I don't think they will break the extension API soon as there are other existing extensions and dropping them would push more users out of Lens.

@alebcay
Copy link

alebcay commented Dec 28, 2022

In a pinch, I've managed to separate out the extensions from 6.2.6 into https://github.com/alebcay/openlens-extensions. Needed a few adjustments to get it to build correctly outside of the Lens tree. For myself at least, so far it is working fine with 6.3.0.

It's getting late so I don't have any ready-to-use downloads up but there's instructions in there on how to use this with your local installation of OpenLens.

Open to moving this into an org if there are more people interested in maintaining it. Thankfully, most of the nitty gritty bits (e.g. creating a terminal window) are abstracted into Lens' extension API, so the actual extensions themselves are pretty lightweight.

@jkroepke
Copy link
Collaborator

@MuhammedKalkan Do you want to create an an org, like openlens-distribution?

@gdlx
Copy link
Contributor

gdlx commented Dec 28, 2022

@alebcay I just tested the pod menu extension and it works fine with 6.3.0, thanks !

I can't try node menu as I can't directly connect to my nodes but the button is there and it tries to connect...

Not sure if the 2 other ones are useful as I have events on all objects (it's a 6.3.0 new feature) and cluster metrics with or without the respective extensions...

@alebcay
Copy link

alebcay commented Dec 28, 2022

Thanks for giving it a try. I'm not sure about the other two extensions either since I really only use the pod/node menus. Didn't realize they added the events as a new feature. I just included everything from the extensions folder, those two might not be needed I guess.

@gdlx
Copy link
Contributor

gdlx commented Dec 28, 2022

@alebcay Here is the events new feature: lensapp/lens#6468
I'm not sure there is a relation between it and the events extension (I'd need to build 6.2.5 without the events extension to confirm...) but 6.3.0 without the extension clearly works as expected.

@EvertonSA
Copy link

I tried adding code on v6.2.5 to master HEAD (v6.4.0) and it breaks very ugly. I think there are no reasonable workarounds besides use v6.2.5 or wait until they are listed here https://github.com/lensapp/lens-extensions

@alebcay
Copy link

alebcay commented Dec 28, 2022

I tried adding code on v6.2.5 to master HEAD (v6.4.0) and it breaks very ugly. I think there are no reasonable workarounds besides use v6.2.5 or wait until they are listed here lensapp/lens-extensions

I was also able to get the pod/node menus back in current 6.4.0-alpha.0 (HEAD at lensapp/lens@e59ec3a) as built-in rather than out-of-tree extensions. See commits:

Even so, this approach is definitely messier and will get even messier in the long run. Building and maintaining the extensions separately is probably the easier way for now.

@marafa-sugarcrm
Copy link

@alebcay - i thank you for your efforts to help the community. i will be (im)patiently waiting for you to build releases so i can use them from within openlens

@alebcay
Copy link

alebcay commented Dec 29, 2022

Based on feedback in this thread, sounds like only the node-menu and pod-menu extensions are really needed - the other two are now baked into OpenLens itself. If this isn't the case, we can pull those other two extensions out into another repo and maintain them separately.

I have renamed my repository to https://github.com/alebcay/openlens-node-pod-menu. It now only contains the functionality for node-menu and pod-menu, combined into a single extension.

The README in that repo still reflects how to build and use it from source locally, but you can also simply type @alebcay/openlens-node-pod-menu into the Extensions UI in OpenLens and it should install automatically now from https://www.npmjs.com/package/@alebcay/openlens-node-pod-menu.

@marafa-sugarcrm
Copy link

The README in that repo still reflects how to build and use it from source locally, but you can also simply type @alebcay/openlens-node-pod-menu into the Extensions UI in OpenLens and it should install automatically now from https://www.npmjs.com/package/@alebcay/openlens-node-pod-menu.

@alebcay THANK YOU! - can you also add that to the readme?
@MuhammedKalkan - the readme here should also either point to the extensions repo or have that ^^ line added. both would be best. again thank you

@MuhammedKalkan
Copy link
Owner

@marafa-sugarcrm done.
@alebcay Can we get updates for these extensions in future, or sources are closed from now on? Maybe we can make these default installed and somehow add it to workflow so ppl wont have to install manually?

@jkroepke we can but i am worried about something. Lens team plans to make openlens an npm package and already started to rip things apart. This repo never meant to be a complete fork and it seems things are heading that way.

@alebcay
Copy link

alebcay commented Jan 2, 2023

Can we get updates for these extensions in future, or sources are closed from now on?

Based on lensapp/lens#6823 (comment), it sounds like the latest version of Lens Desktop is still based on 6.2.x, even though it was released after 6.3.0 was tagged. It seems that Mirantis has not yet released a version of Lens Desktop based on 6.3.0 in which these features have been removed from the core app codebase. So the future of where the code for this feature will live, even in the proprietary version, has not yet been decided.

From a code perspective, most of the extension's functionality (e.g. opening a terminal tab, adding a button to the drop down menu, adding the attach/logs/exec icons to the details pane) are all provided by the Lens extensions API itself.

While this functionality could certainly change in the future, I don't see it going away in the API, since it would heavily impact any extensions that want to use these UI features. If Mirantis wants to have any hope of incentivizing anyone (vendors or OSS community) to build extensions on their platform, they're going to need to have some amount of API stability.

Maybe we can make these default installed and somehow add it to workflow so ppl wont have to install manually?

I don't see any obvious way to do this. There appears to be code that facilitates loading bundled extensions but not really any documentation or examples of where/how to add bundled extensions. I've opened lensapp/lens#6855 to request that this information be made available and preferably documented.

@MuhammedKalkan
Copy link
Owner

Ok we will wait and see then. Closing this one, since the solution seems fine for now. Feel free to open another if something comes up

@dhdnicodemus
Copy link

I tried install the extension, I still don't see these menus, especially missing pod logs and exec. MacOS 6.3.0
Do I need to do something else to enable this?

@cloud-versity
Copy link

I tried install the extension, I still don't see these menus, especially missing pod logs and exec. MacOS 6.3.0 Do I need to do something else to enable this?

Running MacOS Ventura and 6.4.0 alpha and I can confirm that it still works.

@dhdnicodemus
Copy link

It appears the the Extension install failed or got stuck, the dist directory was never isntalled into the .k8lens folder, so I ended up copying that by hand and it worked after that.

@azelezni
Copy link

Amazing, even after breaking away from lensapp/lens, they still manage to make everyone's life harder.
For reference, the latest "working" version is 6.2.5

@arcreative
Copy link

@azelezni did you read above for the solution, or are you just here to complain?

@qkflies
Copy link

qkflies commented May 28, 2023

@alebcay Hey, noticed that the changes implemented in lensapp/lens#7359 (which closed your initial inquiry lensapp/lens#6855) have now been released in stable OpenLens v6.5.0.

Have tried building from the source repository by adding your npm module @alebcay/openlens-node-pod-menu to the dependencies section as demonstrated in this part of the MR, but it doesn't seem to actually bundle the extension.

# snippet starts Line 179: https://github.com/lensapp/lens/blob/79e4eaa39461488bea3a3d9e872d12ce94e09662/open-lens/package.json#L179
"dependencies": {
    "@alebcay/openlens-node-pod-menu": "0.1.0",
    "@astronautlabs/jsonpath": "^1.1.0",
    "@hapi/call": "^9.0.1",
    ...
}

Any thoughts on what other changes might need to be made to bundle your extension into the built app? Thanks in advance for your consideration.

@alebcay
Copy link

alebcay commented May 31, 2023

I've given it a try on my local machine and haven't gotten it to be able to be bundled either. Not sure what other steps might be needed to get it to work.

Maybe it's worth trying with another extension and seeing if that works? Hoping that would help establish whether it's something weird about this particular extension or if it's a matter of some requirement that the Lens folks have not documented adequately (or is lost somewhere in that PR and hard to notice).

@qkflies
Copy link

qkflies commented May 31, 2023

I threw a bunch of extensions in there (including one of Mirantis' first party), and none of them made it along for the ride. So, back to asking them what else is needed to make it bundle.

# plugins added to the dependency section of `open-lens/package.json`
"@alebcay/openlens-node-pod-menu": "0.1.0",
"@andrea-falco/lens-multi-pod-logs": "0.3.1",
"@kubescape/lens-extension": "0.2.4",
"@mirantis/lens-extension-cc": "5.6.0",
"@ottimis/lens-version-update": "1.2.0",
"lens-certificate-info": "3.0.1",
"lens-extension-network-policy-viewer": "3.0.0"

I will say that it's particularly galling that the legacy-extension-sample consistently makes it, but nothing else that is injected does 😅.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests