Skip to content

Commit

Permalink
rename ark daemonset to ark restic server
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Kriss <[email protected]>
  • Loading branch information
skriss committed Jun 8, 2018
1 parent 0396ca1 commit 0c5256d
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 26 deletions.
1 change: 0 additions & 1 deletion docs/cli-reference/ark.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/cli-reference/ark_restic.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
@@ -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)
```

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

5 changes: 3 additions & 2 deletions examples/aws/20-restic-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ spec:
- name: ark
image: gcr.io/heptio-images/ark:latest
command:
- /ark
- /ark
args:
- daemonset
- restic
- server
volumeMounts:
- name: cloud-credentials
mountPath: /credentials
Expand Down
3 changes: 2 additions & 1 deletion examples/azure/20-restic-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ spec:
command:
- /ark
args:
- daemonset
- restic
- server
volumeMounts:
- name: host-pods
mountPath: /host_pods
Expand Down
3 changes: 2 additions & 1 deletion examples/gcp/20-restic-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ spec:
command:
- /ark
args:
- daemonset
- restic
- server
volumeMounts:
- name: cloud-credentials
mountPath: /credentials
Expand Down
3 changes: 2 additions & 1 deletion examples/minio/30-restic-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ spec:
command:
- /ark
args:
- daemonset
- restic
- server
volumeMounts:
- name: cloud-credentials
mountPath: /credentials
Expand Down
2 changes: 0 additions & 2 deletions pkg/cmd/ark/ark.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
)

Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/cli/restic/restic.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func NewCommand(f client.Factory) *cobra.Command {

c.AddCommand(
NewInitRepositoryCommand(f),
NewServerCommand(f),
)

return c
Expand Down
24 changes: 12 additions & 12 deletions pkg/cmd/daemonset/daemonset.go → pkg/cmd/cli/restic/server.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package daemonset
package restic

import (
"context"
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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),
Expand All @@ -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")
Expand Down

0 comments on commit 0c5256d

Please sign in to comment.