From 3cd9dd2c0db6df00197326e125fe041026b87a51 Mon Sep 17 00:00:00 2001 From: lob Date: Wed, 8 Dec 2021 22:17:28 +0800 Subject: [PATCH 1/2] fix: add kubernetes client QPS and Burst config Signed-off-by: lob --- main.go | 2 ++ pkg/exporter/config.go | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 61060446..f0beab11 100644 --- a/main.go +++ b/main.go @@ -65,6 +65,8 @@ func main() { if err != nil { log.Fatal().Err(err).Msg("cannot get kubeconfig") } + kubeconfig.QPS = cfg.KubeQPS + kubeconfig.Burst = cfg.KubeBurst engine := exporter.NewEngine(&cfg, &exporter.ChannelBasedReceiverRegistry{}) w := kube.NewEventWatcher(kubeconfig, cfg.Namespace, cfg.ThrottlePeriod, engine.OnEvent) diff --git a/pkg/exporter/config.go b/pkg/exporter/config.go index 160da4f8..16d82dea 100644 --- a/pkg/exporter/config.go +++ b/pkg/exporter/config.go @@ -12,11 +12,14 @@ type Config struct { // TODO: I am not sure what to do here. LogLevel string `yaml:"logLevel"` LogFormat string `yaml:"logFormat"` - ThrottlePeriod int64 `yaml:"throttlePeriod"` + ThrottlePeriod int64 `yaml:"throttlePeriod"` Namespace string `yaml:"namespace"` LeaderElection kube.LeaderElectionConfig `yaml:"leaderElection"` Route Route `yaml:"route"` Receivers []sinks.ReceiverConfig `yaml:"receivers"` + + KubeQPS float32 `yaml:"kubeQPS,omitempty"` + KubeBurst int `yaml:"kubeBurst,omitempty"` } func (c *Config) Validate() error { From 5852c86d99af4fe3b96afbfd86ce61616d83d61b Mon Sep 17 00:00:00 2001 From: lob Date: Wed, 8 Dec 2021 22:34:57 +0800 Subject: [PATCH 2/2] doc: add configuration example Signed-off-by: lob --- config.example.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/config.example.yaml b/config.example.yaml index a2815627..23cb6a91 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -1,5 +1,8 @@ logLevel: debug logFormat: json +throttlePeriod: 10 +kubeQPS: 60 +kubeBurst: 60 # namespace: my-namespace-only # Omitting it defaults to all namespaces. route: # Main route @@ -7,8 +10,8 @@ route: # This route allows dumping all events because it has no fields to match and no drop rules. - match: - receiver: "dump" - # This starts another route, drops all the events in *test* namespaces and Normal events - # for capturing critical events + # This starts another route, drops all the events in *test* namespaces and Normal events + # for capturing critical events - drop: - namespace: "*test*" - type: "Normal" @@ -17,10 +20,10 @@ route: - receiver: "pipe" # This a final route for user messages - match: - - kind: "Pod|Deployment|ReplicaSet" - labels: - version: "dev" - receiver: "slack" + - kind: "Pod|Deployment|ReplicaSet" + labels: + version: "dev" + receiver: "slack" receivers: - name: "dump" elasticsearch: