Skip to content

Commit 9b27d26

Browse files
authored
Merge pull request #3305 from oliviassss/fix-ep
fix the race condition in pod cache and endpoint resolver
2 parents 5c892f5 + e071573 commit 9b27d26

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

controllers/ingress/eventhandlers/ingress_events.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (h *enqueueRequestsForIngressEvent) Update(e event.UpdateEvent, queue workq
4444
// 1. Ingress annotation updates
4545
// 2. Ingress spec updates
4646
// 3. Ingress deletion
47-
if ! equality.Semantic.DeepEqual(ingOld.ResourceVersion, ingNew.ResourceVersion) {
47+
if !equality.Semantic.DeepEqual(ingOld.ResourceVersion, ingNew.ResourceVersion) {
4848
if equality.Semantic.DeepEqual(ingOld.Annotations, ingNew.Annotations) &&
4949
equality.Semantic.DeepEqual(ingOld.Spec, ingNew.Spec) &&
5050
equality.Semantic.DeepEqual(ingOld.DeletionTimestamp.IsZero(), ingNew.DeletionTimestamp.IsZero()) {

controllers/service/eventhandlers/service_events.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (h *enqueueRequestsForServiceEvent) Update(e event.UpdateEvent, queue workq
3939
oldSvc := e.ObjectOld.(*corev1.Service)
4040
newSvc := e.ObjectNew.(*corev1.Service)
4141

42-
if ! equality.Semantic.DeepEqual(oldSvc.ResourceVersion, newSvc.ResourceVersion) {
42+
if !equality.Semantic.DeepEqual(oldSvc.ResourceVersion, newSvc.ResourceVersion) {
4343
if equality.Semantic.DeepEqual(oldSvc.Annotations, newSvc.Annotations) &&
4444
equality.Semantic.DeepEqual(oldSvc.Spec, newSvc.Spec) &&
4545
equality.Semantic.DeepEqual(oldSvc.DeletionTimestamp.IsZero(), newSvc.DeletionTimestamp.IsZero()) {

pkg/backend/endpoint_resolver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ func (r *defaultEndpointResolver) resolvePodEndpointsWithEndpointsData(ctx conte
166166
return nil, false, err
167167
}
168168
if !exists {
169-
r.logger.Info("ignore pod Endpoint with non-existent podInfo", "podKey", podKey.String())
169+
r.logger.Info("the pod in endpoint is not found in pod cache yet, will keep retrying", "podKey", podKey.String())
170+
containsPotentialReadyEndpoints = true
170171
continue
171172
}
172173
podEndpoint := buildPodEndpoint(pod, epAddr, epPort)

pkg/backend/endpoint_resolver_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ func Test_defaultEndpointResolver_ResolvePodEndpoints(t *testing.T) {
12401240
Pod: pod4,
12411241
},
12421242
},
1243-
wantContainsPotentialReadyEndpoints: false,
1243+
wantContainsPotentialReadyEndpoints: true,
12441244
},
12451245
{
12461246
name: "service not found",

0 commit comments

Comments
 (0)