forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cluster.go
50 lines (38 loc) · 1.86 KB
/
cluster.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 cluster
import (
"fmt"
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
"github.com/openshift/origin/pkg/oc/clusteradd"
"github.com/openshift/origin/pkg/oc/clusterup"
)
const ClusterRecommendedName = "cluster"
var (
clusterLong = templates.LongDesc(`
Manage a local OpenShift cluster
The OpenShift cluster will run as an all-in-one container on a Docker host. The Docker host
may be a local VM (ie. using docker-machine on OS X and Windows clients), remote machine, or
the local Unix host.
Use the 'up' command to start a new cluster on a docker host.
To use an existing Docker connection, ensure that Docker commands are working and that you
can create new containers.
Default routes are setup using nip.io and the host ip of your cluster. To use a different
routing suffix, use the --routing-suffix flag.`)
)
func NewCmdCluster(name, fullName string, f kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
// Parent command to which all subcommands are added.
cmds := &cobra.Command{
Use: fmt.Sprintf("%s ACTION", name),
Short: "Start and stop OpenShift cluster",
Long: clusterLong,
Run: kcmdutil.DefaultSubCommandRun(streams.ErrOut),
}
clusterAdd := clusteradd.NewCmdAdd(clusteradd.CmdAddRecommendedName, fullName+" "+clusteradd.CmdAddRecommendedName, streams)
cmds.AddCommand(clusterAdd)
cmds.AddCommand(clusterup.NewCmdUp(clusterup.CmdUpRecommendedName, fullName+" "+clusterup.CmdUpRecommendedName, f, streams, clusterAdd))
cmds.AddCommand(clusterup.NewCmdDown(clusterup.CmdDownRecommendedName, fullName+" "+clusterup.CmdDownRecommendedName))
cmds.AddCommand(clusterup.NewCmdStatus(clusterup.CmdStatusRecommendedName, fullName+" "+clusterup.CmdStatusRecommendedName, f, streams))
return cmds
}