Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

fix: add kubernetes client QPS and Burst config #171

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions config.example.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
logLevel: debug
logFormat: json
throttlePeriod: 10
kubeQPS: 60
kubeBurst: 60
# namespace: my-namespace-only # Omitting it defaults to all namespaces.
route:
# Main route
routes:
# 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"
Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion pkg/exporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down