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

grouping flags for karmada-controller-manager #1468

Merged
merged 1 commit into from
Mar 14, 2022

Conversation

RainbowMango
Copy link
Member

What type of PR is this?
/kind feature

What this PR does / why we need it:
Grouping flags for better readability.

Full help info now is:

Click here for full output

-bash-4.2# ./karmada-controller-manager --help
The karmada controller manager runs a bunch of controllers

Usage:
karmada-controller-manager [flags]

Available Commands:
karmada-controller-manager completion generate the autocompletion script for the specified shell
karmada-controller-manager help Help about any command
karmada-controller-manager version Print the version information.

Generic flags:

  --bind-address string                                                                                                                                                                                                      
            The IP address on which to listen for the --secure-port port. (default "0.0.0.0")
  --cluster-api-burst int                                                                                                                                                                                                    
            Burst to use while talking with cluster kube-apiserver. Doesn't cover events and node heartbeat apis which rate limiting is controlled by a different set of flags. (default 60)
  --cluster-api-context string                                                                                                                                                                                               
            Name of the cluster context in cluster-api management cluster kubeconfig file.
  --cluster-api-kubeconfig string                                                                                                                                                                                            
            Path to the cluster-api management cluster kubeconfig file.
  --cluster-api-qps float32                                                                                                                                                                                                  
            QPS to use while talking with cluster kube-apiserver. Doesn't cover events and node heartbeat apis which rate limiting is controlled by a different set of flags. (default 40)
  --cluster-cache-sync-timeout duration                                                                                                                                                                                      
            Timeout period waiting for cluster cache to sync. (default 30s)
  --cluster-lease-duration duration                                                                                                                                                                                          
            Specifies the expiration period of a cluster lease. (default 40s)
  --cluster-lease-renew-interval-fraction float                                                                                                                                                                              
            Specifies the cluster lease renew interval fraction. (default 0.25)
  --cluster-monitor-grace-period duration                                                                                                                                                                                    
            Specifies the grace period of allowing a running cluster to be unresponsive before marking it unhealthy. (default 40s)
  --cluster-monitor-period duration                                                                                                                                                                                          
            Specifies how often karmada-controller-manager monitors cluster health status. (default 5s)
  --cluster-startup-grace-period duration                                                                                                                                                                                    
            Specifies the grace period of allowing a cluster to be unresponsive during startup before marking it unhealthy. (default 1m0s)
  --cluster-status-update-frequency duration                                                                                                                                                                                 
            Specifies how often karmada-controller-manager posts cluster status to karmada-apiserver. (default 10s)
  --concurrent-cluster-syncs int                                                                                                                                                                                             
            The number of Clusters that are allowed to sync concurrently. (default 5)
  --concurrent-clusterresourcebinding-syncs int                                                                                                                                                                              
            The number of ClusterResourceBindings that are allowed to sync concurrently. (default 5)
  --concurrent-namespace-syncs int                                                                                                                                                                                           
            The number of Namespaces that are allowed to sync concurrently. (default 1)
  --concurrent-resource-template-syncs int                                                                                                                                                                                   
            The number of resource templates that are allowed to sync concurrently. (default 5)
  --concurrent-resourcebinding-syncs int                                                                                                                                                                                     
            The number of ResourceBindings that are allowed to sync concurrently. (default 5)
  --concurrent-work-syncs int                                                                                                                                                                                                
            The number of Works that are allowed to sync concurrently. (default 5)
  --controllers strings                                                                                                                                                                                                      
            A list of controllers to enable. '*' enables all on-by-default controllers, 'foo' enables the controller named 'foo', '-foo' disables the controller named 'foo'. All controllers: binding, cluster, clusterStatus,
            endpointSlice, execution, federatedResourceQuotaStatus, federatedResourceQuotaSync, hpa, namespace, serviceExport, serviceImport, unifiedAuth, workStatus. (default [*])
  --feature-gates mapStringBool                                                                                                                                                                                              
            A set of key=value pairs that describe feature gates for alpha/experimental features. Options are:
            AllAlpha=true|false (ALPHA - default=false)
            AllBeta=true|false (BETA - default=false)
            Failover=true|false (ALPHA - default=false)
            PropagateDeps=true|false (ALPHA - default=false)
  --kube-api-burst int                                                                                                                                                                                                       
            Burst to use while talking with karmada-apiserver. Doesn't cover events and node heartbeat apis which rate limiting is controlled by a different set of flags. (default 60)
  --kube-api-qps float32                                                                                                                                                                                                     
            QPS to use while talking with karmada-apiserver. Doesn't cover events and node heartbeat apis which rate limiting is controlled by a different set of flags. (default 40)
  --kubeconfig string                                                                                                                                                                                                        
            Path to karmada control plane kubeconfig file.
  --leader-elect                                                                                                                                                                                                             
            Start a leader election client and gain leadership before executing the main loop. Enable this when running replicated components for high availability. (default true)
  --leader-elect-resource-namespace string                                                                                                                                                                                   
            The namespace of resource object that is used for locking during leader election. (default "karmada-system")
  --metrics-bind-address string                                                                                                                                                                                              
            The TCP address that the controller should bind to for serving prometheus metrics(e.g. 127.0.0.1:8088, :8088) (default ":8080")
  --rate-limiter-base-delay duration                                                                                                                                                                                         
            The base delay for rate limiter. (default 5ms)
  --rate-limiter-bucket-size int                                                                                                                                                                                             
            The bucket size for rate limier. (default 100)
  --rate-limiter-max-delay duration                                                                                                                                                                                          
            The max delay for rate limiter. (default 16m40s)
  --rate-limiter-qps int                                                                                                                                                                                                     
            The qps for rate limier. (default 10)
  --resync-period duration                                                                                                                                                                                                   
            Base frequency the informers are resynced.
  --secure-port int                                                                                                                                                                                                          
            The secure port on which to serve HTTPS. (default 10357)
  --skipped-propagating-apis string                                                                                                                                                                                          
            Semicolon separated resources that should be skipped from propagating in addition to the default skip list(cluster.karmada.io;policy.karmada.io;work.karmada.io). Supported formats are:
            <group> for skip resources with a specific API group(e.g. networking.k8s.io),
            <group>/<version> for skip resources with a specific API version(e.g. networking.k8s.io/v1beta1),
            <group>/<version>/<kind>,<kind> for skip one or more specific resource(e.g. networking.k8s.io/v1beta1/Ingress,IngressClass) where the kinds are case-insensitive.
  --skipped-propagating-namespaces strings                                                                                                                                                                                   
            Comma-separated namespaces that should be skipped from propagating in addition to the default skipped namespaces(karmada-system, karmada-cluster, namespaces prefixed by kube- and karmada-es-).

Logs flags:

  --add_dir_header                                                                                                                                                                                                           
            If true, adds the file directory to the header of the log messages
  --alsologtostderr                                                                                                                                                                                                          
            log to standard error as well as files
  --kubeconfig string                                                                                                                                                                                                        
            Paths to a kubeconfig. Only required if out-of-cluster.
  --log_backtrace_at traceLocation                                                                                                                                                                                           
            when logging hits line file:N, emit a stack trace (default :0)
  --log_dir string                                                                                                                                                                                                           
            If non-empty, write log files in this directory
  --log_file string                                                                                                                                                                                                          
            If non-empty, use this log file
  --log_file_max_size uint                                                                                                                                                                                                   
            Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
  --logtostderr                                                                                                                                                                                                              
            log to standard error instead of files (default true)
  --one_output                                                                                                                                                                                                               
            If true, only write logs to their native severity level (vs also writing to each lower severity level)
  --skip_headers                                                                                                                                                                                                             
            If true, avoid header prefixes in the log messages
  --skip_log_headers                                                                                                                                                                                                         
            If true, avoid headers when opening log files
  --stderrthreshold severity                                                                                                                                                                                                 
            logs at or above this threshold go to stderr (default 2)

-v, --v Level
number for the log level verbosity
--vmodule moduleSpec
comma-separated list of pattern=N settings for file-filtered logging

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:
This PR focus on grouping klog flags.

Does this PR introduce a user-facing change?:

`karmada-controller-manager`: The klog flags now have been grouped for better readability.

@karmada-bot karmada-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. labels Mar 10, 2022
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 10, 2022
@lonelyCZ
Copy link
Member

Cool, using public libraries is easier to maintain!

LGTM

@RainbowMango RainbowMango marked this pull request as ready for review March 11, 2022 02:26
@karmada-bot karmada-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 11, 2022
@lonelyCZ
Copy link
Member

Could we adjust the format of flags

Original format

Usage:
  karmada-controller-manager [flags]
  karmada-controller-manager [command]

Available Commands:
  completion  generate the autocompletion script for the specified shell
  help        Help about any command
  version     Print the version information.

Flags:
      --add_dir_header                                If true, adds the file directory to the header of the log messages
      --alsologtostderr                               log to standard error as well as files
      --bind-address string                           The IP address on which to listen for the --secure-port port. (default "0.0.0.0")
      --cluster-api-burst int                         Burst to use while talking with cluster kube-apiserver. Doesn't cover events and node heartbeat apis which rate limiting is controlled by a different set of flags. (default 60)
      --cluster-api-context string                    Name of the cluster context in cluster-api management cluster kubeconfig file.
      --cluster-api-kubeconfig string                 Path to the cluster-api management cluster kubeconfig file.
      --cluster-api-qps float32                       QPS to 

Now format:

Usage:
  karmada-controller-manager [flags]

Available Commands:
  karmada-controller-manager completion                      generate the autocompletion script for the specified shell
  karmada-controller-manager help                            Help about any command
  karmada-controller-manager version                         Print the version information.

Generic flags:

      --bind-address string                                                                                                                                                                             
                The IP address on which to listen for the --secure-port port. (default "0.0.0.0")
      --cluster-api-burst int                                                                                                                                                                           
                Burst to use while talking with cluster kube-apiserver. Doesn't cover events and node heartbeat apis which rate limiting is controlled by a different set of flags. (default 60)
      --cluster-api-context string                                                                                                                                                                      
                Name of the cluster context in cluster-api management cluster kubeconfig file.
      --cluster-api-kubeconfig string                                                                                                                                                                   
                Path to the cluster-api management cluster kubeconfig file.
      --cluster-api-qps float32 

I think the original format is more compact that occupy less screen.

@RainbowMango
Copy link
Member Author

Do you know how to do that?

@lonelyCZ
Copy link
Member

Do you know how to do that?

I'm trying to research it now.

@RainbowMango
Copy link
Member Author

Yeah, I get it. bug if you are seeing the usage in a small window, it gonna be pretty ugly(without wrap). Have you ever tried it?

With wrap in small window:

      --skipped-propagating-apis string                                                                    
                Semicolon separated resources that should be skipped from propagating in addition to the
                default skip list(cluster.karmada.io;policy.karmada.io;work.karmada.io). Supported formats
                are:
                <group> for skip resources with a specific API group(e.g. networking.k8s.io),
                <group>/<version> for skip resources with a specific API version(e.g.
                networking.k8s.io/v1beta1),
                <group>/<version>/<kind>,<kind> for skip one or more specific resource(e.g.
                networking.k8s.io/v1beta1/Ingress,IngressClass) where the kinds are case-insensitive.

without wrap in small window:

      --skipped-propagating-apis string               Semicolon separated resources that should be skipped from propagating in addition to the default skip list(cluster.karmada.io;policy.karmada.io;work.karmada.io). Supported formats are:
                                                      <group> for skip resources with a specific API group(e.g. networking.k8s.io),
                                                      <group>/<version> for skip resources with a specific API version(e.g. networking.k8s.io/v1beta1),
                                                      <group>/<version>/<kind>,<kind> for skip one or more specific resource(e.g. networking.k8s.io/v1beta1/Ingress,IngressClass) where the kinds are case-insensitive.

@lonelyCZ
Copy link
Member

Alright, I have tried it that is clearer for small window with wrap.

Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
@RainbowMango
Copy link
Member Author

Force pushed as introduced a common package for adding klog flags.
Please take a look.

@lonelyCZ
Copy link
Member

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 11, 2022
@RainbowMango RainbowMango added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 14, 2022
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot merged commit 42c8c31 into karmada-io:master Mar 14, 2022
@RainbowMango RainbowMango deleted the pr_grouping_log_flags branch March 15, 2022 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants