-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/openshift-install/waitfor: Rename from user-provided-infrastructure
There is no hard line between installer- and user-provided infrastructure. Rename these commands to focus on what they'll do instead of the work-flow into which we expect them to fit. We're still working out how we can drop the router-CA injection to avoid 'wait-for cluster-ready' surprising users my editing their on-disk kubeconfig [1]. But that's mitigated somewhat by the fact that addRouterCAToClusterCA is idempotent, because AppendCertsFromPEM wraps AddCert [2] and AddCert checks to avoid duplicate certificates [3]. [1]: #1541 [2]: https://github.com/golang/go/blob/go1.12/src/crypto/x509/cert_pool.go#L144 [3]: https://github.com/golang/go/blob/go1.12/src/crypto/x509/cert_pool.go#L106-L109
- Loading branch information
Showing
5 changed files
with
84 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters