mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape/discovery/kubernetes: start watchers for pods and services before starting watchers for endpoints
This should eliminate possible race when an update on endpoints depends on pods and/or services, which are missing in the cache yet. This could result in missing targets based on endpoints or endpointslices. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1240
This commit is contained in:
parent
9cdd4696fe
commit
904bbffc7f
1 changed files with 1 additions and 1 deletions
|
@ -75,12 +75,12 @@ func newAPIWatcher(apiServer string, ac *promauth.Config, sdc *SDConfig, swcFunc
|
|||
}
|
||||
|
||||
func (aw *apiWatcher) mustStart() {
|
||||
aw.gw.startWatchersForRole(aw.role, aw)
|
||||
if aw.role == "endpoints" || aw.role == "endpointslices" {
|
||||
// endpoints and endpointslices watchers query pod and service objects. So start watchers for these roles as well.
|
||||
aw.gw.startWatchersForRole("pod", nil)
|
||||
aw.gw.startWatchersForRole("service", nil)
|
||||
}
|
||||
aw.gw.startWatchersForRole(aw.role, aw)
|
||||
}
|
||||
|
||||
func (aw *apiWatcher) mustStop() {
|
||||
|
|
Loading…
Reference in a new issue