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

Build CLI #357

Merged
merged 9 commits into from
Apr 9, 2019
Merged

Build CLI #357

merged 9 commits into from
Apr 9, 2019

Conversation

aylei
Copy link
Contributor

@aylei aylei commented Mar 28, 2019

This is a very early version of our CLI tool, for better reviewing experience, debug related functionalities are moved to next PR.

Some decisions are vague and supposed to be changed later on, namely, the CLI tool is currently alpha, however, I think the basic code skeleton is almost fine.

Moreover, this PR updates kubernetes related dependencies to 1.12.5

PTAL @tennix @xiaojingchen @weekface @shuijing198799 @gregwebs

  • Update kubernetes dependencies to 1.12.5
  • tidb context sync and switch
  • tidb cluster view
  • volumes management
  • tidb cluster troubleshooting (moved to next PR for better reviewing)

Some examples in my local machine:

$ tkc
"tkc"(TiDB kubernetes control) is a command line interface for cloud tidb management and troubleshooting.

Cluster Management Commands:
  list        list all tidb clusters
  get         get all tidb clusters
  info        Show tidb cluster information.
  use         Specify a tidb cluster to use

Troubleshooting Commands:
  debug       Not implemented
  pdctl       Not implemented
  ctop        Not implemented

Other Commands:

Usage:
  tkc [flags] [options]

Use "tkc <command> --help" for more information about a given command.
Use "tkc options" for a list of global command-line options (applies to all commands).

$ tkc list
NAMESPACE      NAME                PD    TIKV     TIDB     AGE
dengshuan      demo                3/3   3/3      2/2      20d

$ tkc list -A
NAMESPACE      NAME                PD    TIKV     TIDB     AGE
chenqingjing   a                   1/1   3/3      1/1      4d5h
chenshuning    syncer-test         3/3   5/5      2/2      75d
dengshuan      demo                3/3   3/3      2/2      20d
developer      stn-qps             0/1   3/3      0/0      193d
liuzhi         linuxgit            2/3   3/3      2/2      157d
qupeng         samsung-stability   3/3   1/4      1/2      134d
wangke         newwktidb           3/3   1/3      2/3      39d
wangke         tidbwk              0/3   <none>   <none>   46d
wentaojin      marvin              3/3   3/3      2/2      27d
wuyelei        aylei-master        3/3   5/5      4/4      29d
xianjingwang   demo                0/1   <none>   <none>   39d
yueyuezhou     demo                0/3   <none>   <none>   27d
zhangbokang    zbk                 1/1   4/4      1/2      154d
zhengrong      money2              0/1   0/4      5/6      39d

$ tkc use -n=wuyelei aylei-master
Tidb cluster switched to wuyelei/aylei-master

$ tkc list
NAME           PD    TIKV   TIDB   AGE
aylei-master   3/3   5/5    4/4    29d

$ tkc info
Name:               aylei-master
Namespace:          wuyelei
CreationTimestamp:  2019-03-04 14:43:52 +0800 CST
Overview:
         Phase   Ready  Desired  CPU  Memory  Storage  Version
         -----   -----  -------  ---  ------  -------  -------
  PD:    Normal  3      3                     1Gi      pingcap/pd:v2.1.0
  TiKV:  Normal  5      5                     10Gi     pingcap/tikv:v2.1.0
  TiDB   Normal  4      4                              pingcap/tidb:v2.1.0
Endpoints(NodePort):
  - 172.16.30.10:37627
  - 172.16.30.7:37627
  - 172.16.30.9:37627
  - 172.16.10.11:37627

$ tkc get tikv
tkc get tikv
NAME                  READY   STATUS    MEMORY       CPU   RESTARTS   AGE   NODE
aylei-master-tikv-0   2/2     Running   50Mi/100Mi         0          29d   172.16.10.19
aylei-master-tikv-1   2/2     Running   50Mi/100Mi         0          29d   172.16.30.30
aylei-master-tikv-2   2/2     Running   50Mi/100Mi         3          29d   172.16.10.12
aylei-master-tikv-3   2/2     Running   50Mi/100Mi         0          21d   172.16.10.5
aylei-master-tikv-4   2/2     Running   50Mi/100Mi         0          28d   172.16.10.11

$ tkc get volume
VOLUME              CLAIM                      STATUS   CAPACITY   NODE           LOCAL
local-pv-1896e6ce   pd-aylei-master-pd-2       Bound    278Gi      172.16.10.14   /mnt/sas-disks/vol2
local-pv-2edc6512   pd-aylei-master-pd-1       Bound    1861Gi     172.16.30.28   /mnt/sas-disks/vol1
local-pv-482a865d   tikv-aylei-master-tikv-3   Bound    278Gi      172.16.10.5    /mnt/sas-disks/vol1
local-pv-5bbb9350   tikv-aylei-master-tikv-2   Bound    278Gi      172.16.10.12   /mnt/sas-disks/vol2
local-pv-5e34b56e   tikv-aylei-master-tikv-0   Bound    278Gi      172.16.10.19   /mnt/sas-disks/vol3
local-pv-6a1229d6   tikv-aylei-master-tikv-4   Bound    278Gi      172.16.10.11   /mnt/sas-disks/vol3
local-pv-84f137b4   pd-aylei-master-pd-0       Bound    1861Gi     172.16.30.29   /mnt/sas-disks/vol2
local-pv-fda68cc8   tikv-aylei-master-tikv-1   Bound    1861Gi     172.16.30.30   /mnt/sas-disks/vol0

$ tkc get all
NAME                READY   STATUS    MEMORY          CPU   RESTARTS   AGE   NODE
aylei-master-pd-0   1/1     Running   <none>/<none>         0          29d   172.16.30.29
aylei-master-pd-1   1/1     Running   <none>/<none>         2          29d   172.16.30.28
aylei-master-pd-2   1/1     Running   <none>/<none>         1          29d   172.16.10.14
aylei-master-tikv-0   2/2   Running   50Mi/100Mi         0     29d   172.16.10.19
aylei-master-tikv-1   2/2   Running   50Mi/100Mi         0     29d   172.16.30.30
aylei-master-tikv-2   2/2   Running   50Mi/100Mi         3     29d   172.16.10.12
aylei-master-tikv-3   2/2   Running   50Mi/100Mi         0     21d   172.16.10.5
aylei-master-tikv-4   2/2   Running   50Mi/100Mi         0     28d   172.16.10.11
aylei-master-tidb-0   1/1   Running   <none>/<none>         1     29d   172.16.30.10
aylei-master-tidb-1   1/1   Running   <none>/<none>         37    28d   172.16.30.7
aylei-master-tidb-2   1/1   Running   <none>/<none>         36    28d   172.16.30.9
aylei-master-tidb-3   1/1   Running   <none>/<none>         41    28d   172.16.10.11

VOLUME              CLAIM                      STATUS   CAPACITY   NODE           LOCAL
local-pv-1896e6ce   pd-aylei-master-pd-2       Bound    278Gi      172.16.10.14   /mnt/sas-disks/vol2
local-pv-2edc6512   pd-aylei-master-pd-1       Bound    1861Gi     172.16.30.28   /mnt/sas-disks/vol1
local-pv-482a865d   tikv-aylei-master-tikv-3   Bound    278Gi      172.16.10.5    /mnt/sas-disks/vol1
local-pv-5bbb9350   tikv-aylei-master-tikv-2   Bound    278Gi      172.16.10.12   /mnt/sas-disks/vol2
local-pv-5e34b56e   tikv-aylei-master-tikv-0   Bound    278Gi      172.16.10.19   /mnt/sas-disks/vol3
local-pv-6a1229d6   tikv-aylei-master-tikv-4   Bound    278Gi      172.16.10.11   /mnt/sas-disks/vol3
local-pv-84f137b4   pd-aylei-master-pd-0       Bound    1861Gi     172.16.30.29   /mnt/sas-disks/vol2
local-pv-fda68cc8   tikv-aylei-master-tikv-1   Bound    1861Gi     172.16.30.30   /mnt/sas-disks/vol0

aylei added 3 commits March 12, 2019 16:14
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
@aylei
Copy link
Contributor Author

aylei commented Mar 28, 2019

/run-e2e-tests

@zhouqiang-cl
Copy link

/build

1 similar comment
@zhouqiang-cl
Copy link

/build

Signed-off-by: Aylei <rayingecho@gmail.com>
@zhouqiang-cl
Copy link

please fix ci

@aylei
Copy link
Contributor Author

aylei commented Apr 1, 2019

please fix ci

This a draft PR and I'm still working on this, hopefully I will fix it before tomorrow

aylei added 3 commits April 2, 2019 17:34
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
@aylei aylei marked this pull request as ready for review April 2, 2019 12:42
Signed-off-by: Aylei <rayingecho@gmail.com>
@aylei
Copy link
Contributor Author

aylei commented Apr 2, 2019

/run-e2e-tests

3 similar comments
@aylei
Copy link
Contributor Author

aylei commented Apr 2, 2019

/run-e2e-tests

@aylei
Copy link
Contributor Author

aylei commented Apr 3, 2019

/run-e2e-tests

@aylei
Copy link
Contributor Author

aylei commented Apr 4, 2019

/run-e2e-tests

Copy link
Contributor

@weekface weekface left a comment

Choose a reason for hiding this comment

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

Can we use tkc as a plugin with kubectl?

cmd/tkctl/main.go Show resolved Hide resolved
pkg/tkctl/cmd/cmd.go Show resolved Hide resolved
pkg/tkctl/cmd/ctop/ctop.go Show resolved Hide resolved
pkg/tkctl/cmd/list/list.go Show resolved Hide resolved
pkg/tkctl/config/config.go Show resolved Hide resolved
Copy link
Contributor

@weekface weekface left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@tennix tennix left a comment

Choose a reason for hiding this comment

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

LGTM

@tennix tennix merged commit 53e50d5 into pingcap:master Apr 9, 2019
@aylei aylei mentioned this pull request Apr 9, 2019
14 tasks
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.

4 participants