From c1f4e6d92de54b7e81a13b51d265d7b344f90ff1 Mon Sep 17 00:00:00 2001 From: Steve Kriss Date: Fri, 8 Jun 2018 11:03:07 -0700 Subject: [PATCH] rename ark daemonset to ark restic server Signed-off-by: Steve Kriss --- docs/cli-reference/ark.md | 1 - docs/cli-reference/ark_restic.md | 1 + ...{ark_daemonset.md => ark_restic_server.md} | 12 +++++----- examples/aws/20-restic-daemonset.yaml | 3 ++- examples/azure/20-restic-daemonset.yaml | 3 ++- examples/gcp/20-restic-daemonset.yaml | 3 ++- examples/minio/30-restic-daemonset.yaml | 3 ++- pkg/cmd/ark/ark.go | 2 -- pkg/cmd/cli/restic/restic.go | 1 + .../daemonset.go => cli/restic/server.go} | 24 +++++++++---------- 10 files changed, 28 insertions(+), 25 deletions(-) rename docs/cli-reference/{ark_daemonset.md => ark_restic_server.md} (87%) rename pkg/cmd/{daemonset/daemonset.go => cli/restic/server.go} (87%) diff --git a/docs/cli-reference/ark.md b/docs/cli-reference/ark.md index 545846c7d..e09a97148 100644 --- a/docs/cli-reference/ark.md +++ b/docs/cli-reference/ark.md @@ -34,7 +34,6 @@ operations can also be performed as 'ark backup get' and 'ark schedule create'. * [ark client](ark_client.md) - Ark client related commands * [ark completion](ark_completion.md) - Output shell completion code for the specified shell (bash or zsh) * [ark create](ark_create.md) - Create ark resources -* [ark daemonset](ark_daemonset.md) - Run the ark daemonset * [ark delete](ark_delete.md) - Delete ark resources * [ark describe](ark_describe.md) - Describe ark resources * [ark get](ark_get.md) - Get ark resources diff --git a/docs/cli-reference/ark_restic.md b/docs/cli-reference/ark_restic.md index 7d50f7895..16bbad33c 100644 --- a/docs/cli-reference/ark_restic.md +++ b/docs/cli-reference/ark_restic.md @@ -31,4 +31,5 @@ Work with restic repositories ### SEE ALSO * [ark](ark.md) - Back up and restore Kubernetes cluster resources. * [ark restic init-repository](ark_restic_init-repository.md) - create an encryption key for a restic repository +* [ark restic server](ark_restic_server.md) - Run the ark restic server diff --git a/docs/cli-reference/ark_daemonset.md b/docs/cli-reference/ark_restic_server.md similarity index 87% rename from docs/cli-reference/ark_daemonset.md rename to docs/cli-reference/ark_restic_server.md index 5b0e1906e..eaca3b98d 100644 --- a/docs/cli-reference/ark_daemonset.md +++ b/docs/cli-reference/ark_restic_server.md @@ -1,20 +1,20 @@ -## ark daemonset +## ark restic server -Run the ark daemonset +Run the ark restic server ### Synopsis -Run the ark daemonset +Run the ark restic server ``` -ark daemonset [flags] +ark restic server [flags] ``` ### Options ``` - -h, --help help for daemonset + -h, --help help for server --log-level the level at which to log. Valid values are debug, info, warning, error, fatal, panic. (default info) ``` @@ -34,5 +34,5 @@ ark daemonset [flags] ``` ### SEE ALSO -* [ark](ark.md) - Back up and restore Kubernetes cluster resources. +* [ark restic](ark_restic.md) - Work with restic repositories diff --git a/examples/aws/20-restic-daemonset.yaml b/examples/aws/20-restic-daemonset.yaml index f3fd8ad65..d180a1bdb 100644 --- a/examples/aws/20-restic-daemonset.yaml +++ b/examples/aws/20-restic-daemonset.yaml @@ -42,7 +42,8 @@ spec: command: - /ark args: - - daemonset + - restic + - server volumeMounts: - name: cloud-credentials mountPath: /credentials diff --git a/examples/azure/20-restic-daemonset.yaml b/examples/azure/20-restic-daemonset.yaml index d766272cb..885242a91 100644 --- a/examples/azure/20-restic-daemonset.yaml +++ b/examples/azure/20-restic-daemonset.yaml @@ -39,7 +39,8 @@ spec: command: - /ark args: - - daemonset + - restic + - server volumeMounts: - name: host-pods mountPath: /host_pods diff --git a/examples/gcp/20-restic-daemonset.yaml b/examples/gcp/20-restic-daemonset.yaml index cf598fdd7..c88e803b8 100644 --- a/examples/gcp/20-restic-daemonset.yaml +++ b/examples/gcp/20-restic-daemonset.yaml @@ -42,7 +42,8 @@ spec: command: - /ark args: - - daemonset + - restic + - server volumeMounts: - name: cloud-credentials mountPath: /credentials diff --git a/examples/minio/30-restic-daemonset.yaml b/examples/minio/30-restic-daemonset.yaml index f3fd8ad65..b4275890c 100644 --- a/examples/minio/30-restic-daemonset.yaml +++ b/examples/minio/30-restic-daemonset.yaml @@ -42,7 +42,8 @@ spec: command: - /ark args: - - daemonset + - restic + - server volumeMounts: - name: cloud-credentials mountPath: /credentials diff --git a/pkg/cmd/ark/ark.go b/pkg/cmd/ark/ark.go index c1a64cf65..b80b14c55 100644 --- a/pkg/cmd/ark/ark.go +++ b/pkg/cmd/ark/ark.go @@ -33,7 +33,6 @@ import ( "github.com/heptio/ark/pkg/cmd/cli/restic" "github.com/heptio/ark/pkg/cmd/cli/restore" "github.com/heptio/ark/pkg/cmd/cli/schedule" - "github.com/heptio/ark/pkg/cmd/daemonset" "github.com/heptio/ark/pkg/cmd/server" runplugin "github.com/heptio/ark/pkg/cmd/server/plugin" "github.com/heptio/ark/pkg/cmd/version" @@ -69,7 +68,6 @@ operations can also be performed as 'ark backup get' and 'ark schedule create'.` delete.NewCommand(f), cliclient.NewCommand(), completion.NewCommand(), - daemonset.NewCommand(f), restic.NewCommand(f), ) diff --git a/pkg/cmd/cli/restic/restic.go b/pkg/cmd/cli/restic/restic.go index be494ae0e..3ab5f7e07 100644 --- a/pkg/cmd/cli/restic/restic.go +++ b/pkg/cmd/cli/restic/restic.go @@ -31,6 +31,7 @@ func NewCommand(f client.Factory) *cobra.Command { c.AddCommand( NewInitRepositoryCommand(f), + NewServerCommand(f), ) return c diff --git a/pkg/cmd/daemonset/daemonset.go b/pkg/cmd/cli/restic/server.go similarity index 87% rename from pkg/cmd/daemonset/daemonset.go rename to pkg/cmd/cli/restic/server.go index ae1f9e21e..747baeb0f 100644 --- a/pkg/cmd/daemonset/daemonset.go +++ b/pkg/cmd/cli/restic/server.go @@ -1,4 +1,4 @@ -package daemonset +package restic import ( "context" @@ -27,21 +27,21 @@ import ( "github.com/heptio/ark/pkg/util/logging" ) -func NewCommand(f client.Factory) *cobra.Command { +func NewServerCommand(f client.Factory) *cobra.Command { var logLevelFlag = logging.LogLevelFlag(logrus.InfoLevel) var command = &cobra.Command{ - Use: "daemonset", - Short: "Run the ark daemonset", - Long: "Run the ark daemonset", + Use: "server", + Short: "Run the ark restic server", + Long: "Run the ark restic server", Run: func(c *cobra.Command, args []string) { logLevel := logLevelFlag.Parse() - logrus.Infof("setting log-level to %s", strings.ToUpper(logLevel.String())) + logrus.Infof("Setting log-level to %s", strings.ToUpper(logLevel.String())) logger := logging.DefaultLogger(logLevel) - logger.Infof("Starting Ark restic daemonset %s", buildinfo.FormattedGitSHA()) + logger.Infof("Starting Ark restic server %s", buildinfo.FormattedGitSHA()) - s, err := newDaemonServer(logger, fmt.Sprintf("%s-%s", c.Parent().Name(), c.Name())) + s, err := newResticServer(logger, fmt.Sprintf("%s-%s", c.Parent().Name(), c.Name())) cmd.CheckError(err) s.run() @@ -53,7 +53,7 @@ func NewCommand(f client.Factory) *cobra.Command { return command } -type daemonServer struct { +type resticServer struct { kubeClient kubernetes.Interface arkClient clientset.Interface arkInformerFactory informers.SharedInformerFactory @@ -64,7 +64,7 @@ type daemonServer struct { cancelFunc context.CancelFunc } -func newDaemonServer(logger logrus.FieldLogger, baseName string) (*daemonServer, error) { +func newResticServer(logger logrus.FieldLogger, baseName string) (*resticServer, error) { clientConfig, err := client.Config("", "", baseName) if err != nil { return nil, err @@ -94,7 +94,7 @@ func newDaemonServer(logger logrus.FieldLogger, baseName string) (*daemonServer, ctx, cancelFunc := context.WithCancel(context.Background()) - return &daemonServer{ + return &resticServer{ kubeClient: kubeClient, arkClient: arkClient, arkInformerFactory: informers.NewFilteredSharedInformerFactory(arkClient, 0, os.Getenv("HEPTIO_ARK_NAMESPACE"), nil), @@ -106,7 +106,7 @@ func newDaemonServer(logger logrus.FieldLogger, baseName string) (*daemonServer, }, nil } -func (s *daemonServer) run() { +func (s *resticServer) run() { signals.CancelOnShutdown(s.cancelFunc, s.logger) s.logger.Info("Starting controllers")