Coder Social home page Coder Social logo

click's People

Contributors

aarondav avatar bazhenov avatar flaviofcruz avatar hasnain-db avatar iria1 avatar lofim avatar markj-db avatar nicklan avatar svar29 avatar wchau avatar zachschuermann 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  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

click's Issues

Project still maintained?

I was going to work on a small issue, but see there are some PRs which have been open for some time without activity (and passing tests)... is click still active from the maintainer's perspective?

logs not working

hello,

I'm inside a pod and i want to see the logs
[admin-context] [smdp4] [consumer-profile-stock-1387439186-s6pvb] > logs
error: The following required arguments were not provided:

USAGE:
logs [FLAGS] [OPTIONS]

For more information try --help

So i tried to give the container name even if i thing we should not need (we are "in" the pod):
[admin-context] [smdp4] [consumer-profile-stock-1387439186-s6pvb] > logs consumer-profile-stock
Hyper error: failed to lookup address information: Name or service not known

Any idea ?
cheers

A command for one off containers

Click is an incredible tool already! I use it so often and it saves me a lot of time.

Sometimes, I'm in the situation that I want to go into a container that already stopped (not because of the files that were created in there, but because of the environment). The way I do it right now is 1.) check the Docker image that was being used with click 2.) execute the following command:

kubectl run one-off-shell -n <...> --rm -i --tty --image <...> -- bash

Would be cool to be just in click, select the pod and run one-off:

[clust] [default] [awesome-123-r462t] > one-off
root@one-off-shell-5cfd8f874f-pttcx:/home/root# 
...

What do you think about this feature?

I would be keen to try a PR, even though I'm pretty new to Rust :)

Error setting context

Sorry to be the guy that just goes "oh it isn't working". It's potentially entirely my fault, but...when I try to set my context I get this:

[Warning] Couldn't find/load context <gcp_context_name>, now no current context.  Error: Failed to get config: Invalid context <gcp_context_name>.  Each user must have either a token, a username AND password, or a client-certificate AND a client-key.

I use kubectl all day, but can't for the life of me remember how I set it up in the first place.

Error in setting context

[none] [none] [none] > context minikube
Private key data was invalid: ()
[Warning] Couldn't find/load context minikube, now no current context. Error: Failed to get config: Can't read/convert cert or private key for minikube

Configuration error?

Hello, all the commends return invalid certificate error. Would appreciate if you point out what I am missing. I am able to run all the Kubectl commands via the ~/.kube/config. Thanks.

[admin-cluster.local] [default] [none] > nodes
Hyper error: invalid certificate: InvalidReferenceNam

Hyper error: invalid certificate: InvalidReferenceName

I'm getting this error using a cluster spun up with kubespray and using tls certificates for auth.

Hyper error: invalid certificate: InvalidReferenceName

.kube/config looks like the following:

apiVersion: v1
kind: Config
preferences: {}

clusters:
- cluster:
    server: https://172.17.8.101:6443
    certificate-authority: /home/tom/.kube/ca-development.pem
  name: development

users:
- name: development-admin
  user:
    client-certificate: /home/tom/.kube/admin-.pem
    client-key: /home/tom/.kube/admin-key.pem
    
contexts:
- context:
    cluster: development
    user: development-admin
  name: development

current-context: development

I've tried adding insecure-skip-tls-verify: true to the user but it has no effect. kubectl works fine without error. Masters are k8s v1.9.2

Bump untrusted for security

Hi,

This project seems to use untrusted ^0.5 (0.5.1) as I can see from the cargo.toml file on master branch. Recently a security issue was fixed as part of 0.6.2 release. Please refer to rustsec/advisory-db@3c0458d . You can also consider adding cargo audit as part of the build step to get notified in the future.

Kindly ignore if this is irrelevant or fixed on another branch.

Thanks.

Two versions of duct crate in use

Awesome looking project btw!

From a completely fresh install of rust (brew install rust) I have a compile error after running cargo install click:

error[E0308]: mismatched types
  --> src/output.rs:93:19
   |
93 |             expr: handle,
   |                   ^^^^^^ expected struct `duct::Handle`, found a different struct `duct::Handle`
   |
   = note: expected type `duct::Handle` (struct `duct::Handle`)
              found type `duct::Handle` (struct `duct::Handle`)
note: Perhaps two different versions of crate `duct` are being used?

And looking a bit further up the output I see:

   Compiling duct v0.11.0
   Compiling duct v0.10.0
   Compiling crossbeam-deque v0.2.0
   Compiling url v1.7.1
   Compiling duct_sh v0.1.0
...
   Compiling click v0.3.2

I don't know enough about rust to attempt a fix myself, sorry

StatefulSet command

First of all, thank you for the great tool! I just started using it, but I like it a lot.
It would be great to have a command for stateful-set as we use those in our system.

Support scaling workloads

A suggestion to add a scale --replicas <int> command to scale workloads (deployments, statefulsets, replicasets, etc)

Add a generic set command

Click should have a generic set command for setting user defined variables. This will be used for things like turning color on and off, setting a custom prompt, and so on.

Format should be:
set [variable] [value]

help should list all the things that can be set.

context command panics when invoked without a context name

โฏ RUST_BACKTRACE=1 click
[none] [none] [none] > context
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic
   6: std::panicking::begin_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::panicking::panic
  10: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  11: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  12: <click::cmd::Context as click::cmd::Cmd>::exec
  13: click::main
  14: std::rt::lang_start::{{closure}}
  15: std::panicking::try::do_call
  16: __rust_maybe_catch_panic
  17: std::rt::lang_start_internal
  18: main

The expected behaviour could be same as that of namespace command. namespace when invoked without an argument, sets the namespace to none.

Accessing a cluster without a cert

Hello,

Thanks for such a nice project! Kudos!

While trying to connect to insecure cluster, click outputs "Can't do insecure-skip-tls-verify yet".
Obviously, it is not supported yet. Is there an estimate when such setups will be supported?

[enhancement] print out the node for pods command

Hello,
when vizualizing pods, we have the options to see labels or annotations and also to filter with regexp.
This is good.
But i think the column "node" is missing in the command "pods" because it's important to see if an affinity / anti-affinity rule is respected directly.
This is what we have with the command : kubectl get pods -o wide

cheers

Is this project alive ?

Dear Databricks guys,
You opensourced great project but after that there is no actions taken.
PR are waiting. Issues are not resolved.
So the question is: are you planning to maintain this project?

Regards,
Maciek

Delete a range of objects

I have a need to delete old replicasets.

[eastus2] [none] [none] > rs
...
  432  calculator-v002                           0        0        0
  433  calculator-v003                           0        0        0
  434  calculator-v004                           0        0        0
  435  calculator-v005                           0        0        0
  436  calculator-v006                           1        1        0
  437  calculator-v007                           1        1        1
  438  calculator-v008                           1        1        1
...

Would be great if I could:

[eastus2] [none] [none] > delete 432
[eastus2] [none] [none] > delete 433

OR

[eastus2] [none] [none] > delete 432-438

Does not work when ${KUBECONFIG} is not name `config`

This is a great concept and I really appreciate you creating it. Unfortunately I can't get it to work with kubernetes clusters hosted by IBM Cloud.

Current Behavior

$ echo ${KUBECONFIG}
/Users/code-noggin/.bluemix/plugins/container-service/clusters/mycluster/kube-config-hou02-mycluster.yml

$ kubectl config current-context
mycluster

$ click
Could not open config file at '/Users/code-noggin/.kube/click.config': No such file or directory (os error 2). Using default values
Could not load kubernetes config: '/Users/code-noggin/.kube/config'. Cannot continue.  Error was: entity not found

$ click -c $(dirname ${KUBECONFIG})
Could not open config file at '/Users/code-noggin/.bluemix/plugins/container-service/clusters/mycluster/click.config': No such file or directory (os error 2). Using default values
Could not load kubernetes config: '/Users/code-noggin/.bluemix/plugins/container-service/clusters/mycluster/config'. Cannot continue.  Error was: entity not found

Expected Behavior

click uses the value of ${KUBECONFIG} environment variable to read contexts, etc.

Error when using port-forward

Sometimes I'm getting following error when exiting click

[] > E0405 15:12:33.347347      64 portforward.go:178] lost connection to pod
E0405 15:14:34.929641      73 portforward.go:178] lost connection to pod

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 3, message: "No such process" } }', /checkout/src/libcore/result.rs:916:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at /checkout/src/libstd/sys_common/backtrace.rs:68
             at /checkout/src/libstd/sys_common/backtrace.rs:57
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:397
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:577
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:538
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:522
   7: rust_begin_unwind
             at /checkout/src/libstd/panicking.rs:498
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/panicking.rs:71
   9: core::result::unwrap_failed
  10: click::main
  11: std::rt::lang_start::{{closure}}
  12: std::panicking::try::do_call
             at /checkout/src/libstd/rt.rs:59
             at /checkout/src/libstd/panicking.rs:480
  13: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:101
  14: std::rt::lang_start_internal
             at /checkout/src/libstd/panicking.rs:459
             at /checkout/src/libstd/panic.rs:365
             at /checkout/src/libstd/rt.rs:58
  15: main
  16: __libc_start_main
  17: _start

Show contexts when none is given

Rather than an error, it would be nice if ctx with no argument would show the available contexts, either in place of the error or in addition to it.

How to use this with GKE?

I tried using it with a GKE cluster but couldn't set the context. Am I doing something wrong?

$ click
[none] [none] [none] > contexts
gke_project_zone_cluster
[none] [none] [none] > context gke_project_zone_cluster
[Warning] Couldn't find/load context gke_project_zone_cluster, now no current context.  Error: Failed to get config: Invalid context gke_project_zone_cluster.  Each user must have either a token, a username AND password, or a client-certificate AND a client-key.
[none] [none] [none] > exit
$ kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: REDACTED
    server: https://A.B.C.D
  name: gke_project_zone_cluster
contexts:
- context:
    cluster: gke_project_zone_cluster
    user: gke_project_zone_cluster
  name: gke_project_zone_cluster
current-context: gke_project_zone_cluster
kind: Config
preferences: {}
users:
- name: gke_project_zone_cluster
  user:
    auth-provider:
      config:
        access-token: REDACTED
        expiry: 2018-03-26T17:06:20.285552769-07:00
      name: gcp

Support vi-mode for readline

Any chances of adding a vi-mode to click?

I'm currently using the following:

diff --git a/Cargo.toml b/Cargo.toml
-rustyline = "1.0"
+rustyline = { git = "https://github.com/kkawakam/rustyline" }

diff --git a/src/main.rs b/src/main.rs
-    let mut rl = Editor::<ClickCompleter>::new();
+    let editor_config = rustyline::Config::builder().edit_mode(rustyline::EditMode::Vi).build();
+    let mut rl = Editor::<ClickCompleter>::with_config(editor_config);

and it works ๐Ÿ‘Œ, but it would be much better to set this as a configuration option in click itself.

Unfortunately my rust-fu is too weak to hack this in properly ๐Ÿ˜ž

KUBECONFIG merges are not working

kubectl has a feature to merge kubeconfigs on the fly via a KUBECONFIG env variable. This is not working with click.

How to reproduce:

$ export KUBECONFIG=cluster-merge:cluster-config:cluster2-config
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* cluster1 cluster1 cluster1
cluster2 cluster2 cluster2
$ click
Could not open config file at 'xxxx/.kube/click.config': No such file or directory (os error 2). Using default values
Could not load kubernetes config: 'cluster-merge:cluster-config:cluster2-config'. Cannot continue.  Error was: entity not found

Helm support

This could be nice addition to click.
Support for helm and its charts.

Error while setting the minikube context in Click


[none] [none] [none] > context
Context Api Server Address
++++++++
minikube https://192.168.99.100:443
++++++++
[none] [none] [none] > context dev
[Warning] Couldn't find/load context dev, now no current context. Error: Kube Error: Invalid Context Name
[none] [none] [none] > context minikube
Private key data was invalid: ()
[Warning] Couldn't find/load context minikube, now no current context. Error: Failed to get config: Can't read/convert cert or private key for minikube
[none] [none] [none] >

Any help??

Hyper error: received fatal alert: UnexpectedMessage

[my-context] [none] [none] > env
Env {
  Current Context: my-context
  Availble Contexts: ["my-context"]
  Kubernetes Config File: /Users/lkysow/.kube/config
  Editor: <unset, will use $EDITOR>
  Terminal: <unset, will use xterm>
}
[my-context] [none] [none] > nodes
Hyper error: received fatal alert: UnexpectedMessage
[my-context] [none] [none] > pods
Hyper error: received fatal alert: UnexpectedMessage
[my-context] [none] [none] >

Is there some logging I can turn on? I'm using username/password auth.

use kube current-context when entering click

Hey, this tool is pretty awesome thanks a lot!

Not sure if this is a sensible suggestion or not, but it feels like a semi-common pattern to have some quick shell helpers to swap kubectl config current-context around for kubectl.

Was wondering if it is possible to have click use my current context (and its associated namespace if set in the context triple) when entering instead of storing it in the click config? It feels a bit overkill to have this info set in two places personally, and it also slightly deceptive to someone who has their kube context on PS1.

If people set contexts carefully to point to specific clusters with specific namespaces, then it's easier to just swap the context outside click than it is to do it interactively. The repl prompt showing the context and the namespace set is a very nice touch though.

failed to authenticate when downloading repository

This is probably a cargo issue, but I'm not that familiar with rust.

I was trying cargo install and ran into the following:

$ cargo install -vv
  Installing click v0.3.1 (file:///Users/adam/code/src/github.com/databricks/click)
    Updating registry `https://github.com/rust-lang/crates.io-index`
error: failed to compile `click v0.3.1 (file:///Users/adam/code/src/github.com/databricks/click)`, intermediate artifacts can be found at `/Users/adam/code/src/github.com/databricks/click/target`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  failed to authenticate when downloading repository
attempted ssh-agent authentication, but none of the usernames `git` succeeded

Caused by:
  error authenticating: ; class=Ssh (23)

I have the following in my ~/.gitconfig for Go projects, but commenting this out let me run cargo install just fine.

[url "[email protected]:"]
	insteadOf = https://github.com/

Couldn't get an authentication token.

Hello!

I have a docker container with click, I'm mounting my kube configuration folder ($HOME/.kube/:/root/.kube) but it seems like click cant work with it.

Failed to run update command: No such file or directory (os error 2)
Couldn't get an authentication token. You can try exiting Click and running a kubectl command against the cluster to refresh it. Also please report this error on the Click github page.
Server Error: pods is forbidden: User "system:anonymous" cannot list pods at the cluster scope: Unknown user "system:anonymous"

kubectl commands works as expected.
I'm using GKE and click works on my local environment.

Serde json error: expected value at line 1 column 1

After setting up and connecting to a remote K8s cluster from my kubectl config, I'm getting deser errors for all commands like pods, deployments, etc.

Serde json error: expected value at line 1 column 1

What does this mean?

Invalid certificate or key data when selecting context

[none] [none] [none] > ctx ldc
Private key data was invalid: ()
[Warning] Couldn't find/load context ldc, now no current context.  Error: Failed to get config: Invalid certificate or key data for context: ldc

When using kubectl config use-context all works fine.

Cannot access AKS cluster with RBAC enabled

Hi there,

I wanted to try your project on my AKS cluster, but I cannot select anything except context due to missing access.

[none] [none] [none] > context dev
[dev] [none] [none] > pods
Server Error: pods is forbidden: User "clusterUser" cannot list pods at the cluster scope

Here's my ~/.kube/config file:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: XXXX
    server: https://XXX:443
  name: dev
contexts:
- context:
    cluster: dev
    user: clusterUser_dev
  name: dev
current-context: dev
kind: Config
preferences: {}
users:
- name: clusterUser_dev
  user:
    client-certificate-data: XXX
    client-key-data: XXX
    token: XXX

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.