mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-04-29 10:10:18 -04:00
Prevent potential concurrent map access by taking a lock before reading the topology cache's hintsPopulatedByService map. * staging/src/k8s.io/endpointslice/topologycache/topologycache.go (setHintsLocked, hasPopulatedHintsLocked): New helper functions. These are the same as the existing SetHints and HasPopulatedHints methods except that these helpers assume that a lock is already held. (SetHints): Use setHintsLocked. (HasPopulatedHints): Take a lock and use hasPopulatedHintsLocked. (AddHints): Take a lock and use setHintsLocked and hasPopulatedHintsLocked. * staging/src/k8s.io/endpointslice/topologycache/topologycache_test.go (TestTopologyCacheRace): Add a goroutine that calls HasPopulatedHints. |
||
|---|---|---|
| .. | ||
| config | ||
| metrics | ||
| topologycache | ||
| endpointslice_controller.go | ||
| endpointslice_controller_test.go | ||
| OWNERS | ||
| reconciler.go | ||
| reconciler_test.go | ||
| utils.go | ||
| utils_test.go | ||