Skip to content

Commit

Permalink
show cli flags in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
cofyc committed Feb 27, 2020
1 parent 430fa95 commit 89e0c38
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/admission-webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import (
"time"

"github.com/openshift/generic-admission-server/pkg/cmd"

"github.com/pingcap/tidb-operator/pkg/features"
"github.com/pingcap/tidb-operator/pkg/version"
"github.com/pingcap/tidb-operator/pkg/webhook"
"k8s.io/component-base/logs"
glog "k8s.io/klog"
)

var (
Expand Down Expand Up @@ -51,6 +51,10 @@ func main() {
}
version.LogVersionInfo()

flag.CommandLine.VisitAll(func(flag *flag.Flag) {
glog.V(1).Infof("FLAG: --%s=%q", flag.Name, flag.Value)
})

ah := &webhook.AdmissionHook{
ExtraServiceAccounts: extraServiceAccounts,
EvictRegionLeaderTimeout: evictRegionLeaderTimeout,
Expand Down
4 changes: 4 additions & 0 deletions cmd/controller-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ func main() {
logs.InitLogs()
defer logs.FlushLogs()

flag.CommandLine.VisitAll(func(flag *flag.Flag) {
glog.V(1).Infof("FLAG: --%s=%q", flag.Name, flag.Value)
})

hostName, err := os.Hostname()
if err != nil {
glog.Fatalf("failed to get hostname: %v", err)
Expand Down
4 changes: 4 additions & 0 deletions cmd/discovery/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func main() {
logs.InitLogs()
defer logs.FlushLogs()

flag.CommandLine.VisitAll(func(flag *flag.Flag) {
glog.V(1).Infof("FLAG: --%s=%q", flag.Name, flag.Value)
})

cfg, err := rest.InClusterConfig()
if err != nil {
glog.Fatalf("failed to get config: %v", err)
Expand Down
4 changes: 4 additions & 0 deletions cmd/scheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func main() {
logs.InitLogs()
defer logs.FlushLogs()

flag.CommandLine.VisitAll(func(flag *flag.Flag) {
glog.V(1).Infof("FLAG: --%s=%q", flag.Name, flag.Value)
})

cfg, err := rest.InClusterConfig()
if err != nil {
glog.Fatalf("failed to get config: %v", err)
Expand Down

0 comments on commit 89e0c38

Please sign in to comment.