Skip to content

Commit

Permalink
fix 503 error caused by outdated endpooints
Browse files Browse the repository at this point in the history
Signed-off-by: Huabing Zhao <[email protected]>
  • Loading branch information
zhaohuabing committed Nov 21, 2024
1 parent 2def6a4 commit cf820b9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions internal/provider/kubernetes/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,19 @@ func (r *gatewayAPIReconciler) processBackendRefs(ctx context.Context, gwcResour
} else {
for _, endpointSlice := range endpointSliceList.Items {
key := utils.NamespacedName(&endpointSlice).String()
r.log.Info("added EndpointSlice to resource tree",
"namespace", endpointSlice.Namespace,
"name", endpointSlice.Name)

Check warning on line 459 in internal/provider/kubernetes/controller.go

View check run for this annotation

Codecov / codecov/patch

internal/provider/kubernetes/controller.go#L457-L459

Added lines #L457 - L459 were not covered by tests
if !resourceMappings.allAssociatedEndpointSlices.Has(key) {
resourceMappings.allAssociatedEndpointSlices.Insert(key)
r.log.Info("added EndpointSlice to resource tree",
"namespace", endpointSlice.Namespace,
"name", endpointSlice.Name)
gwcResource.EndpointSlices = append(gwcResource.EndpointSlices, &endpointSlice)
} else {
for i, es := range gwcResource.EndpointSlices {
if es.Name == endpointSlice.Name && es.Namespace == endpointSlice.Namespace {
gwcResource.EndpointSlices = append(gwcResource.EndpointSlices[:i], gwcResource.EndpointSlices[i+1:]...)
gwcResource.EndpointSlices = append(gwcResource.EndpointSlices, &endpointSlice)
}

Check warning on line 468 in internal/provider/kubernetes/controller.go

View check run for this annotation

Codecov / codecov/patch

internal/provider/kubernetes/controller.go#L463-L468

Added lines #L463 - L468 were not covered by tests
}
}
}
}
Expand Down

0 comments on commit cf820b9

Please sign in to comment.