Skip to content

Commit

Permalink
Merge pull request #979 from ncdc/default-v-2
Browse files Browse the repository at this point in the history
Default to -v=2
  • Loading branch information
ncdc authored May 4, 2022
2 parents c6dec0f + e07ffe8 commit f4f4a73
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
7 changes: 6 additions & 1 deletion cmd/ingress-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/component-base/config"
"k8s.io/component-base/logs"

"github.com/kcp-dev/kcp/pkg/cmd/help"
Expand Down Expand Up @@ -130,13 +131,17 @@ type Options struct {
}

func NewDefaultOptions() *Options {
// Default to -v=2
logs := logs.NewOptions()
logs.Config.Verbosity = config.VerbosityLevel(2)

return &Options{
Kubeconfig: "",
Context: "",
EnvoyXDSPort: 18000,
EnvoyListenerPort: 80,
Domain: "kcp-apps.127.0.0.1.nip.io",
Logs: logs.NewOptions(),
Logs: logs,
}
}

Expand Down
4 changes: 4 additions & 0 deletions cmd/kcp-front-proxy/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/spf13/pflag"

apiserveroptions "k8s.io/apiserver/pkg/server/options"
"k8s.io/component-base/config"
"k8s.io/component-base/logs"

proxyoptions "github.com/kcp-dev/kcp/pkg/proxy/options"
Expand All @@ -47,6 +48,9 @@ func NewOptions() *Options {
RootDirectory: ".kcp",
}

// Default to -v=2
o.Logs.Config.Verbosity = config.VerbosityLevel(2)

// override all the things
o.SecureServing.BindPort = 443
o.SecureServing.ServerCert.CertDirectory = ""
Expand Down
8 changes: 7 additions & 1 deletion cmd/kcp/kcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (
"k8s.io/client-go/rest"
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/component-base/cli/globalflag"
"k8s.io/component-base/config"
"k8s.io/component-base/logs"
"k8s.io/component-base/term"

"github.com/kcp-dev/kcp/pkg/cmd/help"
Expand Down Expand Up @@ -58,6 +60,10 @@ func main() {
cols, _, _ := term.TerminalSize(cmd.OutOrStdout())

serverOptions := options.NewOptions()

// Default to -v=2
serverOptions.GenericControlPlane.Logs.Config.Verbosity = config.VerbosityLevel(2)

startCmd := &cobra.Command{
Use: "start",
Short: "Start the control plane process",
Expand Down Expand Up @@ -102,7 +108,7 @@ func main() {

// add start named flag sets to start flags
namedStartFlagSets := serverOptions.Flags()
globalflag.AddGlobalFlags(namedStartFlagSets.FlagSet("global"), cmd.Name())
globalflag.AddGlobalFlags(namedStartFlagSets.FlagSet("global"), cmd.Name(), logs.SkipLoggingConfigurationFlags())
startFlags := startCmd.Flags()
for _, f := range namedStartFlagSets.FlagSets {
startFlags.AddFlagSet(f)
Expand Down
7 changes: 6 additions & 1 deletion cmd/syncer/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/spf13/pflag"

"k8s.io/component-base/config"
"k8s.io/component-base/logs"

nscontroller "github.com/kcp-dev/kcp/pkg/reconciler/workload/namespace"
Expand All @@ -41,9 +42,13 @@ type Options struct {
}

func NewOptions() *Options {
// Default to -v=2
logs := logs.NewOptions()
logs.Config.Verbosity = config.VerbosityLevel(2)

return &Options{
SyncedResourceTypes: []string{},
Logs: logs.NewOptions(),
Logs: logs,
APIImportPollInterval: 1 * time.Minute,
}
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/virtual-workspaces/command/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"k8s.io/client-go/pkg/version"
"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
"k8s.io/component-base/config"
"k8s.io/klog/v2"

"github.com/kcp-dev/kcp/cmd/virtual-workspaces/options"
Expand All @@ -50,6 +51,10 @@ type SubCommandOptions interface {

func NewCommand(errout io.Writer, stopCh <-chan struct{}) *cobra.Command {
opts := options.NewOptions()

// Default to -v=2
opts.Logs.Config.Verbosity = config.VerbosityLevel(2)

cmd := &cobra.Command{
Use: "workspaces",
Short: "Launch workspaces virtual workspace apiserver",
Expand Down

0 comments on commit f4f4a73

Please sign in to comment.