Skip to content

Commit

Permalink
Merge pull request #249 from ONE7live/main
Browse files Browse the repository at this point in the history
fix:The log flags are not set in apiserver using logs.Config.
  • Loading branch information
Iceber authored Jun 27, 2022
2 parents 8da69ed + b20717e commit 8f19c4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/apiserver/app/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions cmd/apiserver/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -21,6 +22,7 @@ type ClusterPediaServerOptions struct {
MaxRequestsInFlight int
MaxMutatingRequestsInFlight int

Logs *logs.Options
SecureServing *genericoptions.SecureServingOptionsWithLoopback
Authentication *genericoptions.DelegatingAuthenticationOptions
Authorization *genericoptions.DelegatingAuthorizationOptions
Expand All @@ -47,6 +49,7 @@ func NewServerOptions() *ClusterPediaServerOptions {
MaxRequestsInFlight: 0,
MaxMutatingRequestsInFlight: 0,

Logs: logs.NewOptions(),
SecureServing: sso.WithLoopback(),
Authentication: genericoptions.NewDelegatingAuthenticationOptions(),
Authorization: genericoptions.NewDelegatingAuthorizationOptions(),
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 8f19c4c

Please sign in to comment.