Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#3305 from oliviassss/fix-ep
Browse files Browse the repository at this point in the history
fix the race condition in pod cache and endpoint resolver
  • Loading branch information
k8s-ci-robot authored Aug 4, 2023
2 parents 5c892f5 + e071573 commit 9b27d26
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion controllers/ingress/eventhandlers/ingress_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (h *enqueueRequestsForIngressEvent) Update(e event.UpdateEvent, queue workq
// 1. Ingress annotation updates
// 2. Ingress spec updates
// 3. Ingress deletion
if ! equality.Semantic.DeepEqual(ingOld.ResourceVersion, ingNew.ResourceVersion) {
if !equality.Semantic.DeepEqual(ingOld.ResourceVersion, ingNew.ResourceVersion) {
if equality.Semantic.DeepEqual(ingOld.Annotations, ingNew.Annotations) &&
equality.Semantic.DeepEqual(ingOld.Spec, ingNew.Spec) &&
equality.Semantic.DeepEqual(ingOld.DeletionTimestamp.IsZero(), ingNew.DeletionTimestamp.IsZero()) {
Expand Down
2 changes: 1 addition & 1 deletion controllers/service/eventhandlers/service_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (h *enqueueRequestsForServiceEvent) Update(e event.UpdateEvent, queue workq
oldSvc := e.ObjectOld.(*corev1.Service)
newSvc := e.ObjectNew.(*corev1.Service)

if ! equality.Semantic.DeepEqual(oldSvc.ResourceVersion, newSvc.ResourceVersion) {
if !equality.Semantic.DeepEqual(oldSvc.ResourceVersion, newSvc.ResourceVersion) {
if equality.Semantic.DeepEqual(oldSvc.Annotations, newSvc.Annotations) &&
equality.Semantic.DeepEqual(oldSvc.Spec, newSvc.Spec) &&
equality.Semantic.DeepEqual(oldSvc.DeletionTimestamp.IsZero(), newSvc.DeletionTimestamp.IsZero()) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/backend/endpoint_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ func (r *defaultEndpointResolver) resolvePodEndpointsWithEndpointsData(ctx conte
return nil, false, err
}
if !exists {
r.logger.Info("ignore pod Endpoint with non-existent podInfo", "podKey", podKey.String())
r.logger.Info("the pod in endpoint is not found in pod cache yet, will keep retrying", "podKey", podKey.String())
containsPotentialReadyEndpoints = true
continue
}
podEndpoint := buildPodEndpoint(pod, epAddr, epPort)
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/endpoint_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ func Test_defaultEndpointResolver_ResolvePodEndpoints(t *testing.T) {
Pod: pod4,
},
},
wantContainsPotentialReadyEndpoints: false,
wantContainsPotentialReadyEndpoints: true,
},
{
name: "service not found",
Expand Down

0 comments on commit 9b27d26

Please sign in to comment.