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

Add clean sub command #644

Merged
merged 15 commits into from
Aug 10, 2020
Merged

Add clean sub command #644

merged 15 commits into from
Aug 10, 2020

Conversation

lucklove
Copy link
Member

@lucklove lucklove commented Jul 30, 2020

Fix #138

TODOLIST:

  • Primary cleanup: tidb/tikv/pd/promethus/grafana
  • Support skip specific role, eg: prometheus
  • Support cleanup log
Introduce `tiup cluster clean` command:

- Cleanup all data in specified cluster: `tiup cluster clean ${cluster-name} --data`
- Cleanup all logs in specified cluster: `tiup cluster clean ${cluster-name} --log`
- Cleanup all logs and data in specified cluster: `tiup cluster clean ${cluster-name} --all`
- Cleanup all logs and data in specified cluster, excepting the prometheus service: `tiup cluster clean ${cluster-name} --all --ignore-role prometheus`
- Cleanup all logs and data in specified cluster, expecting the node `172.16.13.11:9000`: `tiup cluster clean ${cluster-name} --all --ignore-node 172.16.13.11:9000`
- Cleanup all logs and data in specified cluster, expecting the host `172.16.13.11`: `tiup cluster clean ${cluster-name} --all --ignore-node 172.16.13.12`


@codecov-commenter
Copy link

codecov-commenter commented Jul 30, 2020

Codecov Report

Merging #644 into master will increase coverage by 0.09%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #644      +/-   ##
==========================================
+ Coverage   57.35%   57.45%   +0.09%     
==========================================
  Files         243      244       +1     
  Lines       17516    17662     +146     
==========================================
+ Hits        10047    10148     +101     
- Misses       6167     6201      +34     
- Partials     1302     1313      +11     
Flag Coverage Δ
#coverage 57.45% <ø> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...src/github.com/pingcap/tiup/pkg/cluster/manager.go 69.37% <0.00%> (-1.00%) ⬇️
...src/github.com/pingcap/tiup/pkg/environment/env.go 37.76% <0.00%> (-0.41%) ⬇️
...om/pingcap/tiup/pkg/cluster/operation/operation.go 72.72% <0.00%> (ø)
...m/pingcap/tiup/components/cluster/command/clean.go 86.66% <0.00%> (ø)
...om/pingcap/tiup/components/cluster/command/root.go 45.56% <0.00%> (+0.32%) ⬆️
...pingcap/tiup/components/cluster/command/destroy.go 69.56% <0.00%> (+1.38%) ⬆️
...c/github.com/pingcap/tiup/pkg/cluster/api/dmapi.go 62.77% <0.00%> (+1.45%) ⬆️
...om/pingcap/tiup/components/cluster/command/test.go 64.06% <0.00%> (+1.84%) ⬆️
....com/pingcap/tiup/pkg/cluster/operation/destroy.go 59.13% <0.00%> (+4.64%) ⬆️
...ithub.com/pingcap/tiup/pkg/cluster/module/shell.go 76.92% <0.00%> (+23.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 788839c...fdc8ac3. Read the comment docs.

@lonng lonng mentioned this pull request Jul 31, 2020
@lucklove lucklove marked this pull request as ready for review August 4, 2020 06:20
@lucklove lucklove force-pushed the clean branch 4 times, most recently from 09e3e8f to c5a0eaa Compare August 5, 2020 07:17
Signed-off-by: lucklove <[email protected]>
@lucklove lucklove added the status/can-merge Indicates a PR has been approved by a committer. label Aug 6, 2020
@lucklove lucklove requested review from lonng and july2993 and removed request for lonng August 6, 2020 06:25
@ti-srebot
Copy link
Contributor

/run-all-tests

@july2993 july2993 added status/PTAL and removed status/can-merge Indicates a PR has been approved by a committer. labels Aug 6, 2020
pkg/cluster/manager.go Outdated Show resolved Hide resolved
Copy link
Contributor

@lonng lonng left a comment

Choose a reason for hiding this comment

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

This PR introduces some dangerous operation for the cluster, it's better to add some integration tests.

Signed-off-by: lucklove <[email protected]>
Signed-off-by: lucklove <[email protected]>
Signed-off-by: lucklove <[email protected]>
Signed-off-by: lucklove <[email protected]>
tests/tiup-dm/test_cmd.sh Outdated Show resolved Hide resolved
Signed-off-by: lucklove <[email protected]>
Signed-off-by: lucklove <[email protected]>
Copy link
Contributor

@lonng lonng left a comment

Choose a reason for hiding this comment

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

LGTM
Don't forget to update the documentation.

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 10, 2020
@lucklove lucklove merged commit a1c1637 into pingcap:master Aug 10, 2020
@lonng lonng deleted the clean branch August 10, 2020 13:27
@lonng
Copy link
Contributor

lonng commented Aug 10, 2020

@lucklove Please write the release note for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Partially destroy cluster
6 participants