Merge pull request #535 from skriss/rename-restic-daemonset

rename ark daemonset to ark restic server
This commit is contained in:
Andy Goldstein
2018-06-11 12:28:05 -04:00
committed by GitHub
10 changed files with 28 additions and 25 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -42,7 +42,8 @@ spec:
command:
- /ark
args:
- daemonset
- restic
- server
volumeMounts:
- name: cloud-credentials
mountPath: /credentials

View File

@@ -39,7 +39,8 @@ spec:
command:
- /ark
args:
- daemonset
- restic
- server
volumeMounts:
- name: host-pods
mountPath: /host_pods

View File

@@ -42,7 +42,8 @@ spec:
command:
- /ark
args:
- daemonset
- restic
- server
volumeMounts:
- name: cloud-credentials
mountPath: /credentials

View File

@@ -42,7 +42,8 @@ spec:
command:
- /ark
args:
- daemonset
- restic
- server
volumeMounts:
- name: cloud-credentials
mountPath: /credentials

View File

@@ -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),
)

View File

@@ -31,6 +31,7 @@ func NewCommand(f client.Factory) *cobra.Command {
c.AddCommand(
NewInitRepositoryCommand(f),
NewServerCommand(f),
)
return c

View File

@@ -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")