Giter VIP home page Giter VIP logo

kubernetes-el's Introduction

kubernetes-el

Build Status codecov MELPA Stable MELPA License GPL 3

Manage your Kubernetes clusters with Emacs.

Screenshot of Kubernetes Emacs client

For full documentation, please visit kubernetes-el.github.io/kubernetes-el.

Stargazers over time

Stargazers over time

Known Issues

Disabling automatic refresh helped many to solve issue #100. For example one can use the following configuration:

(use-package kubernetes
  :ensure t
  :commands (kubernetes-overview)
  :config
  (setq kubernetes-poll-frequency 3600
        kubernetes-redraw-frequency 3600))

kubernetes-el's People

Contributors

ageekymonk avatar chrisbarrett avatar cwhatley avatar darth10 avatar dickmao avatar egh avatar fbergroth avatar fritzgrabo avatar jinnovation avatar jypma avatar khapota avatar lcaballero avatar noorul avatar novasharper avatar olymk2 avatar peterbecich avatar syohex avatar walheimat avatar zaks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kubernetes-el's Issues

Cannot load overview

When trying to load the overview, I get the following errors

Type v to switch between resources, and ? for usage.
pcase-memoize: equal first branch, yet different [2 times]
Error running timer ‘kubernetes-state-trigger-redraw’: (wrong-type-argument magit-section [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil])
pcase-memoize: equal first branch, yet different [3 times]
error in process sentinel: kubernetes-process-kill-quietly: Wrong type argument: magit-section, [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil]
error in process sentinel: Wrong type argument: magit-section, [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil]
pcase-memoize: equal first branch, yet different [21 times]
error in process sentinel: kubernetes-process-kill-quietly: Wrong type argument: magit-section, [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil]
error in process sentinel: Wrong type argument: magit-section, [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil]
pcase-memoize: equal first branch, yet different [3 times]
Error running timer ‘kubernetes-state-trigger-redraw’: (wrong-type-argument magit-section [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil])
error in process sentinel: kubernetes-process-kill-quietly: Wrong type argument: magit-section, [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil]
error in process sentinel: Wrong type argument: magit-section, [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil]
error in process sentinel: Quit [6 times]
pcase-memoize: equal first branch, yet different [3 times]
Error running timer ‘kubernetes-state-trigger-redraw’: (wrong-type-argument magit-section [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil])
error in process sentinel: kubernetes-process-kill-quietly: Wrong type argument: magit-section, [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil]
error in process sentinel: Wrong type argument: magit-section, [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil]
error in process sentinel: Quit [2 times]

I am on version 0.12.0 and have magit version 2.12.1

wrong-type-argument arrayp nil

I get this error in overview:

Error running timer ‘kubernetes-state-trigger-redraw’: (wrong-type-argument arrayp nil) [3 times]

Preserve position in buffer when re-rendering

Right now, the AST render function erases and rebuilds the whole buffer, which resets point. Investigate ways of preserving point between rendering runs.

One approach could be to preserve the line and column offset within the current section. More complicated would be to implement a render system that only changes parts of the buffer corresponding to changed parts of the AST.

`kubernetes-overview` errors on contexts without a namespace

The contexts in my .kube/config do not have a namespace specified. This results in the following error when calling kubernetes-overview:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  propertize(nil face kubernetes-namespace)
  kubernetes-contexts--render-current-context(((name . "minikube") (context (cluster . "minikube") (user . "team"))) nil)

kubectl uses the default namespace for these contexts. Perhaps kubernetes-el could use the same default?

Implement support for openshift

If used against openshift you may hit the following error:

Error from server (Forbidden): User "iocanel" cannot list all namespaces in the cluster

which is a result of using:

 kubectl get namespaces -o json --namespace=syndesis-ci

I think that for openshift it would make more sense to use something like:

oc get projects -o json --namespace=syndesis-ci

Window line position lost on buffer redraw

Buffers that provide live-refreshing features, e.g. the overview, are erased and re-populated with the current state on every redraw. Currently the position in the buffer is retained, but the window line position is lost. This is very noticeable when scrolling, as the window can shift unpredictably when a redraw occurs.

To resolve this, either save the window line during redraw (easy), or come up with a better way of updating the buffer (hard).

Switching namespace looses choosen view

Steps to reproduce.

Assume that we have selected namespace1

Press 'v' and go to 'pods' view

Now press 'c' and change press 'n' to set different namespace2

Now the page is re-drawn with the default view with deployments.

I think we should retain the selected view while switching namespace.

yaml array isn't formatted properly

I was looking at a yaml array (container args) and noticed it wasn't outputting each element on a new line. Instead they're all smushed together on one line.

I'm not sure if this a bug in the yaml library or kubernetes-el.

screen shot 2018-04-04 at 10 53 44 am

Get deployments

Get deployments, much in the same way that pods are currently handled.

Relates to #34.

`kuberenetes-el` makes Emacs on OSX crash after a few minutes

I don't have any idea what causes it. I'm using Emacs 25 from MacPorts, and I'm on revision 03afbbd5029339c6a4fa3fe4ff79b4818f062295 of kubernetes-mode.

$ emacs -nw
# wait for a few minutes on "kubernetes-overview".
Fatal error 6: Abort trap
Backtrace:
0   emacs                               0x00000001000d67f5 emacs_backtrace + 325
1   emacs                               0x00000001000b741d terminate_due_to_signal + 93
2   emacs                               0x00000001000d46d3 emacs_abort + 19
3   emacs                               0x00000001000d48a0 child_status_changed + 64
4   emacs                               0x000000010018506a handle_child_signal + 234
5   emacs                               0x00000001000d5d25 deliver_process_signal + 69
6   libsystem_platform.dylib            0x00007fff9f782b3a _sigtramp + 26
7   ???                                 0x000000000000002f 0x0 + 47
8   emacs                               0x000000010017d6c9 create_process + 1257
9   emacs                               0x000000010017ca51 Fmake_process + 2705
10  emacs                               0x00000001001395da Ffuncall + 938
11  emacs                               0x0000000100177ac2 exec_byte_code + 2562
12  emacs                               0x00000001001394f3 Ffuncall + 707
13  emacs                               0x0000000100177ac2 exec_byte_code + 2562
14  emacs                               0x00000001001394f3 Ffuncall + 707
15  emacs                               0x0000000100177ac2 exec_byte_code + 2562
16  emacs                               0x00000001001394f3 Ffuncall + 707
17  emacs                               0x0000000100177ac2 exec_byte_code + 2562
18  emacs                               0x00000001001394f3 Ffuncall + 707
19  emacs                               0x000000010013993f Frun_hook_with_args + 255
20  emacs                               0x00000001001397c4 Frun_hooks + 68
21  emacs                               0x00000001001395da Ffuncall + 938
22  emacs                               0x0000000100177ac2 exec_byte_code + 2562
23  emacs                               0x00000001001394f3 Ffuncall + 707
24  emacs                               0x00000001001395da Ffuncall + 938
25  emacs                               0x0000000100177ac2 exec_byte_code + 2562
26  emacs                               0x000000010013a55a funcall_lambda + 810
27  emacs                               0x00000001001394f3 Ffuncall + 707
28  emacs                               0x000000010013a00c call1 + 44
29  emacs                               0x00000001000c3cc5 timer_check + 997
30  emacs                               0x00000001000c2455 swallow_events + 133
31  emacs                               0x0000000100180efa wait_reading_process_output + 3290
32  emacs                               0x0000000100007e02 sit_for + 242
33  emacs                               0x00000001000bfeb6 read_char + 5574
34  emacs                               0x00000001000bcaf3 read_key_sequence + 2467
35  emacs                               0x00000001000bb1e4 __command_loop_1_block_invoke + 596
36  emacs                               0x00000001001ccf6f mac_autorelease_loop + 47
37  emacs                               0x00000001000baea6 command_loop_1 + 790
38  emacs                               0x0000000100137ed5 internal_condition_case + 261
39  emacs                               0x00000001001ccf6f mac_autorelease_loop + 47
40  emacs                               0x00000001000ca560 command_loop_2 + 16
...
^C^C^C^C^C^C^C^Z
[1]  + 19509 suspended  emacs -nw

$ emacs --version
GNU Emacs 25.2.2
Copyright (C) 2017 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

$ uname -a
Darwin utkumovio.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64 i386 MacBookPro11,4 Darwin```

kubernetes-overview fails with an error

I'm running latest version of magit and kubernetes from melpa

Magit 20180313.1552, Git 2.13.3, Emacs 25.3.1, darwin
kubernetes-el: 0.12.0

kubectl commands run fine on the same machine.

Following is the output from Messages

Error running timer ‘kubernetes-state-trigger-redraw’: (wrong-type-argument magit-section [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil])
pcase-memoize: equal first branch, yet different [3 times]
kubernetes-ast-eval: Wrong type argument: magit-section, [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil ...] ...] ...]
pcase-memoize: equal first branch, yet different [3 times]
Error running timer ‘kubernetes-state-trigger-redraw’: (wrong-type-argument magit-section [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil])
pcase-memoize: equal first branch, yet different [3 times]
Error running timer ‘kubernetes-state-trigger-redraw’: (wrong-type-argument magit-section [eieio-class-tag--magit-section context nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in *kubernetes overview*> nil nil nil nil nil nil nil] nil] nil])

Support using kubectl through SSH

It would be nice to support running kubectl through tramp.

Use-case: Kubernetes is isolated from the internet. You need to ssh in to a cluster to get access.

Inherit from standard faces

Some of the faces provided by this package are copy-pasted from Magit. Search for builtin faces that make sense to use instead.

Propagate kubectl settings through exec commands

Currently, the kubectl exec popup ignores the configuration popup's KUBECONFIG setting.

This means that when execing into pods, we will fail if we need to use a non-default kubeconfig file.

Setting this to point to a file will only update the configurations window (which will work fine). When running the exec commands, we can see all the running pods, but the actual exec command will not run with the --kubeconfig option enabled.

I fix this in my own environment by adding
(push '"--kubeconfig=/path/to/my/kubecofig/kubeconfig.yaml" args)
at line 121 .... But there must be a better way!
Rocking package, by the way! I'm the envy of the office!

kubeconfig not passed to logging command

Hey,

When I press try to open the logs of a pod (l l) on the pods view (v pods <enter>), it is trying to run:

kubectl logs <container name> --namespace=

instead of:

kubectl --kubeconfig=<my config> logs <container name> --namespace=

Probably the same as #64 but for logging instead of exec

P.S. The namespace is blank there because it is trying to use the namespace set in config rather than the namespace of the selected pod and I have a workaround so I can see pods in all namespaces

Functionally pure state handling

The core implementation of the application state should be functionally pure. Probably something modelled after redux. This will enable easier unit testing of state transitions.

kubernetes-use-context moves point in current buffer

Thanks for your work on kubernetes-el!

Calling kubernetes-use-context outside of kubernetes-overview causes the point in the current buffer to move to the start of the buffer. To reproduce:

  • Open a buffer
  • Move point to end of the buffer
  • M-x kubernetes-use-context
  • Select a context
  • Point is moved to the beginning of the buffer

Can't see logs of pod with multiple containers

Hi!
I'm trying to view the logs of a pod with two containers and it is giving me the same error you would get if you did kubectl logs mypod instead of kubectl logs mypod mycontainer

Error from server (BadRequest): the server rejected our request for an unknown reason (get pods mypod)

Process kubernetes-exec exited abnormally with code 1

is there a way of working around this?

Steps to reproduce:

  1. M-x kubernetes-overview
  2. <type 'l' as in logs>
  3. <enter pod name>
  4. ERROR!.

Thanks!

Support custom resources

It's now possible to build a Kubernetes client that learns of all possible resource types from the API, and also is able to access arbitrary resource types by name without a pre-compiled model for the types.

Would it be possible to do the same in kubernetes-el? I'd like to be able to list custom resources.

Replace kubectl with a custom client

Emacs on OSX is super slow at starting subprocesses, leading to performance issues on the current Emacs release. Emacs is also pretty slow at json parsing.

This could be resolved by implementing a custom client for the Kubernetes API that ships with this mode. Ideally, it would establish a long-lived connection to Kubernetes and push updates to Emacs.

Tasks

Go

  • get pod names
  • plan subsets of resources metadata required
    • pods
    • deployments
    • jobs
    • services
    • configmaps
    • secrets
  • emit updates for changes to resources
    • pods
    • deployments
    • jobs
    • services
    • configmaps
    • secrets

Some nice-to-haves, if we want to replace kubectl completely

  • get context and config
  • support all the flags available in kubectl contexts
  • deleting resources
    • pods
    • deployments
    • jobs
    • services
    • configmaps
    • secrets

Lisp

  • Change polling mechanism to a sentinel and stdout watcher for the Go subprocess
  • Go process lifecycle management
  • Bundling the Go executable as part of the MELPA package

Running M-x kubernetes-overview fails

I installed the package from Melpa and after starting up minikube and running M-x kubernetes-overview I get:

Turning on magit-auto-revert-mode...done
Type v to switch between resources, and ? for usage.
error in process sentinel: kubernetes-process-kill-quietly: Wrong type argument: stringp, nil
error in process sentinel: Wrong type argument: stringp, nil
error in process sentinel: kubernetes-process-kill-quietly: Wrong type argument: stringp, nil
error in process sentinel: Wrong type argument: stringp, nil

My minikube version is v0.16.0
Emacs version is 25.1
Kubectl version is v1.5.2

Latest package upgrade breaks kubernetes overview

I get following exception

Error running timer ‘kubernetes-state-trigger-redraw’: (wrong-type-argument magit-section [eieio-class-tag--magit-section context nil #<marker at 1 in kubernetes overview> nil nil nil nil nil [eieio-class-tag--magit-section context-container nil #<marker at 1 in kubernetes overview> nil nil nil nil nil [eieio-class-tag--magit-section root nil #<marker at 1 in kubernetes overview> nil nil nil nil nil nil nil] nil] nil])

Implement resource diffs

Implement a nice way to start an ediff session for a local file and the corresponding live resource.

kubernetes-refresh too many open files

Error running timer ‘kubernetes-refresh’: (file-error "Creating pipe" "Too many open files") [3 times]
Error running timer ‘kubernetes-refresh’: (file-error "Opening pty" "Too many open files")
Error running timer ‘kubernetes-refresh’: (file-error "Creating pipe" "Too many open files") [22 times]
Error running timer ‘persistent-scratch-save’: (file-error "Opening output file" "Too many open files" "/Users/nislam/.emacs.d/data/.persistent-scratch.new")
Error running timer ‘kubernetes-refresh’: (file-error "Creating pipe" "Too many open files") [60 times]
Error running timer ‘persistent-scratch-save’: (file-error "Opening output file" "Too many open files" "/Users/nislam/.emacs.d/data/.persistent-scratch.new")
Error running timer ‘kubernetes-refresh’: (file-error "Creating pipe" "Too many open files") [36 times]

Don't require buffer redraw to show deletion marks

Currently, the entire buffer must be redrawn to display a deletion mark, which introduces latency. It might also be the cause of a bug that makes the next line undeletable until point is manually moved.

Resolve by making updates on lines edit the buffer in place without triggering a redraw, in addition to updating the drawing state.

Add OpenShift support

Hi Chris -- I've been using kubernetes-el for a little while now, and it's awesome. Thank you!

OpenShift is a distribution of kubernetes that adds additional features that I would like to enable in kubernetes-el. My idea is to add an openshift-overview function that would just call kubernetes-overview, while enabling additional openshift functionality (exposed via the 'oc' command, which is a replacement for 'kubectl').

Are you amenable to accepting PRs for this?

Thanks again for this useful package!

Improve structure of overview buffer

Right now, the overview buffer is a dumping ground for various resources exposed by Kubernetes. It would be better to organise things more, like having pods being subsections of their deployments or something.

I'm going through the Kubernetes manual to make sure I understand how things can be logically structured before I finalise this.

Add support for all namespaces

Currently, you have to select a namespace to be shown. It would be nice to be able to see all namespaces.

It seems like this is partially implemented as you can just press enter when configuring a namespace (which doesn't set it to "default")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.