Optimize Cobra parameters of Controller Manager

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2021-10-17 18:57:23 +08:00
parent 0cef26182c
commit feaa78380c

View File

@ -119,12 +119,11 @@ state of the cluster through the apiserver and makes changes attempting to move
current state towards the desired state. Examples of controllers that ship with current state towards the desired state. Examples of controllers that ship with
Kubernetes today are the replication controller, endpoints controller, namespace Kubernetes today are the replication controller, endpoints controller, namespace
controller, and serviceaccounts controller.`, controller, and serviceaccounts controller.`,
PersistentPreRunE: func(*cobra.Command, []string) error { PersistentPreRun: func(*cobra.Command, []string) {
// silence client-go warnings. // silence client-go warnings.
// kube-controller-manager generically watches APIs (including deprecated ones), // kube-controller-manager generically watches APIs (including deprecated ones),
// and CI ensures it works properly against matching kube-apiserver versions. // and CI ensures it works properly against matching kube-apiserver versions.
restclient.SetDefaultWarningHandler(restclient.NoWarnings{}) restclient.SetDefaultWarningHandler(restclient.NoWarnings{})
return nil
}, },
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
verflag.PrintAndExitIfRequested() verflag.PrintAndExitIfRequested()