diff --git a/cmd/apiserver/app/apiserver.go b/cmd/apiserver/app/apiserver.go index ac2b2fc97..cbe480dcb 100644 --- a/cmd/apiserver/app/apiserver.go +++ b/cmd/apiserver/app/apiserver.go @@ -10,6 +10,7 @@ import ( cliflag "k8s.io/component-base/cli/flag" "k8s.io/component-base/cli/globalflag" "k8s.io/component-base/featuregate" + "k8s.io/component-base/logs" "k8s.io/component-base/term" "github.com/clusterpedia-io/clusterpedia/cmd/apiserver/app/options" @@ -51,7 +52,7 @@ func NewClusterPediaServerCommand(ctx context.Context) *cobra.Command { namedFlagSets := opts.Flags() verflag.AddFlags(namedFlagSets.FlagSet("global")) - globalflag.AddGlobalFlags(namedFlagSets.FlagSet("global"), cmd.Name()) + globalflag.AddGlobalFlags(namedFlagSets.FlagSet("global"), cmd.Name(), logs.SkipLoggingConfigurationFlags()) utilfeature.DefaultMutableFeatureGate.AddFlag(namedFlagSets.FlagSet("mutable feature gate")) fs := cmd.Flags() diff --git a/cmd/apiserver/app/options/options.go b/cmd/apiserver/app/options/options.go index a13114a86..6a7287e25 100644 --- a/cmd/apiserver/app/options/options.go +++ b/cmd/apiserver/app/options/options.go @@ -11,6 +11,7 @@ import ( "k8s.io/apiserver/pkg/util/feature" cliflag "k8s.io/component-base/cli/flag" "k8s.io/component-base/featuregate" + "k8s.io/component-base/logs" "github.com/clusterpedia-io/clusterpedia/pkg/apiserver" "github.com/clusterpedia-io/clusterpedia/pkg/storage" @@ -21,6 +22,7 @@ type ClusterPediaServerOptions struct { MaxRequestsInFlight int MaxMutatingRequestsInFlight int + Logs *logs.Options SecureServing *genericoptions.SecureServingOptionsWithLoopback Authentication *genericoptions.DelegatingAuthenticationOptions Authorization *genericoptions.DelegatingAuthorizationOptions @@ -47,6 +49,7 @@ func NewServerOptions() *ClusterPediaServerOptions { MaxRequestsInFlight: 0, MaxMutatingRequestsInFlight: 0, + Logs: logs.NewOptions(), SecureServing: sso.WithLoopback(), Authentication: genericoptions.NewDelegatingAuthenticationOptions(), Authorization: genericoptions.NewDelegatingAuthorizationOptions(), @@ -151,6 +154,7 @@ func (o *ClusterPediaServerOptions) Flags() cliflag.NamedFlagSets { // o.Traces.AddFlags(fss.FlagSet("traces")) o.Storage.AddFlags(fss.FlagSet("storage")) + o.Logs.AddFlags(fss.FlagSet("logs")) return fss }