mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
fix the running of the kube-controller-manager
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
This commit is contained in:
parent
dbb6c77de4
commit
cac919bca4
@ -113,33 +113,29 @@ 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
|
||||
Kubernetes today are the replication controller, endpoints controller, namespace
|
||||
controller, and serviceaccounts controller.`,
|
||||
PersistentPreRun: func(*cobra.Command, []string) {
|
||||
PersistentPreRunE: func(*cobra.Command, []string) error {
|
||||
// silence client-go warnings.
|
||||
// kube-controller-manager generically watches APIs (including deprecated ones),
|
||||
// and CI ensures it works properly against matching kube-apiserver versions.
|
||||
restclient.SetDefaultWarningHandler(restclient.NoWarnings{})
|
||||
return nil
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
verflag.PrintAndExitIfRequested()
|
||||
|
||||
// Activate logging as soon as possible, after that
|
||||
// show flags with the final logging configuration.
|
||||
if err := logsapi.ValidateAndApply(s.Logs, utilfeature.DefaultFeatureGate); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
return err
|
||||
}
|
||||
cliflag.PrintFlags(cmd.Flags())
|
||||
|
||||
c, err := s.Config(KnownControllers(), ControllersDisabledByDefault.List())
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
return err
|
||||
}
|
||||
|
||||
if err := Run(c.Complete(), wait.NeverStop); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
return Run(c.Complete(), wait.NeverStop)
|
||||
},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
for _, arg := range args {
|
||||
|
Loading…
Reference in New Issue
Block a user