projectcalico / calico

Cloud native networking and network security
https://docs.tigera.io/calico/latest/about/
Apache License 2.0
6.02k stars 1.34k forks source link

calicoctl don't support with '--log-level=debug' #8477

Open cyclinder opened 9 months ago

cyclinder commented 9 months ago

Expected Behavior

calicoctl should be support with '--log-level=debug'

Current Behavior

calicoctl don't support with '--log-level=debug'

root@10-20-1-220:~# calicoctl label node 10-20-1-220 calico-group-id=rr1   --overwrite --log-level=debug
Usage:
  calicoctl label (<KIND> <NAME>
                  ( <key>=<value> [--overwrite] |
                    <key> --remove )
                  [--config=<CONFIG>] [--namespace=<NS>] [--context=<context>]) [--allow-version-mismatch]
root@10-20-1-220:~# calicoctl get node --log-level=debug
Usage:
  calicoctl get ( (<KIND> [<NAME>...]) |
                --filename=<FILENAME> [--recursive] [--skip-empty] )
                [--output=<OUTPUT>] [--config=<CONFIG>] [--namespace=<NS>] [--all-namespaces] [--export] [--context=<context>] [--allow-version-mismatch]

Possible Solution

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Context

root@10-20-1-220:~# calicoctl version
Client Version:    v3.26.1
Git commit:        b1d192c95
Cluster Version:   v3.26.1
Cluster Type:      k8s,bgp,kubeadm,kdd

Your Environment

cyclinder commented 9 months ago

calicoctl --log-level=debug label node 10-20-1-220 calico-group-id=rr1 --overwrite

cyclinder commented 9 months ago

maybe we can consider --log-level as a global flag

caseydavenport commented 8 months ago

I think as you discovered the --log-level flag does work globally across all commands, the problem is that it needs to be before the sub command.

i.e., calicoctl -l=debug subcommand instead of calicoctl subcommand -l=debug

This is a bit annoying but probably not super high priority to change IMO.