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

cluster: need support clean up audit log #1644

Merged
merged 14 commits into from
Dec 2, 2021
Merged

Conversation

srstack
Copy link
Collaborator

@srstack srstack commented Dec 1, 2021

What problem does this PR solve?

close #1620

What is changed and how it works?

  1. Do not clean up the tidb-server audit log when using tiup-cluster clean cluster-name --log
  2. Add new flag --audit-log, you can use it to clean up the tidb-server audit log
    for ex:
Cleanup a specified cluster without destroying it.
You can retain some nodes and roles data when cleanup the cluster, eg:
    $ tiup cluster clean <cluster-name> --all
    $ tiup cluster clean <cluster-name> --log
    $ tiup cluster clean <cluster-name> --data
    $ tiup cluster clean <cluster-name> --audit-log
    $ tiup cluster clean <cluster-name> --all --ignore-role prometheus
    $ tiup cluster clean <cluster-name> --all --ignore-node 172.16.13.11:9000
    $ tiup cluster clean <cluster-name> --all --ignore-node 172.16.13.12

Usage:
  tiup-cluster clean <cluster-name> [flags]

Flags:
      --all                       Cleanup both log and data (not include audit log)
      --audit-log                 Cleanup TiDB-server audit log
      --data                      Cleanup data
  -h, --help                      help for clean
      --ignore-node stringArray   Specify the nodes or hosts whose data will be retained
      --ignore-role stringArray   Specify the roles whose data will be retained
      --log                       Cleanup log
  1. Add double confirmation, whether to allow cluster restart, whether to allow deletion of files, increase security
    image

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)
 tiup-cluster clean cluster-name --all
 tiup-cluster clean cluster-name --audit-log
 tiup-cluster clean cluster-name --log
 tiup-cluster clean cluster-name --data

Code changes

  • Has exported function/method change
  • Has exported variable/fields change

Related changes

  • Need to update the documentation

Release notes:

NONE

@srstack srstack self-assigned this Dec 1, 2021
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 1, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • AstroProfundis

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 1, 2021
@srstack srstack changed the title Issue 1620 cluster: need support clean up audit log Dec 1, 2021
@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2021

Codecov Report

Merging #1644 (8f76494) into master (e0b5a7b) will increase coverage by 29.07%.
The diff coverage is 6.81%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1644       +/-   ##
===========================================
+ Coverage   15.58%   44.65%   +29.07%     
===========================================
  Files         151      294      +143     
  Lines       15250    26975    +11725     
===========================================
+ Hits         2376    12045     +9669     
- Misses      12357    13069      +712     
- Partials      517     1861     +1344     
Flag Coverage Δ
cluster 34.88% <6.81%> (?)
dm 25.92% <0.00%> (?)
integrate 44.65% <6.81%> (+29.07%) ⬆️
playground 13.33% <ø> (?)
tiup 15.58% <ø> (ø)
unittest ∅ <ø> (∅)

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

Impacted Files Coverage Δ
pkg/cluster/manager/cleanup.go 0.00% <0.00%> (ø)
pkg/cluster/operation/operation.go 71.42% <ø> (ø)
components/cluster/command/clean.go 66.66% <75.00%> (ø)
pkg/cluster/task/env_init.go 58.97% <0.00%> (ø)
pkg/cluster/operation/telemetry.go 0.00% <0.00%> (ø)
components/dm/command/restart.go 83.33% <0.00%> (ø)
components/dm/command/import.go 21.53% <0.00%> (ø)
pkg/cluster/manager/rename.go 0.00% <0.00%> (ø)
components/dm/task/update_dm_meta.go 86.04% <0.00%> (ø)
components/dm/ansible/worker.go 0.00% <0.00%> (ø)
... and 235 more

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 e0b5a7b...8f76494. Read the comment docs.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 1, 2021
@AstroProfundis
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 8f76494

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 2, 2021
@ti-chi-bot ti-chi-bot merged commit c6b2e51 into pingcap:master Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tiup clean need support clean up audit log
4 participants