logs: replace config methods with functions

API types are only supposed to have methods related to serialization.
This commit is contained in:
Patrick Ohly
2022-05-31 10:08:54 +02:00
parent ea3f25f49b
commit 4c6338ac0f
15 changed files with 40 additions and 34 deletions

View File

@@ -124,7 +124,7 @@ controller, and serviceaccounts controller.`,
// Activate logging as soon as possible, after that
// show flags with the final logging configuration.
if err := s.Logs.ValidateAndApply(utilfeature.DefaultFeatureGate); err != nil {
if err := logsapi.ValidateAndApply(s.Logs, utilfeature.DefaultFeatureGate); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}

View File

@@ -34,6 +34,7 @@ import (
cpoptions "k8s.io/cloud-provider/options"
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/component-base/logs"
logsapi "k8s.io/component-base/logs/api/v1"
"k8s.io/component-base/metrics"
cmoptions "k8s.io/controller-manager/options"
kubectrlmgrconfigv1alpha1 "k8s.io/kube-controller-manager/config/v1alpha1"
@@ -256,7 +257,7 @@ func (s *KubeControllerManagerOptions) Flags(allControllers []string, disabledBy
s.SAController.AddFlags(fss.FlagSet("serviceaccount controller"))
s.TTLAfterFinishedController.AddFlags(fss.FlagSet("ttl-after-finished controller"))
s.Metrics.AddFlags(fss.FlagSet("metrics"))
s.Logs.AddFlags(fss.FlagSet("logs"))
logsapi.AddFlags(s.Logs, fss.FlagSet("logs"))
fs := fss.FlagSet("misc")
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig).")