mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-28 15:09:39 -08:00
Merge pull request #1780 from prometheus/fabxc-k8s-locks
discovery/kubernetes: add missing locking
This commit is contained in:
commit
b3f321b38a
|
@ -408,7 +408,9 @@ func (kd *Discovery) watchNodes(events chan interface{}, done <-chan struct{}, r
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the known nodes.
|
// Reset the known nodes.
|
||||||
|
kd.nodesMu.Lock()
|
||||||
kd.nodes = map[string]*Node{}
|
kd.nodes = map[string]*Node{}
|
||||||
|
kd.nodesMu.Unlock()
|
||||||
|
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
events <- &nodeEvent{Added, node}
|
events <- &nodeEvent{Added, node}
|
||||||
|
@ -459,7 +461,9 @@ func (kd *Discovery) startServiceWatch(events chan<- interface{}, done <-chan st
|
||||||
existingServices := kd.services
|
existingServices := kd.services
|
||||||
|
|
||||||
// Reset the known services.
|
// Reset the known services.
|
||||||
|
kd.servicesMu.Lock()
|
||||||
kd.services = map[string]map[string]*Service{}
|
kd.services = map[string]map[string]*Service{}
|
||||||
|
kd.servicesMu.Unlock()
|
||||||
|
|
||||||
services, resourceVersion, err := kd.getServices()
|
services, resourceVersion, err := kd.getServices()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue