Skip to content

Commit e7edc6d

Browse files
Track include and TLS certs with Reloader (#164)
* Adding logic to find certs/included files in NATS config for file watcher Deps updates * Add test for filewatcher logic * Fix race in test * Renaming gnatsd files to nats. Adding config file extension check * Handle quoted includes * Update regex to handle quotes and variables * Fix comments
1 parent c6ca1ed commit e7edc6d

File tree

6 files changed

+621
-245
lines changed

6 files changed

+621
-245
lines changed

cmd/nats-server-config-reloader/main.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ func main() {
4242

4343
// Help and version
4444
var (
45-
showHelp bool
46-
showVersion bool
47-
fileSet StringSet
45+
showHelp bool
46+
showVersion bool
47+
fileSet StringSet
4848
customSignal int
4949
)
5050

@@ -54,8 +54,8 @@ func main() {
5454
fs.BoolVar(&showVersion, "v", false, "Show version")
5555
fs.BoolVar(&showVersion, "version", false, "Show version")
5656

57-
fs.StringVar(&nconfig.PidFile, "P", "/var/run/nats/gnatsd.pid", "NATS Server Pid File")
58-
fs.StringVar(&nconfig.PidFile, "pid", "/var/run/nats/gnatsd.pid", "NATS Server Pid File")
57+
fs.StringVar(&nconfig.PidFile, "P", "/var/run/nats/nats.pid", "NATS Server Pid File")
58+
fs.StringVar(&nconfig.PidFile, "pid", "/var/run/nats/nats.pid", "NATS Server Pid File")
5959
fs.Var(&fileSet, "c", "NATS Server Config File (may be repeated to specify more than one)")
6060
fs.Var(&fileSet, "config", "NATS Server Config File (may be repeated to specify more than one)")
6161
fs.IntVar(&nconfig.MaxRetries, "max-retries", 30, "Max attempts to trigger reload")
@@ -64,9 +64,9 @@ func main() {
6464

6565
fs.Parse(os.Args[1:])
6666

67-
nconfig.ConfigFiles = fileSet
67+
nconfig.WatchedFiles = fileSet
6868
if len(fileSet) == 0 {
69-
nconfig.ConfigFiles = []string{"/etc/nats-config/gnatsd.conf"}
69+
nconfig.WatchedFiles = []string{"/etc/nats-config/nats.conf"}
7070
}
7171
nconfig.Signal = syscall.Signal(customSignal)
7272

go.mod

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,72 @@
11
module github.com/nats-io/nack
22

3-
go 1.20
3+
go 1.21
44

55
require (
6-
github.com/fsnotify/fsnotify v1.6.0
6+
github.com/fsnotify/fsnotify v1.7.0
77
github.com/nats-io/jsm.go v0.1.0
8-
github.com/nats-io/nats-server/v2 v2.10.0
9-
github.com/nats-io/nats.go v1.30.0
8+
github.com/nats-io/nats-server/v2 v2.10.9
9+
github.com/nats-io/nats.go v1.32.0
1010
github.com/sirupsen/logrus v1.9.3
1111
github.com/stretchr/testify v1.8.4
12-
golang.org/x/sync v0.1.0
13-
k8s.io/api v0.28.2
14-
k8s.io/apimachinery v0.28.2
15-
k8s.io/client-go v0.28.2
16-
k8s.io/code-generator v0.28.2
17-
k8s.io/klog/v2 v2.100.1
18-
sigs.k8s.io/structured-merge-diff/v4 v4.3.0
12+
golang.org/x/sync v0.6.0
13+
k8s.io/api v0.29.1
14+
k8s.io/apimachinery v0.29.1
15+
k8s.io/client-go v0.29.1
16+
k8s.io/code-generator v0.29.1
17+
k8s.io/klog/v2 v2.120.1
18+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1
1919
)
2020

2121
require (
2222
github.com/antonmedv/expr v1.15.2 // indirect
2323
github.com/davecgh/go-spew v1.1.1 // indirect
2424
github.com/dustin/go-humanize v1.0.1 // indirect
25-
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
25+
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
2626
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
27-
github.com/go-logr/logr v1.2.4 // indirect
27+
github.com/go-logr/logr v1.4.1 // indirect
2828
github.com/go-openapi/jsonpointer v0.19.6 // indirect
2929
github.com/go-openapi/jsonreference v0.20.2 // indirect
3030
github.com/go-openapi/swag v0.22.3 // indirect
3131
github.com/gogo/protobuf v1.3.2 // indirect
3232
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3333
github.com/golang/protobuf v1.5.3 // indirect
3434
github.com/google/gnostic-models v0.6.8 // indirect
35-
github.com/google/go-cmp v0.5.9 // indirect
35+
github.com/google/go-cmp v0.6.0 // indirect
3636
github.com/google/gofuzz v1.2.0 // indirect
3737
github.com/google/uuid v1.3.0 // indirect
3838
github.com/imdario/mergo v0.3.6 // indirect
3939
github.com/josharian/intern v1.0.0 // indirect
4040
github.com/json-iterator/go v1.1.12 // indirect
41-
github.com/klauspost/compress v1.17.0 // indirect
41+
github.com/klauspost/compress v1.17.4 // indirect
4242
github.com/mailru/easyjson v0.7.7 // indirect
4343
github.com/minio/highwayhash v1.0.2 // indirect
4444
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4545
github.com/modern-go/reflect2 v1.0.2 // indirect
4646
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
47-
github.com/nats-io/jwt/v2 v2.5.2 // indirect
48-
github.com/nats-io/nkeys v0.4.5 // indirect
47+
github.com/nats-io/jwt/v2 v2.5.3 // indirect
48+
github.com/nats-io/nkeys v0.4.7 // indirect
4949
github.com/nats-io/nuid v1.0.1 // indirect
5050
github.com/pkg/errors v0.9.1 // indirect
5151
github.com/pmezard/go-difflib v1.0.0 // indirect
5252
github.com/spf13/pflag v1.0.5 // indirect
53-
golang.org/x/crypto v0.13.0 // indirect
54-
golang.org/x/mod v0.10.0 // indirect
55-
golang.org/x/net v0.15.0 // indirect
56-
golang.org/x/oauth2 v0.8.0 // indirect
57-
golang.org/x/sys v0.12.0 // indirect
58-
golang.org/x/term v0.12.0 // indirect
59-
golang.org/x/text v0.13.0 // indirect
60-
golang.org/x/time v0.3.0 // indirect
61-
golang.org/x/tools v0.8.0 // indirect
53+
golang.org/x/crypto v0.18.0 // indirect
54+
golang.org/x/mod v0.14.0 // indirect
55+
golang.org/x/net v0.19.0 // indirect
56+
golang.org/x/oauth2 v0.10.0 // indirect
57+
golang.org/x/sys v0.16.0 // indirect
58+
golang.org/x/term v0.16.0 // indirect
59+
golang.org/x/text v0.14.0 // indirect
60+
golang.org/x/time v0.5.0 // indirect
61+
golang.org/x/tools v0.16.1 // indirect
6262
google.golang.org/appengine v1.6.7 // indirect
63-
google.golang.org/protobuf v1.30.0 // indirect
63+
google.golang.org/protobuf v1.31.0 // indirect
6464
gopkg.in/inf.v0 v0.9.1 // indirect
6565
gopkg.in/yaml.v2 v2.4.0 // indirect
6666
gopkg.in/yaml.v3 v3.0.1 // indirect
67-
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d // indirect
68-
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
69-
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
67+
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect
68+
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
69+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
7070
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
7171
sigs.k8s.io/yaml v1.3.0 // indirect
7272
)

0 commit comments

Comments
 (0)