everpeace / kube-throttler

throttling your pods in kubernetes cluster.
Apache License 2.0
32 stars 6 forks source link

fix: make reservedResourceAmounts fully goroutine-safe #62

Closed sanposhiho closed 1 year ago

sanposhiho commented 1 year ago

In reservedResourceAmount, it didn't take any lock before accessing c.cache and it caused concurrent map read and map write. We can reproduce it with the updated test in pkg/controllers/reserved_resource_amounts_test.go.