-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
51 lines (40 loc) · 1.17 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
51
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
package main
import (
"fmt"
"math/rand"
"os"
"time"
"github.com/spf13/pflag"
"k8s.io/component-base/logs"
"k8s.io/kubernetes/cmd/cloud-controller-manager/app"
_ "k8s.io/kubernetes/pkg/util/prometheusclientgo"
_ "k8s.io/kubernetes/pkg/version/prometheus"
"github.com/danitso/clouddk-cloud-controller-manager/clouddkcp"
)
// main initializes the cloud provider.
func main() {
rand.Seed(time.Now().UnixNano())
command := app.NewCloudControllerManagerCommand()
command.Flags().VisitAll(func(fl *pflag.Flag) {
var err error
switch fl.Name {
case "allow-untagged-cloud", "authentication-skip-lookup":
err = fl.Value.Set("true")
case "cloud-provider":
err = fl.Value.Set(clouddkcp.ProviderName)
}
if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: Failed to set flag %q: %s\n", fl.Name, err)
os.Exit(1)
}
})
logs.InitLogs()
defer logs.FlushLogs()
if err := command.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "ERROR: %v\n", err)
os.Exit(1)
}
}