Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/openshift-install/waitfor: Rename from user-provided-infrastructure #1552

Merged
merged 1 commit into from
Apr 8, 2019
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
4 changes: 2 additions & 2 deletions cmd/openshift-install/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ var (
logrus.Fatal(err)
}

err = finish(ctx, config, rootOpts.dir)
err = waitForClusterReady(ctx, config, rootOpts.dir)
if err != nil {
logrus.Fatal(err)
}
Expand Down Expand Up @@ -433,7 +433,7 @@ func logComplete(directory, consoleURL string) error {
return nil
}

func finish(ctx context.Context, config *rest.Config, directory string) error {
func waitForClusterReady(ctx context.Context, config *rest.Config, directory string) error {
if err := waitForInitializedCluster(ctx, config); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/openshift-install/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func installerMain() {
for _, subCmd := range []*cobra.Command{
newCreateCmd(),
newDestroyCmd(),
newUPICmd(),
newWaitForCmd(),
newVersionCmd(),
newGraphCmd(),
newCompletionCmd(),
Expand Down
98 changes: 0 additions & 98 deletions cmd/openshift-install/upi.go

This file was deleted.

79 changes: 79 additions & 0 deletions cmd/openshift-install/waitfor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package main

import (
"context"
"path/filepath"

"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"k8s.io/client-go/tools/clientcmd"
)

func newWaitForCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "wait-for",
Short: "Wait for install-time events",
Long: `Wait for install-time events.

'create cluster' has a few stages that wait for cluster events. But
these waits can also be useful on their own. This subcommand exposes
them directly.`,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
}
cmd.AddCommand(newWaitForBootstrapCompleteCmd())
cmd.AddCommand(newWaitForClusterReadyCmd())
return cmd
}

func newWaitForBootstrapCompleteCmd() *cobra.Command {
return &cobra.Command{
Use: "bootstrap-complete",
Short: "Wait until cluster bootstrapping has completed",
Args: cobra.ExactArgs(0),
Run: func(_ *cobra.Command, _ []string) {
ctx := context.Background()

cleanup := setupFileHook(rootOpts.dir)
defer cleanup()

config, err := clientcmd.BuildConfigFromFlags("", filepath.Join(rootOpts.dir, "auth", "kubeconfig"))
if err != nil {
logrus.Fatal(errors.Wrap(err, "loading kubeconfig"))
}

err = waitForBootstrapComplete(ctx, config, rootOpts.dir)
if err != nil {
logrus.Fatal(err)
}

logrus.Info("It is now safe to remove the bootstrap resources")
},
}
}

func newWaitForClusterReadyCmd() *cobra.Command {
return &cobra.Command{
Use: "cluster-ready",
Short: "Wait until the cluster is ready",
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
ctx := context.Background()

cleanup := setupFileHook(rootOpts.dir)
defer cleanup()

config, err := clientcmd.BuildConfigFromFlags("", filepath.Join(rootOpts.dir, "auth", "kubeconfig"))
if err != nil {
logrus.Fatal(errors.Wrap(err, "loading kubeconfig"))
}

err = waitForClusterReady(ctx, config, rootOpts.dir)
if err != nil {
logrus.Fatal(err)
}
},
}
}
4 changes: 2 additions & 2 deletions docs/user/aws/install_upi.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ and load balancer configuration.
## Monitor for `bootstrap-complete` and Initialization

```console
$ bin/openshift-install user-provided-infrastructure bootstrap-complete
$ bin/openshift-install wait-for bootstrap-complete
INFO Waiting up to 30m0s for the Kubernetes API at https://api.test.example.com:6443...
INFO API v1.12.4+c53f462 up
INFO Waiting up to 30m0s for the bootstrap-complete event...
Expand Down Expand Up @@ -248,7 +248,7 @@ TODO: Identify changes needed to Router or Ingress for DNS `*.apps` registration
## Monitor for Cluster Completion

```console
$ bin/openshift-install user-provided-infrastructure finish
$ bin/openshift-install wait-for cluster-ready
INFO Waiting up to 30m0s for the cluster to initialize...
```

Expand Down
8 changes: 4 additions & 4 deletions docs/user/metal/install_upi.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,21 @@ TODO RHEL CoreOS does not have assets for bare-metal.

### Monitor for bootstrap-complete

The administrators can use the `upi bootstrap-complete` target of the OpenShift Installer to monitor cluster bootstrapping. The command succeeds when it notices `bootstrap-complete` event from Kubernetes APIServer. This event is generated by the bootstrap machine after the Kubernetes APIServer has been bootstrapped on the control plane machines. For example,
The administrators can use the `wait-for bootstrap-complete` target of the OpenShift Installer to monitor cluster bootstrapping. The command succeeds when it notices `bootstrap-complete` event from Kubernetes APIServer. This event is generated by the bootstrap machine after the Kubernetes APIServer has been bootstrapped on the control plane machines. For example,

```console
$ openshift-install --dir test-bare-metal upi bootstrap-complete
$ openshift-install --dir test-bare-metal wait-for bootstrap-complete
INFO Waiting up to 30m0s for the Kubernetes API at https://api.test.example.com:6443...
INFO API v1.12.4+c53f462 up
INFO Waiting up to 30m0s for the bootstrap-complete event...
```

## Monitor for cluster completion

The administrators can use the `upi finish` target of the OpenShift Installer to monitor cluster completion. The command succeeds when it notices that Cluster Version Operator has completed rolling out the OpenShift cluster from Kubernetes APIServer.
The administrators can use the `wait-for cluster-ready` target of the OpenShift Installer to monitor cluster completion. The command succeeds when it notices that Cluster Version Operator has completed rolling out the OpenShift cluster from Kubernetes APIServer.

```console
$ openshift-install upi finish
$ openshift-install wait-for cluster-ready
INFO Waiting up to 30m0s for the cluster to initialize...
```

Expand Down