forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
72 lines (57 loc) · 2.28 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
goflag "flag"
"fmt"
"math/rand"
"os"
"runtime"
"time"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
utilflag "k8s.io/apiserver/pkg/util/flag"
"k8s.io/apiserver/pkg/util/logs"
"github.com/openshift/library-go/pkg/serviceability"
"github.com/openshift/origin/pkg/cmd/openshift-apiserver"
"github.com/openshift/origin/pkg/cmd/openshift-controller-manager"
"github.com/openshift/origin/pkg/cmd/openshift-etcd"
"github.com/openshift/origin/pkg/cmd/openshift-kube-apiserver"
"github.com/openshift/origin/pkg/version"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano())
pflag.CommandLine.SetNormalizeFunc(utilflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
logs.InitLogs()
defer logs.FlushLogs()
defer serviceability.BehaviorOnPanic(os.Getenv("OPENSHIFT_ON_PANIC"), version.Get())()
defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop()
if len(os.Getenv("GOMAXPROCS")) == 0 {
runtime.GOMAXPROCS(runtime.NumCPU())
}
command := NewHyperShiftCommand()
if err := command.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
}
func NewHyperShiftCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "hypershift",
Short: "Combined server command for OpenShift",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
os.Exit(1)
},
}
startEtcd, _ := openshift_etcd.NewCommandStartEtcdServer(openshift_etcd.RecommendedStartEtcdServerName, "hypershift", os.Stdout, os.Stderr)
startEtcd.Deprecated = "will be removed in 3.10"
startEtcd.Hidden = true
cmd.AddCommand(startEtcd)
startOpenShiftAPIServer := openshift_apiserver.NewOpenShiftAPIServerCommand(openshift_apiserver.RecommendedStartAPIServerName, "hypershift", os.Stdout, os.Stderr)
cmd.AddCommand(startOpenShiftAPIServer)
startOpenShiftKubeAPIServer := openshift_kube_apiserver.NewOpenShiftKubeAPIServerServerCommand(openshift_kube_apiserver.RecommendedStartAPIServerName, "hypershift", os.Stdout, os.Stderr)
cmd.AddCommand(startOpenShiftKubeAPIServer)
startOpenShiftControllerManager := openshift_controller_manager.NewOpenShiftControllerManagerCommand(openshift_controller_manager.RecommendedStartControllerManagerName, "hypershift", os.Stdout, os.Stderr)
cmd.AddCommand(startOpenShiftControllerManager)
return cmd
}