mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +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
|
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.`,
|
||||||
PersistentPreRun: func(*cobra.Command, []string) {
|
PersistentPreRunE: func(*cobra.Command, []string) error {
|
||||||
// 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) {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
verflag.PrintAndExitIfRequested()
|
verflag.PrintAndExitIfRequested()
|
||||||
|
|
||||||
// Activate logging as soon as possible, after that
|
// Activate logging as soon as possible, after that
|
||||||
// show flags with the final logging configuration.
|
// show flags with the final logging configuration.
|
||||||
if err := logsapi.ValidateAndApply(s.Logs, utilfeature.DefaultFeatureGate); err != nil {
|
if err := logsapi.ValidateAndApply(s.Logs, utilfeature.DefaultFeatureGate); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
return err
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
cliflag.PrintFlags(cmd.Flags())
|
cliflag.PrintFlags(cmd.Flags())
|
||||||
|
|
||||||
c, err := s.Config(KnownControllers(), ControllersDisabledByDefault.List())
|
c, err := s.Config(KnownControllers(), ControllersDisabledByDefault.List())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
return err
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := Run(c.Complete(), wait.NeverStop); err != nil {
|
return Run(c.Complete(), wait.NeverStop)
|
||||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
|
Loading…
Reference in New Issue
Block a user