2014-06-07 07:40:48 +08:00
|
|
|
/*
|
2016-06-03 08:25:58 +08:00
|
|
|
Copyright 2014 The Kubernetes Authors.
|
2014-06-07 07:40:48 +08:00
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
*/
|
2014-06-24 02:32:11 +08:00
|
|
|
|
2014-06-07 07:40:48 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
2018-02-25 02:35:45 +08:00
|
|
|
goflag "flag"
|
2018-01-18 02:41:01 +08:00
|
|
|
"math/rand"
|
2015-02-20 02:30:31 +08:00
|
|
|
"os"
|
2018-01-18 02:41:01 +08:00
|
|
|
"time"
|
2015-02-20 02:30:31 +08:00
|
|
|
|
2018-02-25 02:35:45 +08:00
|
|
|
"github.com/spf13/pflag"
|
|
|
|
|
|
2019-02-15 23:28:13 +08:00
|
|
|
cliflag "k8s.io/component-base/cli/flag"
|
2019-01-17 22:06:12 +08:00
|
|
|
"k8s.io/component-base/logs"
|
2015-08-06 06:03:47 +08:00
|
|
|
"k8s.io/kubernetes/cmd/kube-proxy/app"
|
2016-08-16 02:31:44 +08:00
|
|
|
_ "k8s.io/kubernetes/pkg/client/metrics/prometheus" // for client metric registration
|
2017-02-13 23:35:12 +08:00
|
|
|
_ "k8s.io/kubernetes/pkg/version/prometheus" // for version metric registration
|
2014-06-07 07:40:48 +08:00
|
|
|
)
|
|
|
|
|
|
2017-04-26 21:41:44 +08:00
|
|
|
func main() {
|
2018-10-11 18:01:15 +08:00
|
|
|
rand.Seed(time.Now().UnixNano())
|
2018-01-18 02:41:01 +08:00
|
|
|
|
2017-04-26 21:41:44 +08:00
|
|
|
command := app.NewProxyCommand()
|
2015-02-03 05:54:52 +08:00
|
|
|
|
2018-02-25 02:35:45 +08:00
|
|
|
// 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.
|
2019-02-15 23:28:13 +08:00
|
|
|
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
|
2018-02-25 02:35:45 +08:00
|
|
|
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
|
|
|
|
|
// utilflag.InitFlags()
|
2016-08-06 13:54:13 +08:00
|
|
|
logs.InitLogs()
|
|
|
|
|
defer logs.FlushLogs()
|
2014-06-07 07:40:48 +08:00
|
|
|
|
2017-08-18 16:03:25 +08:00
|
|
|
if err := command.Execute(); err != nil {
|
2015-02-20 02:30:31 +08:00
|
|
|
os.Exit(1)
|
|
|
|
|
}
|
2014-06-07 07:40:48 +08:00
|
|
|
}
|