etcdctl: organize etcdctl subcommand
fix: #17777
The code might be a bit ugly, thanks to the reviewers, I'm still getting used to the etcd project.:)
before:
./bin/etcdctl --help
NAME:
etcdctl - A simple command line client for etcd3.
USAGE:
etcdctl [flags]
VERSION:
3.7.0-alpha.0
API VERSION:
3.7
COMMANDS:
alarm disarm Disarms all alarms
alarm list Lists all alarms
auth disable Disables authentication
auth enable Enables authentication
auth status Returns authentication status
check datascale Check the memory usage of holding data for different workloads on a given server endpoint.
check perf Check the performance of the etcd cluster
compaction Compacts the event history in etcd
completion Generate completion script
defrag Defragments the storage of the etcd members with given endpoints
del Removes the specified key or range of keys [key, range_end)
downgrade cancel Cancel the ongoing downgrade action to cluster
downgrade enable Start a downgrade action to cluster
downgrade validate Validate downgrade capability before starting downgrade
elect Observes and participates in leader election
endpoint hashkv Prints the KV history hash for each endpoint in --endpoints
endpoint health Checks the healthiness of endpoints specified in `--endpoints` flag
endpoint status Prints out the status of endpoints specified in `--endpoints` flag
get Gets the key or a range of keys
help Help about any command
lease grant Creates leases
lease keep-alive Keeps leases alive (renew)
lease list List all active leases
lease revoke Revokes leases
lease timetolive Get lease information
lock Acquires a named lock
make-mirror Makes a mirror at the destination etcd cluster
member add Adds a member into the cluster
member list Lists all members in the cluster
member promote Promotes a non-voting member in the cluster
member remove Removes a member from the cluster
member update Updates a member in the cluster
move-leader Transfers leadership to another etcd cluster member.
put Puts the given key into the store
role add Adds a new role
role delete Deletes a role
role get Gets detailed information of a role
role grant-permission Grants a key to a role
role list Lists all roles
role revoke-permission Revokes a key from a role
snapshot save Stores an etcd node backend snapshot to a given file
txn Txn processes all the requests in one transaction
user add Adds a new user
user delete Deletes a user
user get Gets detailed information of a user
user grant-role Grants a role to a user
user list Lists all users
user passwd Changes password of user
user revoke-role Revokes a role from a user
version Prints the version of etcdctl
watch Watches events stream on keys or prefixes
OPTIONS:
--auth-jwt-token="" JWT token used for authentication (if this option is used, --user and --password should not be set)
--cacert="" verify certificates of TLS-enabled secure servers using this CA bundle
--cert="" identify secure client using this TLS certificate file
--command-timeout=5s timeout for short running command (excluding dial timeout)
--debug[=false] enable client-side debug logging
--dial-timeout=2s dial timeout for client connections
-d, --discovery-srv="" domain name to query for SRV records describing cluster endpoints
--discovery-srv-name="" service name to query when using DNS discovery
--endpoints=[127.0.0.1:2379] gRPC endpoints
-h, --help[=false] help for etcdctl
--hex[=false] print byte strings as hex encoded strings
--insecure-discovery[=true] accept insecure SRV records describing cluster endpoints
--insecure-skip-tls-verify[=false] skip server certificate verification (CAUTION: this option should be enabled only for testing purposes)
--insecure-transport[=true] disable transport security for client connections
--keepalive-time=2s keepalive time for client connections
--keepalive-timeout=6s keepalive timeout for client connections
--key="" identify secure client using this TLS key file
--max-recv-bytes=0 client-side response receive limit in bytes (if 0, it defaults to "math.MaxInt32")
--max-request-bytes=0 client-side request send limit in bytes (if 0, it defaults to 2.0 MiB (2 * 1024 * 1024).)
--password="" password for authentication (if this option is used, --user option shouldn't include password)
--user="" username[:password] for authentication (prompt if password is not supplied)
-w, --write-out="simple" set the output format (fields, json, protobuf, simple, table)
after:
NAME:
etcdctl - A simple command line client for etcd3.
USAGE:
etcdctl [flags]
VERSION:
3.7.0-alpha.0
API VERSION:
3.7
Key-value commands:
compaction Compacts the event history in etcd
del Removes the specified key or range of keys [key, range_end)
get Gets the key or a range of keys
lease Lease related commands
put Puts the given key into the store
txn Txn processes all the requests in one transaction
watch Watches events stream on keys or prefixes
Cluster maintenance commands:
alarm Alarm related commands
defrag Defragments the storage of the etcd members with given endpoints
downgrade Downgrade related commands
endpoint Endpoint related commands
member Membership related commands
move-leader Transfers leadership to another etcd cluster member.
snapshot Manages etcd node snapshots
Concurrency commands:
elect Observes and participates in leader election
lock Acquires a named lock
Authentication commands:
auth Enable or disable authentication
role Role related commands
user User related commands
Utility commands:
check commands for checking properties of the etcd cluster
completion Generate completion script
help Help about any command
make-mirror Makes a mirror at the destination etcd cluster
version Prints the version of etcdctl
OPTIONS:
--auth-jwt-token="" JWT token used for authentication (if this option is used, --user and --password should not be set)
--cacert="" verify certificates of TLS-enabled secure servers using this CA bundle
--cert="" identify secure client using this TLS certificate file
--command-timeout=5s timeout for short running command (excluding dial timeout)
--debug[=false] enable client-side debug logging
--dial-timeout=2s dial timeout for client connections
-d, --discovery-srv="" domain name to query for SRV records describing cluster endpoints
--discovery-srv-name="" service name to query when using DNS discovery
--endpoints=[127.0.0.1:2379] gRPC endpoints
-h, --help[=false] help for etcdctl
--hex[=false] print byte strings as hex encoded strings
--insecure-discovery[=true] accept insecure SRV records describing cluster endpoints
--insecure-skip-tls-verify[=false] skip server certificate verification (CAUTION: this option should be enabled only for testing purposes)
--insecure-transport[=true] disable transport security for client connections
--keepalive-time=2s keepalive time for client connections
--keepalive-timeout=6s keepalive timeout for client connections
--key="" identify secure client using this TLS key file
--max-recv-bytes=0 client-side response receive limit in bytes (if 0, it defaults to "math.MaxInt32")
--max-request-bytes=0 client-side request send limit in bytes (if 0, it defaults to 2.0 MiB (2 * 1024 * 1024).)
--password="" password for authentication (if this option is used, --user option shouldn't include password)
--user="" username[:password] for authentication (prompt if password is not supplied)
-w, --write-out="simple" set the output format (fields, json, protobuf, simple, table)
Hi @hwdef. Thanks for your PR.
I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
cc @fuweid @ivanvc @jmhbnz @serathius @siyuanfoundation
/cc @serathius @fuweid @ahrtr @ivanvc @jmhbnz @siyuanfoundation
This PR is ready for review. Please take a look :-)
kindly ping @ivanvc @jmhbnz
/ok-to-test
Codecov Report
:x: Patch coverage is 3.80952% with 101 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 69.08%. Comparing base (aebb375) to head (161931b).
:warning: Report is 121 commits behind head on main.
:warning: Current head 161931b differs from pull request most recent head 90653b3
Please upload reports for the commit 90653b3 to get more accurate results.
Additional details and impacted files
| Files with missing lines | Coverage Δ | |
|---|---|---|
| etcdctl/ctlv3/command/completion_command.go | 0.00% <ø> (ø) |
|
| etcdctl/ctlv3/command/watch_command.go | 44.38% <100.00%> (+0.29%) |
:arrow_up: |
| etcdctl/ctlv3/command/snapshot_command.go | 0.00% <0.00%> (ø) |
|
| etcdctl/ctlv3/command/help_command.go | 0.00% <0.00%> (ø) |
|
| etcdctl/ctlv3/command/put_command.go | 0.00% <0.00%> (ø) |
|
| etcdctl/ctlv3/command/alarm_command.go | 0.00% <0.00%> (ø) |
|
| etcdctl/ctlv3/command/auth_command.go | 0.00% <0.00%> (ø) |
|
| etcdctl/ctlv3/command/check.go | 0.00% <0.00%> (ø) |
|
| etcdctl/ctlv3/command/downgrade_command.go | 0.00% <0.00%> (ø) |
|
| etcdctl/ctlv3/command/ep_command.go | 0.00% <0.00%> (ø) |
|
| ... and 16 more |
... and 20 files with indirect coverage changes
@@ Coverage Diff @@
## main #20162 +/- ##
==========================================
- Coverage 69.15% 69.08% -0.07%
==========================================
Files 415 416 +1
Lines 34630 34568 -62
==========================================
- Hits 23947 23882 -65
+ Misses 9296 9289 -7
- Partials 1387 1397 +10
Continue to review full report in Codecov by Sentry.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update aebb375...90653b3. Read the comment docs.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Overall LGTM One small feedback is some of the subcommands are hidden now. Maybe add instructions about how to list the subcommands
user User related commands. Use `etcdctl user --help` to see subcommands.
/retest
/retest
/test pull-etcd-e2e-386
Overall LGTM One small feedback is some of the subcommands are hidden now. Maybe add instructions about how to list the subcommands
user User related commands. Use `etcdctl user --help` to see subcommands.
@siyuanfoundation Hi, I've refined the description and fixed the CI error, please review again!
/lgtm
/cc @jmhbnz @ivanvc for further reviews.
New changes are detected. LGTM label has been removed.
cc @fuweid Please take a look, thanks!
kindly ping @siyuanfoundation @ivanvc
@jmhbnz @serathius Hi, This PR has been reviewed by some reviewers. Please check this and let me know if there is anything that needs to be modified, thank you
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: hwdef, ivanvc, serathius
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [serathius]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment