forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
80 lines (63 loc) · 2.74 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
73
74
75
76
77
78
79
80
package main
import (
goflag "flag"
"fmt"
"math/rand"
"os"
"runtime"
"time"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
genericapiserver "k8s.io/apiserver/pkg/server"
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-integrated-oauth-server"
"github.com/openshift/origin/pkg/cmd/openshift-kube-apiserver"
"github.com/openshift/origin/pkg/cmd/openshift-network-controller"
"github.com/openshift/origin/pkg/version"
)
func main() {
stopCh := genericapiserver.SetupSignalHandler()
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(stopCh)
if err := command.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
}
func NewHyperShiftCommand(stopCh <-chan struct{}) *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)
},
}
startOpenShiftAPIServer := openshift_apiserver.NewOpenShiftAPIServerCommand(openshift_apiserver.RecommendedStartAPIServerName, "hypershift", os.Stdout, os.Stderr, stopCh)
cmd.AddCommand(startOpenShiftAPIServer)
startOpenShiftKubeAPIServer := openshift_kube_apiserver.NewOpenShiftKubeAPIServerServerCommand(openshift_kube_apiserver.RecommendedStartAPIServerName, "hypershift", os.Stdout, os.Stderr, stopCh)
cmd.AddCommand(startOpenShiftKubeAPIServer)
startOpenShiftControllerManager := openshift_controller_manager.NewOpenShiftControllerManagerCommand(openshift_controller_manager.RecommendedStartControllerManagerName, "hypershift", os.Stdout, os.Stderr)
cmd.AddCommand(startOpenShiftControllerManager)
startOpenShiftNetworkController := openshift_network_controller.NewOpenShiftNetworkControllerCommand(openshift_network_controller.RecommendedStartNetworkControllerName, "hypershift", os.Stdout, os.Stderr)
cmd.AddCommand(startOpenShiftNetworkController)
startOsin := openshift_integrated_oauth_server.NewOsinServer(os.Stdout, os.Stderr, stopCh)
startOsin.Use = "openshift-osinserver"
startOsin.Deprecated = "will be removed in 4.0"
startOsin.Hidden = true
cmd.AddCommand(startOsin)
return cmd
}