Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop processing service and endpoints updates if network service controller has already shutdown #939

Merged
merged 1 commit into from
Jun 29, 2020
Merged
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
17 changes: 11 additions & 6 deletions pkg/controllers/proxy/network_services_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.Control
for {
select {
case <-stopCh:
nsc.mu.Lock()
nsc.readyForUpdates = false
nsc.mu.Unlock()
glog.Info("Shutting down network services controller")
return

Expand Down Expand Up @@ -788,13 +791,13 @@ func (nsc *NetworkServicesController) OnEndpointsUpdate(ep *api.Endpoints) {
return
}

nsc.mu.Lock()
defer nsc.mu.Unlock()
glog.V(1).Infof("Received update to endpoint: %s/%s from watch API", ep.Namespace, ep.Name)
if !nsc.readyForUpdates {
glog.V(3).Infof("Skipping update to endpoint: %s/%s, controller still performing bootup full-sync", ep.Namespace, ep.Name)
glog.V(3).Infof("Skipping update to endpoint: %s/%s as controller is not ready to process service and endpoints updates", ep.Namespace, ep.Name)
return
}
nsc.mu.Lock()
defer nsc.mu.Unlock()

// build new service and endpoints map to reflect the change
newServiceMap := nsc.buildServicesInfo()
Expand All @@ -812,13 +815,15 @@ func (nsc *NetworkServicesController) OnEndpointsUpdate(ep *api.Endpoints) {

// OnServiceUpdate handle change in service update from the API server
func (nsc *NetworkServicesController) OnServiceUpdate(svc *api.Service) {

nsc.mu.Lock()
defer nsc.mu.Unlock()

glog.V(1).Infof("Received update to service: %s/%s from watch API", svc.Namespace, svc.Name)
if !nsc.readyForUpdates {
glog.V(3).Infof("Skipping update to service: %s/%s, controller still performing bootup full-sync", svc.Namespace, svc.Name)
glog.V(3).Infof("Skipping update to service: %s/%s as controller is not ready to process service and endpoints updates", svc.Namespace, svc.Name)
return
}
nsc.mu.Lock()
defer nsc.mu.Unlock()

// build new service and endpoints map to reflect the change
newServiceMap := nsc.buildServicesInfo()
Expand Down