1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 15:47:14 +01:00

cmd/openshift-install: Push creation under 'openshift create'

To mirror 'openshift-install destroy' and make it easier for folks
using multiple invocations to see what their options are.

I've deprecated all the old commands, and am looking forward to
dropping them as soon as possible :).
This commit is contained in:
W. Trevor King
2018-10-22 13:58:17 -07:00
parent e1a71ff810
commit 85c76c9851
4 changed files with 33 additions and 12 deletions

View File

@@ -19,7 +19,7 @@ hack/build.sh
This will create `bin/openshift-install`. This binary can then be invoked to create an OpenShift cluster, like so:
```sh
bin/openshift-install cluster
bin/openshift-install create cluster
```
The installer requires the terraform binary either alongside openshift-install or in `$PATH`.
@@ -41,8 +41,8 @@ Log in using the admin credentials you configured when creating the cluster.
#### Kubeconfig
You can also use the admin kubeconfig which `openshift-install cluster` placed under `--dir` (which defaults to `.`) in `auth/kubeconfig`.
If you launched the cluster with `openshift-install --dir "${DIR}" cluster`, you can use:
You can also use the admin kubeconfig which `openshift-install create cluster` placed under `--dir` (which defaults to `.`) in `auth/kubeconfig`.
If you launched the cluster with `openshift-install --dir "${DIR}" create cluster`, you can use:
```sh
export KUBECONFIG="${DIR}/auth/kubeconfig"

View File

@@ -1,6 +1,7 @@
package main
import (
"fmt"
"os/exec"
"strings"
@@ -57,15 +58,35 @@ var targets = []target{{
assets: []asset.WritableAsset{&cluster.TerraformVariables{}, &kubeconfig.Admin{}, &cluster.Cluster{}},
}}
// Deprecated: Use 'create' subcommands instead.
func newTargetsCmd() []*cobra.Command {
var cmds []*cobra.Command
for _, t := range targets {
t.command.RunE = runTargetCmd(t.assets...)
cmds = append(cmds, t.command)
cmd := *t.command
cmd.Short = fmt.Sprintf("DEPRECATED: USE 'create %s' instead.", cmd.Use)
cmd.RunE = runTargetCmd(t.assets...)
cmds = append(cmds, &cmd)
}
return cmds
}
func newCreateCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "create",
Short: "Create part of an OpenShift cluster",
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
}
for _, t := range targets {
t.command.RunE = runTargetCmd(t.assets...)
cmd.AddCommand(t.command)
}
return cmd
}
func runTargetCmd(targets ...asset.WritableAsset) func(cmd *cobra.Command, args []string) error {
return func(cmd *cobra.Command, args []string) error {
assetStore, err := asset.NewStore(rootOpts.dir)

View File

@@ -16,17 +16,17 @@ var (
func main() {
rootCmd := newRootCmd()
var subCmds []*cobra.Command
for _, cmd := range newTargetsCmd() {
subCmds = append(subCmds, cmd)
rootCmd.AddCommand(cmd)
}
subCmds = append(subCmds,
for _, subCmd := range []*cobra.Command{
newCreateCmd(),
newDestroyCmd(),
newLegacyDestroyClusterCmd(),
newVersionCmd(),
newGraphCmd(),
)
for _, subCmd := range subCmds {
} {
rootCmd.AddCommand(subCmd)
}

View File

@@ -72,10 +72,10 @@ After being loaded and consumed by a children asset, the existing on-disk asset
E.g.
```shell
$ openshift-install install-config
$ openshift-install create install-config
# Generate install-config.yml
$ openshift-install manifests
$ openshift-install create manifests
# Generate manifests/ and tectonic/ dir, also remove install-config.yml
```