Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 8124547

Browse files
authored
Change bootkube recover flag to --recovery-dir. (#589)
Field ops reports that people find the --asset-dir flag confusing; they think that means you need to pass in the same --asset-dir that was used to create the cluster.
1 parent 88590b0 commit 8124547

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,19 @@ bootkube recover --help
6969
Recover from an external running etcd cluster:
7070

7171
```
72-
bootkube recover --asset-dir=recovered --etcd-servers=http://127.0.0.1:2379 --kubeconfig=/etc/kubernetes/kubeconfig
72+
bootkube recover --recovery-dir=recovered --etcd-servers=http://127.0.0.1:2379 --kubeconfig=/etc/kubernetes/kubeconfig
7373
```
7474

7575
Recover from a running apiserver (i.e. if the scheduler pods are all down):
7676

7777
```
78-
bootkube recover --asset-dir=recovered --kubeconfig=/etc/kubernetes/kubeconfig
78+
bootkube recover --recovery-dir=recovered --kubeconfig=/etc/kubernetes/kubeconfig
7979
```
8080

8181
Recover from an etcd backup when self hosted etcd is enabled:
8282

8383
```
84-
bootkube recover --asset-dir=recovered --etcd-backup-file=backup --kubeconfig=/etc/kubernetes/kubeconfig
84+
bootkube recover --recovery-dir=recovered --etcd-backup-file=backup --kubeconfig=/etc/kubernetes/kubeconfig
8585
```
8686

8787
For a complete recovery example please see the [hack/multi-node/bootkube-test-recovery](hack/multi-node/bootkube-test-recovery) and the [hack/multi-node/bootkube-test-recovery-self-hosted-etcd](hack/multi-node/bootkube-test-recovery-self-hosted-etcd) scripts.

cmd/bootkube/recover.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ var (
2323
cmdRecover = &cobra.Command{
2424
Use: "recover",
2525
Short: "Recover a self-hosted control plane",
26-
Long: "This command reads control plane manifests from a running apiserver or etcd and writes them to asset-dir. Users can then use `bootkube start` pointed at this asset-dir to re-the a self-hosted cluster. Please see the project README for more details and examples.",
26+
Long: "This command reads control plane manifests from a running apiserver or etcd and writes them to recovery-dir. Users can then use `bootkube start` pointed at this recovery-dir to re-the a self-hosted cluster. Please see the project README for more details and examples.",
2727
PreRunE: validateRecoverOpts,
2828
RunE: runCmdRecover,
2929
SilenceUsage: true,
3030
}
3131

3232
recoverOpts struct {
33-
assetDir string
33+
recoveryDir string
3434
etcdCAPath string
3535
etcdCertificatePath string
3636
etcdPrivateKeyPath string
@@ -44,7 +44,7 @@ var (
4444

4545
func init() {
4646
cmdRoot.AddCommand(cmdRecover)
47-
cmdRecover.Flags().StringVar(&recoverOpts.assetDir, "asset-dir", "", "Output path for writing recovered cluster assets.")
47+
cmdRecover.Flags().StringVar(&recoverOpts.recoveryDir, "recovery-dir", "", "Output path for writing recovered cluster assets.")
4848
cmdRecover.Flags().StringVar(&recoverOpts.etcdCAPath, "etcd-ca-path", "", "Path to an existing PEM encoded CA that will be used for TLS-enabled communication between the apiserver and etcd. Must be used in conjunction with --etcd-certificate-path and --etcd-private-key-path, and must have etcd configured to use TLS with matching secrets.")
4949
cmdRecover.Flags().StringVar(&recoverOpts.etcdCertificatePath, "etcd-certificate-path", "", "Path to an existing certificate that will be used for TLS-enabled communication between the apiserver and etcd. Must be used in conjunction with --etcd-ca-path and --etcd-private-key-path, and must have etcd configured to use TLS with matching secrets.")
5050
cmdRecover.Flags().StringVar(&recoverOpts.etcdPrivateKeyPath, "etcd-private-key-path", "", "Path to an existing private key that will be used for TLS-enabled communication between the apiserver and etcd. Must be used in conjunction with --etcd-ca-path and --etcd-certificate-path, and must have etcd configured to use TLS with matching secrets.")
@@ -111,12 +111,12 @@ func runCmdRecover(cmd *cobra.Command, args []string) error {
111111
if err != nil {
112112
return err
113113
}
114-
return as.WriteFiles(recoverOpts.assetDir)
114+
return as.WriteFiles(recoverOpts.recoveryDir)
115115
}
116116

117117
func validateRecoverOpts(cmd *cobra.Command, args []string) error {
118-
if recoverOpts.assetDir == "" {
119-
return errors.New("missing required flag: --asset-dir")
118+
if recoverOpts.recoveryDir == "" {
119+
return errors.New("missing required flag: --recovery-dir")
120120
}
121121
if (recoverOpts.etcdCAPath != "" || recoverOpts.etcdCertificatePath != "" || recoverOpts.etcdPrivateKeyPath != "") && (recoverOpts.etcdCAPath == "" || recoverOpts.etcdCertificatePath == "" || recoverOpts.etcdPrivateKeyPath == "") {
122122
return errors.New("you must specify either all or none of --etcd-ca-path, --etcd-certificate-path, and --etcd-private-key-path")

hack/multi-node/bootkube-test-recovery

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ echo
3535

3636
scp -q -F ssh_config ../../_output/bin/linux/bootkube cluster/auth/kubeconfig cluster/tls/etcd-* core@$HOST:/home/core
3737
ssh -q -F ssh_config core@$HOST "GLOG_v=${GLOG_v} /home/core/bootkube recover \
38-
--asset-dir=/home/core/recovered \
38+
--recovery-dir=/home/core/recovered \
3939
--etcd-ca-path=/home/core/etcd-ca.crt \
4040
--etcd-certificate-path=/home/core/etcd-client.crt \
4141
--etcd-private-key-path=/home/core/etcd-client.key \

hack/multi-node/bootkube-test-recovery-self-hosted-etcd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ echo
4141

4242
scp -q -F ssh_config ../../_output/bin/linux/bootkube cluster/auth/kubeconfig cluster/etcdbackup core@$HOST:/home/core
4343
ssh -q -F ssh_config core@$HOST "sudo GLOG_v=${GLOG_v} /home/core/bootkube recover \
44-
--asset-dir=/home/core/recovered \
44+
--recovery-dir=/home/core/recovered \
4545
--etcd-backup-file=/home/core/etcdbackup \
4646
--kubeconfig=/home/core/kubeconfig 2>> /home/core/recovery.log"
4747

@@ -53,4 +53,4 @@ ssh -q -F ssh_config core@$HOST "sudo GLOG_v=${GLOG_v} /home/core/bootkube start
5353

5454
echo
5555
echo "The cluster should now be recovered. You should be able to access the cluster again using:"
56-
echo "kubectl --kubeconfig=cluster/auth/kubeconfig get nodes"
56+
echo "kubectl --kubeconfig=cluster/auth/kubeconfig get nodes"

0 commit comments

Comments
 (0)