Skip to content

Commit 9860f46

Browse files
committed
Implement hot-reloading based on config changes
Reload KSM on-the-fly when a change is detected in the configuration. Meta changes (will squash)
1 parent 5888a7e commit 9860f46

File tree

6 files changed

+245
-38
lines changed

6 files changed

+245
-38
lines changed

docs/cli-arguments.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Flags:
3939
--add_dir_header If true, adds the file directory to the header of the log messages
4040
--alsologtostderr log to standard error as well as files (no effect when -logtostderr=true)
4141
--apiserver string The URL of the apiserver to use as a master
42+
--config string Path to the kube-state-metrics options config file
4243
--custom-resource-state-config string Inline Custom Resource State Metrics config YAML (experimental)
4344
--custom-resource-state-config-file string Path to a Custom Resource State Metrics config file (experimental)
4445
--custom-resource-state-only Only provide Custom Resource State metrics (experimental)

go.mod

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ require (
44
github.com/brancz/gojsontoyaml v0.1.0
55
github.com/campoy/embedmd v1.0.0
66
github.com/dgryski/go-jump v0.0.0-20211018200510-ba001c3ffce0
7+
github.com/fsnotify/fsnotify v1.5.4
78
github.com/gobuffalo/flect v0.3.0
89
github.com/google/go-cmp v0.5.9
910
github.com/google/go-jsonnet v0.19.1
@@ -15,6 +16,7 @@ require (
1516
github.com/prometheus/exporter-toolkit v0.8.1
1617
github.com/robfig/cron/v3 v3.0.1
1718
github.com/spf13/cobra v1.6.1
19+
github.com/spf13/viper v1.13.0
1820
github.com/stretchr/testify v1.8.1
1921
golang.org/x/perf v0.0.0-20220920022801-e8d778a60d07
2022
gopkg.in/yaml.v3 v3.0.1
@@ -29,7 +31,7 @@ require (
2931
)
3032

3133
require (
32-
cloud.google.com/go v0.97.0 // indirect
34+
cloud.google.com/go/compute v1.7.0 // indirect
3335
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
3436
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
3537
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
@@ -61,23 +63,32 @@ require (
6163
github.com/google/gnostic v0.5.7-v3refs // indirect
6264
github.com/google/gofuzz v1.1.0 // indirect
6365
github.com/google/safehtml v0.0.2 // indirect
66+
github.com/hashicorp/hcl v1.0.0 // indirect
6467
github.com/imdario/mergo v0.3.6 // indirect
6568
github.com/inconshreveable/mousetrap v1.0.1 // indirect
6669
github.com/josharian/intern v1.0.0 // indirect
6770
github.com/jpillora/backoff v1.0.0 // indirect
6871
github.com/json-iterator/go v1.1.12 // indirect
72+
github.com/magiconair/properties v1.8.6 // indirect
6973
github.com/mailru/easyjson v0.7.6 // indirect
7074
github.com/mattn/go-colorable v0.1.12 // indirect
7175
github.com/mattn/go-isatty v0.0.14 // indirect
7276
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
77+
github.com/mitchellh/mapstructure v1.5.0 // indirect
7378
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
7479
github.com/modern-go/reflect2 v1.0.2 // indirect
7580
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
7681
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
82+
github.com/pelletier/go-toml v1.9.5 // indirect
83+
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
7784
github.com/pkg/errors v0.9.1 // indirect
7885
github.com/pmezard/go-difflib v1.0.0 // indirect
7986
github.com/prometheus/procfs v0.8.0 // indirect
87+
github.com/spf13/afero v1.8.2 // indirect
88+
github.com/spf13/cast v1.5.0 // indirect
89+
github.com/spf13/jwalterweatherman v1.1.0 // indirect
8090
github.com/spf13/pflag v1.0.5 // indirect
91+
github.com/subosito/gotenv v1.4.1 // indirect
8192
golang.org/x/crypto v0.0.0-20221012134737-56aed061732a // indirect
8293
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect
8394
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect
@@ -90,6 +101,7 @@ require (
90101
google.golang.org/protobuf v1.28.1 // indirect
91102
gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect
92103
gopkg.in/inf.v0 v0.9.1 // indirect
104+
gopkg.in/ini.v1 v1.67.0 // indirect
93105
gopkg.in/yaml.v2 v2.4.0 // indirect
94106
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
95107
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect

0 commit comments

Comments
 (0)