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

Support for multiple Kubel buffers, each one using a different combination of Contex, Namespace, Resource, Filters, and Labels. #57

Closed
wants to merge 19 commits into from

Conversation

d1egoaz
Copy link
Contributor

@d1egoaz d1egoaz commented Aug 20, 2021

Add support to have multiple and functional kubel buffers, each one using a different combination of Contex, Namespace, Resource, Filters, Labels, last command,

image

Closes #54

Some notes:

  • Kubel mode is only set once when the buffer is created.
  • Now when kubel is called, it'll always create a new buffer with fresh variables for
  • context, namespace, and resource.
  • Stop killing existing buffer when changing objects, instead, a new function
  • kubel-refresh is now taking care of displaying/refreshing current configuration.
  • Show a message when the command is being executed, to easily tell if a command
    is being executed.

- Kubel mode is only set once when the buffer is created.
- Now when `kubel` is called, it'll always create a new buffer with fresh variables for
- context, namespace, and resource.
- Stop killing existing buffer when changing objects, instead, a new function
- `kubel-refresh` is now taking care of displaying/refreshing current configuration.
- Show a message when the command is being executed, to easily tell if a command
  is being executed.
When there are too many kubel buffers is hard to differentiate what buffer
belongs to an specific cluster/namespace
I added pipe and colon to buffer name, pretty sure that will not work in Windows
It wasn't taking into account parent cluster,buffer from where it was created
@d1egoaz
Copy link
Contributor Author

d1egoaz commented Sep 16, 2021

Hey @abrochard

I added some more commits to fix an issue regarding kubectl apply (it wasn't working as I wasn't passing the context/namespace).

@d1egoaz
Copy link
Contributor Author

d1egoaz commented Sep 16, 2021

Please 👀 and test, as most of the time I work on a different version of this package (different caching, single kubel process and err buffer process, I also plan to send some PRs after this gets 👍 or 👎), I only use this branch to send upstream changes.

@abrochard abrochard mentioned this pull request Oct 12, 2021
@d1egoaz
Copy link
Contributor Author

d1egoaz commented Oct 14, 2021

I merged latest master on top of the branch.

README.md Outdated
@@ -54,6 +55,11 @@ M-x kubel-set-resource
```
This will let you select a resource and re-display the kubel buffer.

You can also use `kubel-open` to open directly a kubel buffer with the given parameters, example:
``` lisp
(kubel-open "custom-context" "custom-namespace" "custom-resource"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

big fan of this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using it every day, you get a lot of time back as you don't need to wait for getting the list of context, list of namespaces and get list of pods, you can go directly to where you're interested.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's really sweet. I'm also gonna hook it up to magit post-commit or something so I can monitor my deployment once I push a release.

README.md Outdated Show resolved Hide resolved
@abrochard
Copy link
Owner

abrochard commented Nov 17, 2021

Hi @d1egoaz ,
Thank you for your patience! I finally got around to testing this and I found a workflow-breaking bug. Here is how I repro:

  1. start fresh (kill all kubel buffers)
  2. call M-x kubel and drop into my default context/namespace
  3. press C to switch context and jump into another context (or press n to switch to another namespace)
  4. press g to refresh my view
  5. my buffer jumps back to my default context/namespace

I feel that pressing g should refresh the buffer I'm currently viewing, not the previously opened one here.

@d1egoaz
Copy link
Contributor Author

d1egoaz commented Mar 5, 2022

Hi @d1egoaz , Thank you for your patience! I finally got around to testing this and I found a workflow-breaking bug. Here is how I repro:

  1. start fresh (kill all kubel buffers)
  2. call M-x kubel and drop into my default context/namespace
  3. press C to switch context and jump into another context (or press n to switch to another namespace)
  4. press g to refresh my view
  5. my buffer jumps back to my default context/namespace

I feel that pressing g should refresh the buffer I'm currently viewing, not the previously opened one here.

Thanks for the feedback.

Let me try to review this again, I'll stop working on my personal/work branch and just move to use this PR branch so I can be fully committed with this change.

I was able to confirm the bug, let me try to find the 🐛

@d1egoaz
Copy link
Contributor Author

d1egoaz commented Mar 6, 2022

Huh, for some reason g is not calling kubel-refresh but kubel (using describe-key)l

If I run M-x kubel-refresh it works as expected.

going to check what did I do with the keybindings

@d1egoaz
Copy link
Contributor Author

d1egoaz commented Mar 6, 2022

I'm not sure why evil-define-key don't like mapping g 🤷

That said, I'm using a different key for refreshing the kubel session, as I found that I needed g for movement.

It'd be great in a future PR to follow the evil collection guidelines regarding the keys that might be used

I just sent a PR with the fix, s/g/x

@abrochard
Copy link
Owner

Hmm I'm really not a fan of updating the binding. I don't use evil so maybe it makes sense there to update to match the guidelines, but for regular mode, I find it very disruptive to change from g to x

@d1egoaz
Copy link
Contributor Author

d1egoaz commented Mar 11, 2022

Hmm I'm really not a fan of updating the binding. I don't use evil so maybe it makes sense there to update to match the guidelines, but for regular mode, I find it very disruptive to change from g to x

yeah, sorry about that, I don't use the normal mode, I'll make the change only for evil, I just pushed a new commit

@d1egoaz
Copy link
Contributor Author

d1egoaz commented Mar 11, 2022

🤔 if you're not using evil, I wonder how did you hit the bug? unless it's breaking for some other reason. When you have some time please check the bindings on your side to see what' the values for kubel-mode-map

@abrochard
Copy link
Owner

Hey @d1egoaz , Sorry for the super late reply!

I did another test of this just now, and there's definitely something weird on my side when loading the code and I need to manually force refresh the mode map. After I do, the g seems to behave correctly.

However, even after doing that, I see some weird behavior when I switch context.

  1. if I'm in a kubel buffer and I hit C and pick another context, the new context replaces the old one and I can't find the old context buffer anymore
  2. if i'm not in a kubel buffer and invoke kubel-set-context, it doesn't create a kubel buffer and instead fills up whatever buffer i'm in with the kubel outpout

@d1egoaz
Copy link
Contributor Author

d1egoaz commented Aug 16, 2022

Hey, I'm close this for now, I've been OOO and OOC (computer) for several months as I was on paternity leave. I'll try to replicate your issues on my side, I used this fork for months without issues, I'd like to test on a vanilla emacs without my configuration to see if that's the issue.

I'll try to return here in some months with a validated PR.

Thanks

@d1egoaz d1egoaz closed this Aug 16, 2022
TxGVNN pushed a commit to TxGVNN/kubel that referenced this pull request Sep 11, 2023
TxGVNN pushed a commit to TxGVNN/kubel that referenced this pull request Sep 11, 2023
abrochard added a commit that referenced this pull request Dec 24, 2023
* Multi buffers support (take #57 and rebase)

* Add kubel--read-buffer, improve kubel-refresh and kubel command

---------

Co-authored-by: Diego Alvarez <diego.canada@icloud.com>
Co-authored-by: Adrien Brochard <abrochard@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

[feature-request] option to have multiple kubel buffers (instances)
2 participants