This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds consul and etcd save and consul restore
Signed-off-by: JoshVanL <vleeuwenjoshua@gmail.com>
- Loading branch information
Showing
30 changed files
with
1,485 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright Jetstack Ltd. See LICENSE for details. | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var clusterSnapshotCmd = &cobra.Command{ | ||
Use: "snapshot", | ||
Short: "Manage snapshots of remote consul and etcd clusters", | ||
} | ||
|
||
func init() { | ||
clusterCmd.AddCommand(clusterSnapshotCmd) | ||
} |
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,15 @@ | ||
// Copyright Jetstack Ltd. See LICENSE for details. | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var clusterSnapshotConsulCmd = &cobra.Command{ | ||
Use: "consul", | ||
Short: "Manage snapshots on remote consul clusters", | ||
} | ||
|
||
func init() { | ||
clusterSnapshotCmd.AddCommand(clusterSnapshotConsulCmd) | ||
} |
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,32 @@ | ||
// Copyright Jetstack Ltd. See LICENSE for details. | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/jetstack/tarmak/pkg/tarmak" | ||
"github.com/jetstack/tarmak/pkg/tarmak/snapshot/consul" | ||
) | ||
|
||
var clusterSnapshotConsulRestoreCmd = &cobra.Command{ | ||
Use: "restore [source path]", | ||
Short: "restore consul cluster with source snapshot", | ||
PreRunE: func(cmd *cobra.Command, args []string) error { | ||
if len(args) != 1 { | ||
return fmt.Errorf("expecting single source path, got=%d", len(args)) | ||
} | ||
|
||
return nil | ||
}, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
t := tarmak.New(globalFlags) | ||
s := consul.New(t, args[0]) | ||
t.CancellationContext().WaitOrCancel(t.NewCmdSnapshot(cmd.Flags(), args, s).Restore) | ||
}, | ||
} | ||
|
||
func init() { | ||
clusterSnapshotConsulCmd.AddCommand(clusterSnapshotConsulRestoreCmd) | ||
} |
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,32 @@ | ||
// Copyright Jetstack Ltd. See LICENSE for details. | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/jetstack/tarmak/pkg/tarmak" | ||
"github.com/jetstack/tarmak/pkg/tarmak/snapshot/consul" | ||
) | ||
|
||
var clusterSnapshotConsulSaveCmd = &cobra.Command{ | ||
Use: "save [target path]", | ||
Short: "save consul cluster snapshot to target path", | ||
PreRunE: func(cmd *cobra.Command, args []string) error { | ||
if len(args) != 1 { | ||
return fmt.Errorf("expecting single target path, got=%d", len(args)) | ||
} | ||
|
||
return nil | ||
}, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
t := tarmak.New(globalFlags) | ||
s := consul.New(t, args[0]) | ||
t.CancellationContext().WaitOrCancel(t.NewCmdSnapshot(cmd.Flags(), args, s).Save) | ||
}, | ||
} | ||
|
||
func init() { | ||
clusterSnapshotConsulCmd.AddCommand(clusterSnapshotConsulSaveCmd) | ||
} |
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,15 @@ | ||
// Copyright Jetstack Ltd. See LICENSE for details. | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var clusterSnapshotEtcdCmd = &cobra.Command{ | ||
Use: "etcd", | ||
Short: "Manage snapshots on remote etcd clusters", | ||
} | ||
|
||
func init() { | ||
clusterSnapshotCmd.AddCommand(clusterSnapshotEtcdCmd) | ||
} |
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,42 @@ | ||
// Copyright Jetstack Ltd. See LICENSE for details. | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/jetstack/tarmak/pkg/tarmak" | ||
"github.com/jetstack/tarmak/pkg/tarmak/snapshot/etcd" | ||
"github.com/jetstack/tarmak/pkg/tarmak/utils/consts" | ||
) | ||
|
||
var clusterSnapshotEtcdRestoreCmd = &cobra.Command{ | ||
Use: "restore", | ||
Short: "restore etcd cluster with source snapshots", | ||
PreRunE: func(cmd *cobra.Command, args []string) error { | ||
if !cmd.Flags().Changed(consts.RestoreK8sMainFlagName) && | ||
!cmd.Flags().Changed(consts.RestoreK8sEventsFlagName) && | ||
!cmd.Flags().Changed(consts.RestoreOverlayFlagName) { | ||
|
||
return fmt.Errorf("expecting at least one set flag of [%s %s %s]", | ||
consts.RestoreK8sMainFlagName, | ||
consts.RestoreK8sEventsFlagName, | ||
consts.RestoreOverlayFlagName, | ||
) | ||
} | ||
return nil | ||
}, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
t := tarmak.New(globalFlags) | ||
s := etcd.New(t, "") | ||
t.CancellationContext().WaitOrCancel(t.NewCmdSnapshot(cmd.Flags(), args, s).Restore) | ||
}, | ||
} | ||
|
||
func init() { | ||
clusterSnapshotEtcdRestoreFlags( | ||
clusterSnapshotEtcdRestoreCmd.PersistentFlags(), | ||
) | ||
clusterSnapshotEtcdCmd.AddCommand(clusterSnapshotEtcdRestoreCmd) | ||
} |
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,26 @@ | ||
// Copyright Jetstack Ltd. See LICENSE for details. | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/jetstack/tarmak/pkg/tarmak" | ||
"github.com/jetstack/tarmak/pkg/tarmak/snapshot/etcd" | ||
) | ||
|
||
var clusterSnapshotEtcdSaveCmd = &cobra.Command{ | ||
Use: "save [target path prefix]", | ||
Short: "save etcd snapshot to target path prefix, i.e 'backup-'", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
if len(args) == 0 { | ||
args = []string{""} | ||
} | ||
t := tarmak.New(globalFlags) | ||
s := etcd.New(t, args[0]) | ||
t.CancellationContext().WaitOrCancel(t.NewCmdSnapshot(cmd.Flags(), args, s).Save) | ||
}, | ||
} | ||
|
||
func init() { | ||
clusterSnapshotEtcdCmd.AddCommand(clusterSnapshotEtcdSaveCmd) | ||
} |
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 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,40 @@ | ||
.. _tarmak_clusters_snapshot: | ||
|
||
tarmak clusters snapshot | ||
------------------------ | ||
|
||
Manage snapshots of remote consul and etcd clusters | ||
|
||
Synopsis | ||
~~~~~~~~ | ||
|
||
|
||
Manage snapshots of remote consul and etcd clusters | ||
|
||
Options | ||
~~~~~~~ | ||
|
||
:: | ||
|
||
-h, --help help for snapshot | ||
|
||
Options inherited from parent commands | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
:: | ||
|
||
-c, --config-directory string config directory for tarmak's configuration (default "~/.tarmak") | ||
--current-cluster string override the current cluster set in the config | ||
--ignore-missing-public-key-tags ssh_known_hosts ignore missing public key tags on instances, by falling back to populating ssh_known_hosts with the first connection (default true) | ||
--keep-containers do not clean-up terraform/packer containers after running them | ||
--public-api-endpoint Override kubeconfig to point to cluster's public API endpoint | ||
-v, --verbose enable verbose logging | ||
--wing-dev-mode use a bundled wing version rather than a tagged release from GitHub | ||
|
||
SEE ALSO | ||
~~~~~~~~ | ||
|
||
* `tarmak clusters <tarmak_clusters.html>`_ - Operations on clusters | ||
* `tarmak clusters snapshot consul <tarmak_clusters_snapshot_consul.html>`_ - Manage snapshots on remote consul clusters | ||
* `tarmak clusters snapshot etcd <tarmak_clusters_snapshot_etcd.html>`_ - Manage snapshots on remote etcd clusters | ||
|
40 changes: 40 additions & 0 deletions
40
docs/generated/cmd/tarmak/tarmak_clusters_snapshot_consul.rst
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,40 @@ | ||
.. _tarmak_clusters_snapshot_consul: | ||
|
||
tarmak clusters snapshot consul | ||
------------------------------- | ||
|
||
Manage snapshots on remote consul clusters | ||
|
||
Synopsis | ||
~~~~~~~~ | ||
|
||
|
||
Manage snapshots on remote consul clusters | ||
|
||
Options | ||
~~~~~~~ | ||
|
||
:: | ||
|
||
-h, --help help for consul | ||
|
||
Options inherited from parent commands | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
:: | ||
|
||
-c, --config-directory string config directory for tarmak's configuration (default "~/.tarmak") | ||
--current-cluster string override the current cluster set in the config | ||
--ignore-missing-public-key-tags ssh_known_hosts ignore missing public key tags on instances, by falling back to populating ssh_known_hosts with the first connection (default true) | ||
--keep-containers do not clean-up terraform/packer containers after running them | ||
--public-api-endpoint Override kubeconfig to point to cluster's public API endpoint | ||
-v, --verbose enable verbose logging | ||
--wing-dev-mode use a bundled wing version rather than a tagged release from GitHub | ||
|
||
SEE ALSO | ||
~~~~~~~~ | ||
|
||
* `tarmak clusters snapshot <tarmak_clusters_snapshot.html>`_ - Manage snapshots of remote consul and etcd clusters | ||
* `tarmak clusters snapshot consul restore <tarmak_clusters_snapshot_consul_restore.html>`_ - restore consul cluster with source snapshot | ||
* `tarmak clusters snapshot consul save <tarmak_clusters_snapshot_consul_save.html>`_ - save consul cluster snapshot to target path | ||
|
42 changes: 42 additions & 0 deletions
42
docs/generated/cmd/tarmak/tarmak_clusters_snapshot_consul_restore.rst
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,42 @@ | ||
.. _tarmak_clusters_snapshot_consul_restore: | ||
|
||
tarmak clusters snapshot consul restore | ||
--------------------------------------- | ||
|
||
restore consul cluster with source snapshot | ||
|
||
Synopsis | ||
~~~~~~~~ | ||
|
||
|
||
restore consul cluster with source snapshot | ||
|
||
:: | ||
|
||
tarmak clusters snapshot consul restore [source path] [flags] | ||
|
||
Options | ||
~~~~~~~ | ||
|
||
:: | ||
|
||
-h, --help help for restore | ||
|
||
Options inherited from parent commands | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
:: | ||
|
||
-c, --config-directory string config directory for tarmak's configuration (default "~/.tarmak") | ||
--current-cluster string override the current cluster set in the config | ||
--ignore-missing-public-key-tags ssh_known_hosts ignore missing public key tags on instances, by falling back to populating ssh_known_hosts with the first connection (default true) | ||
--keep-containers do not clean-up terraform/packer containers after running them | ||
--public-api-endpoint Override kubeconfig to point to cluster's public API endpoint | ||
-v, --verbose enable verbose logging | ||
--wing-dev-mode use a bundled wing version rather than a tagged release from GitHub | ||
|
||
SEE ALSO | ||
~~~~~~~~ | ||
|
||
* `tarmak clusters snapshot consul <tarmak_clusters_snapshot_consul.html>`_ - Manage snapshots on remote consul clusters | ||
|
Oops, something went wrong.