forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cluster.go
51 lines (39 loc) · 1.85 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
51
package cluster
import (
"fmt"
"io"
"github.com/openshift/origin/pkg/oc/clusteradd"
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"github.com/openshift/origin/pkg/oc/cli/util/clientcmd"
"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 *clientcmd.Factory, out, errout io.Writer) *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: cmdutil.DefaultSubCommandRun(errout),
}
clusterAdd := clusteradd.NewCmdAdd(clusteradd.CmdAddRecommendedName, fullName+" "+clusteradd.CmdAddRecommendedName, out, errout)
cmds.AddCommand(clusterAdd)
cmds.AddCommand(clusterup.NewCmdUp(clusterup.CmdUpRecommendedName, fullName+" "+clusterup.CmdUpRecommendedName, out, errout, clusterAdd))
cmds.AddCommand(clusterup.NewCmdDown(clusterup.CmdDownRecommendedName, fullName+" "+clusterup.CmdDownRecommendedName))
cmds.AddCommand(clusterup.NewCmdStatus(clusterup.CmdStatusRecommendedName, fullName+" "+clusterup.CmdStatusRecommendedName, f, out))
return cmds
}