forked from yunify/qingcloud-cloud-controller-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
50 lines (42 loc) · 1.36 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"fmt"
"os"
"k8s.io/apiserver/pkg/server/healthz"
"k8s.io/apiserver/pkg/util/flag"
"k8s.io/apiserver/pkg/util/logs"
"k8s.io/kubernetes/cmd/cloud-controller-manager/app"
"k8s.io/kubernetes/cmd/cloud-controller-manager/app/options"
_ "k8s.io/kubernetes/pkg/client/metrics/prometheus" // for client metric registration
"k8s.io/kubernetes/pkg/cloudprovider"
_ "k8s.io/kubernetes/pkg/cloudprovider/providers"
_ "k8s.io/kubernetes/pkg/version/prometheus" // for version metric registration
"k8s.io/kubernetes/pkg/version/verflag"
_ "github.com/yunify/qingcloud-cloud-controller-manager/qingcloud"
"github.com/spf13/pflag"
goflag "flag"
)
func init() {
healthz.DefaultHealthz()
}
func main() {
s := options.NewCloudControllerManagerServer()
s.AddFlags(pflag.CommandLine)
flag.InitFlags()
// Convinces goflags that we have called Parse() to avoid noisy logs.
// OSS Issue: kubernetes/kubernetes#17162.
goflag.CommandLine.Parse([]string{})
logs.InitLogs()
defer logs.FlushLogs()
verflag.PrintAndExitIfRequested()
fmt.Fprintf(os.Stderr,"final flag: %+v\n", s)
cloud, err := cloudprovider.InitCloudProvider("qingcloud", s.CloudConfigFile)
if err != nil {
fmt.Fprintf(os.Stderr, "Cloud provider could not be initialized: %v", err)
os.Exit(1)
}
if err := app.Run(s, cloud); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
}