Skip to content

Commit dbdcbee

Browse files
Merge pull request #13 from utilitywarehouse/disable-resync-period
Default watchers resyncPeriod to 0 to disable it.
2 parents d818e16 + e436108 commit dbdcbee

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ Is a list of remote clusters that may define the following:
6262

6363
- wgListenPort: WG listen port.
6464

65+
- resyncPeriod: Kubernetes watcher resync period. It should yield update events
66+
for everything that is stored in the cache. Default `0` value disables it.
6567
## Example
6668
```
6769
{

config.go

-8
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ func (d *Duration) UnmarshalJSON(b []byte) error {
4141
}
4242
}
4343

44-
var (
45-
defaultWatcherResyncPeriod = Duration{time.Hour}
46-
zeroDuration = Duration{0}
47-
)
48-
4944
type localClusterConfig struct {
5045
Name string `json:"name"`
5146
KubeConfigPath string `json:"kubeConfigPath"`
@@ -97,9 +92,6 @@ func parseConfig(rawConfig []byte) (*Config, error) {
9792
if r.WGListenPort == 0 {
9893
r.WGListenPort = defaultWGListenPort
9994
}
100-
if r.ResyncPeriod == zeroDuration {
101-
r.ResyncPeriod = defaultWatcherResyncPeriod
102-
}
10395
}
10496
return conf, nil
10597
}

config_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,6 @@ func TestConfig(t *testing.T) {
109109
assert.Equal(t, "10.0.1.0/16", config.Remotes[1].PodSubnet)
110110
assert.Equal(t, defaultWGDeviceMTU, config.Remotes[1].WGDeviceMTU)
111111
assert.Equal(t, defaultWGListenPort, config.Remotes[1].WGListenPort)
112-
assert.Equal(t, defaultWatcherResyncPeriod, config.Remotes[1].ResyncPeriod)
112+
assert.Equal(t, Duration{0}, config.Remotes[1].ResyncPeriod)
113113

114114
}

0 commit comments

Comments
 (0)