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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 45 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@ You can [watch how kubel started](https://www.youtube.com/watch?v=w3krYEeqnyk) o
## Features
We now support managing pretty much any resource!

- switch context and namespace
- show any resource (pods/services/deployments/etc)
- highlight a resource by name
- copy resource name to clipboard
- show and edit resource details
- show rollout history for a resource
- delete a resource
- tail container logs (possibly with `-f` follow flag)
- copy container log command to clipboard
- port forward a pod to your localhost
- exec into a pod using tramp
- quick run shell-command
- scale replicas
- Switch context and namespace.
- Show any resource (pods/services/deployments/etc).
- Highlight a resource by name.
- Copy resource name to clipboard.
- Show and edit resource details.
- Show rollout history for a resource.
- Delete a resource.
- Tail container logs (possibly with `-f` follow flag).
- Copy container log command to clipboard.
- Port forward a pod to your localhost.
- Exec into a pod using tramp.
- Multiple kubel buffers, each one with different context, namespace, and resource.
- Quick run shell-command
- Scale replicas

## Installation

Expand All @@ -35,24 +36,40 @@ load the `kubel-evil.el` file.

## Usage

To list the pods in your current context and namespace, call
```
M-x kubel
```
To set said namespace and context, respectively call
### `M-x kubel`

Call `kubel` to open a new kubel buffer. Call `kubel` again to start a new
session for a different context/namespace/resource.

Each kubel buffer will automatically be renamed using the following template:
```
M-x kubel-set-namespace
M-x kubel-set-context
*kubel session: |<context>|<namespace>|<resource>|*
```
Note that context will autocomplete but not necessarily namespaces
depending on your permissions and cluster setup.
See the [customize section](#Customize) on how to tune `kubel-use-namespace-list`.

To switch to showing a different resource, use the `R` command or
```
M-x kubel-set-resource
### `M-x kubel-refresh`

Call `kubel-refresh` or hit `g` (`x` in evil-mode) to refresh the current kubel buffer using the
configured context/namespace/resource for that session.

### `M-x kubel-open`

Call `kubel-open` to programmatically open a new session for the passed context,
namespace, and resource.

```lisp
(kubel-open "<context>" "<namespace>" "<resource>*kubel session: |management-deploys-us-east1-2|gkrane-jobs|Pods|*")
```
This will let you select a resource and re-display the kubel buffer.

### Changing context, namespace, and resource for a kubel session

To change the context, namespace, or resource for a session, call:
- `M-x kubel-set-context` or hit `C`.
- `M-x kubel-set-namespace` or hit `n`.
- `M-x kubel-set-resource` or hit `R`.

Note that context will autocomplete but not necessarily namespaces depending on
your permissions and cluster setup. See the [customize section](#Customize) on
how to tune `kubel-use-namespace-list`.

## Shortcuts

Expand All @@ -64,7 +81,7 @@ h => help popup
? => help popup
! => quick run shell-command
E => quick edit any resource
g => refresh
g => refresh (`x` in evil-mode)
k => delete popup
r => see the rollout history for resource
p => port forward pod
Expand Down
6 changes: 3 additions & 3 deletions kubel-evil.el
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
;; C => set context
;; n => set namespace
;; R => set resource
;; g => refresh pods
;; x => refresh pods
;; E => quick edit
;; p => port forward pod
;; e => exec into pod
Expand Down Expand Up @@ -77,7 +77,7 @@
;; global
("RET" "Resource details" kubel-describe-popup)
("E" "Quick edit" kubel-quick-edit)
("g" "Refresh" kubel)
("x" "Refresh" kubel-refresh)
("d" "Delete" kubel-delete-popup) ;; can't use k here
("r" "Rollout" kubel-rollout-history)]
["" ;; based on current view
Expand Down Expand Up @@ -112,7 +112,7 @@
(kbd "K") #'kubel-set-kubectl-config-file
(kbd "C") #'kubel-set-context
(kbd "n") #'kubel-set-namespace
(kbd "g") #'kubel
(kbd "x") #'kubel-refresh
(kbd "h") #'kubel-evil-help-popup
(kbd "?") #'kubel-evil-help-popup
(kbd "F") #'kubel-set-output-format
Expand Down
Loading