Linkerd2: cli: Support kubectl-style resource selectors

Created on 23 Apr 2019  路  5Comments  路  Source: linkerd/linkerd2

The various Linkerd subcommands that operate on kubernetes resources all work somewhat differently, and none of them support Kubernetes label selection.

Anywhere where the linkerd CLI operates on a list of resources (tap, top, routes, stat, metrics, etc), linkerd should accept resource selections exactly like kubectl.

Furthermore the --linkerd-namespace flag should be changed so that its short flag is -L, so that the -l flag can be used for label selection (like other kubernetes-related tools).

For example, kubectl supports the following:

:; kubectl get -n linkerd svc/linkerd-web deploy/linkerd-web
NAME                  TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)             AGE
service/linkerd-web   ClusterIP   10.0.238.66   <none>        8084/TCP,9994/TCP   11d

NAME                                DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deployment.extensions/linkerd-web   1         1         1            1           11d
:; kubectl -n linkerd get po -l linkerd.io/control-plane-component    
NAME                                   READY     STATUS    RESTARTS   AGE
linkerd-controller-58fb7787b-kxhw5     4/4       Running   0          11d
linkerd-grafana-659c48d67-h8lx6        2/2       Running   0          11d
linkerd-identity-84fd9b78b-g9h4c       2/2       Running   0          11d
linkerd-prometheus-644698f444-zg9fn    2/2       Running   0          11d
linkerd-sp-validator-c4965d44c-8qqmb   2/2       Running   0          4d
linkerd-web-7f46b9cfcb-6c6kv           2/2       Running   0          4d
:; kubectl -n linkerd get deploy linkerd-controller linkerd-identity
NAME                 DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
linkerd-controller   1         1         1            1           11d
NAME                 DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
linkerd-identity     1         1         1            1           11d



md5-a5894dd05d684ef61c36afc9a12f81c9



:; linkerd -n linkerd stat deploy linkerd-controller linkerd-identity
NAME                 MESHED   SUCCESS      RPS   LATENCY_P50   LATENCY_P95   LATENCY_P99   TCP_CONN
linkerd-controller      1/1    81.82%   1.1rps           1ms           2ms           3ms         17
linkerd-identity        1/1   100.00%   0.3rps           1ms           1ms           1ms         13



md5-d557766f2aa1e15a7ac8a5d8ed1d6c66



:; linkerd -n linkerd tap deploy linkerd-controller linkerd-identity
Error: accepts between 1 and 2 arg(s), received 3
Usage:
  linkerd tap [flags] (RESOURCE)



md5-f1c7bbc4867a54b978a403a0245da490



:; linkerd -n linkerd tap deploy
req id=0:1 proxy=out src=10.244.3.83:46802 dst=10.244.0.214:4191 tls=no_authority_in_http_request :method=GET :authority=10.244.0.214:4191 :path=/metrics
rsp id=0:1 proxy=out src=10.244.3.83:46802 dst=10.244.0.214:4191 tls=no_authority_in_http_request :status=200 latency=3853碌s
end id=0:1 proxy=out src=10.244.3.83:46802 dst=10.244.0.214:4191 tls=no_authority_in_http_request duration=39碌s response-length=5635B                                    

The linkerd metrics command does not accept any resource lists, though it supports expanding group types like deploy/foo.

arecli good first issue help wanted prioritP2

All 5 comments

I would like to work on this.

@VineethReddy02 go for it! Any pointers we can give to help out?

@VineethReddy02 @grampelberg Is this still being worked on? I'd like to take up this one if that's okay :)

@mayankshah1607 let's give @VineethReddy02 a little bit, but I'm unaware of anyone actively working on this one.

Hi @mayankshah1607 you can take this up. I am occupied at this moment.

Was this page helpful?
0 / 5 - 0 ratings