enhance kube-schedule init flag

This commit is contained in:
zhengjiajin 2017-12-13 14:46:58 +08:00
parent 38e3351312
commit 3ee3cf65cb
2 changed files with 3 additions and 12 deletions

View File

@ -70,6 +70,7 @@ import (
"github.com/golang/glog"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
utilflag "k8s.io/apiserver/pkg/util/flag"
"github.com/prometheus/client_golang/prometheus"
)
@ -342,8 +343,8 @@ through the API as necessary.`,
glog.Fatalf("unable to apply config defaults: %v", err)
}
flags := cmd.Flags()
AddFlags(opts, flags)
AddFlags(opts, pflag.CommandLine)
utilflag.InitFlags()
cmd.MarkFlagFilename("config", "yaml", "yml", "json")

View File

@ -17,12 +17,8 @@ limitations under the License.
package main
import (
goflag "flag"
"os"
"github.com/spf13/pflag"
utilflag "k8s.io/apiserver/pkg/util/flag"
"k8s.io/apiserver/pkg/util/logs"
_ "k8s.io/kubernetes/pkg/client/metrics/prometheus" // for client metric registration
_ "k8s.io/kubernetes/pkg/version/prometheus" // for version metric registration
@ -32,12 +28,6 @@ import (
func main() {
command := app.NewSchedulerCommand()
// TODO: once we switch everything over to Cobra commands, we can go back to calling
// utilflag.InitFlags() (by removing its pflag.Parse() call). For now, we have to set the
// normalize func and add the go flag set by hand.
pflag.CommandLine.SetNormalizeFunc(utilflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
// utilflag.InitFlags()
logs.InitLogs()
defer logs.FlushLogs()