Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"os/exec"
"strings"

Expand Down Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions cmd/openshift-install/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions docs/design/assetgeneration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down