Skip to content
Closed
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
5 changes: 5 additions & 0 deletions pkg/controllers/proxy/nodeport_healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type serviceHealthCheck struct {
}

type nphcServicesInfo struct {
mu sync.RWMutex
serviceInfoMap serviceInfoMap
endpointsInfoMap endpointSliceInfoMap
}
Expand All @@ -36,8 +37,10 @@ type nphcHandler struct {
func (nphc *nodePortHealthCheckController) UpdateServicesInfo(serviceInfoMap serviceInfoMap,
endpointsInfoMap endpointSliceInfoMap) error {
klog.V(1).Info("Running UpdateServicesInfo for NodePort health check")
nphc.mu.Lock()
nphc.serviceInfoMap = serviceInfoMap
nphc.endpointsInfoMap = endpointsInfoMap
nphc.mu.Unlock()

newActiveServices := make(map[int]bool)

Expand Down Expand Up @@ -141,7 +144,9 @@ func (nphc *nodePortHealthCheckController) stopHealthCheck(nodePort int) error {
}

func (npHandler *nphcHandler) Handler(w http.ResponseWriter, r *http.Request) {
npHandler.nphc.mu.RLock()
eps := npHandler.nphc.endpointsInfoMap[npHandler.svcHC.serviceID]
npHandler.nphc.mu.RUnlock()
endpointsOnNode := hasActiveEndpoints(eps)

var numActiveEndpoints int8
Expand Down