Skip to content

Commit 3b1d6bf

Browse files
committed
Expose resync-period as flag
1 parent 35d8dc6 commit 3b1d6bf

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

run.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmds
33
import (
44
"fmt"
55
"net/http"
6+
"time"
67

78
stringz "github.com/appscode/go/strings"
89
"github.com/appscode/log"
@@ -30,8 +31,9 @@ func NewCmdRun(version string) *cobra.Command {
3031
var (
3132
masterURL string
3233
kubeconfigPath string
33-
tag string = stringz.Val(version, "canary")
34-
address string = ":56790"
34+
tag string = stringz.Val(version, "canary")
35+
address string = ":56790"
36+
resyncPeriod time.Duration = 5 * time.Minute
3537
)
3638

3739
cmd := &cobra.Command{
@@ -51,7 +53,7 @@ func NewCmdRun(version string) *cobra.Command {
5153
stashClient = scs.NewForConfigOrDie(config)
5254
crdClient := apiextensionsclient.NewForConfigOrDie(config)
5355

54-
ctrl := controller.New(kubeClient, crdClient, stashClient, tag)
56+
ctrl := controller.New(kubeClient, crdClient, stashClient, tag, resyncPeriod)
5557
err = ctrl.Setup()
5658
if err != nil {
5759
log.Fatalln(err)
@@ -80,6 +82,7 @@ func NewCmdRun(version string) *cobra.Command {
8082
cmd.Flags().StringVar(&kubeconfigPath, "kubeconfig", kubeconfigPath, "Path to kubeconfig file with authorization information (the master location is set by the master flag).")
8183
cmd.Flags().StringVar(&address, "address", address, "Address to listen on for web interface and telemetry.")
8284
cmd.Flags().StringVar(&scratchDir, "scratch-dir", scratchDir, "Directory used to store temporary files. Use an `emptyDir` in Kubernetes.")
85+
cmd.Flags().DurationVar(&resyncPeriod, "resync-period", resyncPeriod, "If non-zero, will re-list this often. Otherwise, re-list will be delayed aslong as possible (until the upstream source closes the watch or times out.")
8386

8487
return cmd
8588
}

schedule.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"io/ioutil"
55
"os"
66
"strings"
7+
"time"
78

89
"github.com/appscode/log"
910
rcs "github.com/appscode/stash/client/clientset"
@@ -27,6 +28,7 @@ func NewCmdSchedule() *cobra.Command {
2728
ScratchDir: "/tmp",
2829
PushgatewayURL: "http://stash-operator.kube-system.svc:56789",
2930
PodLabelsPath: "/etc/stash/labels",
31+
ResyncPeriod: 5 * time.Minute,
3032
}
3133
)
3234

@@ -130,6 +132,7 @@ func NewCmdSchedule() *cobra.Command {
130132
cmd.Flags().StringVar(&opt.ResticName, "restic-name", opt.ResticName, "Name of the Restic used as configuration.")
131133
cmd.Flags().StringVar(&opt.ScratchDir, "scratch-dir", opt.ScratchDir, "Directory used to store temporary files. Use an `emptyDir` in Kubernetes.")
132134
cmd.Flags().StringVar(&opt.PushgatewayURL, "pushgateway-url", opt.PushgatewayURL, "URL of Prometheus pushgateway used to cache backup metrics")
135+
cmd.Flags().DurationVar(&opt.ResyncPeriod, "resync-period", opt.ResyncPeriod, "If non-zero, will re-list this often. Otherwise, re-list will be delayed aslong as possible (until the upstream source closes the watch or times out.")
133136

134137
return cmd
135138
}

0 commit comments

Comments
 (0)