Skip to content

Commit

Permalink
reconciles grpc scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
DDH13 committed Apr 25, 2024
1 parent 290c65f commit 4389907
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions adapter/internal/operator/controllers/dp/api_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const (
serviceHTTPRouteIndex = "serviceHTTPRouteIndex"
httprouteScopeIndex = "httprouteScopeIndex"
gqlRouteScopeIndex = "gqlRouteScopeIndex"
grpcRouteScopeIndex = "grpcRouteScopeIndex"
configMapBackend = "configMapBackend"
configMapAPIDefinition = "configMapAPIDefinition"
secretBackend = "secretBackend"
Expand Down Expand Up @@ -1660,6 +1661,22 @@ func (apiReconciler *APIReconciler) getAPIsForScope(ctx context.Context, obj k8c
requests = append(requests, apiReconciler.getAPIForGQLRoute(ctx, &httpRoute)...)
}

grpcRouteList := &gwapiv1a2.GRPCRouteList{}
if err := apiReconciler.client.List(ctx, grpcRouteList, &k8client.ListOptions{
FieldSelector: fields.OneTermEqualSelector(grpcRouteScopeIndex, utils.NamespacedName(scope).String()),
}); err != nil {
loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2625, logging.CRITICAL, "Unable to find associated GRPCRoutes: %s", utils.NamespacedName(scope).String()))
return []reconcile.Request{}
}

if len(grpcRouteList.Items) == 0 {
loggers.LoggerAPKOperator.Debugf("GRPCRoutes for scope not found: %s", utils.NamespacedName(scope).String())
}
for item := range grpcRouteList.Items {
grpcRoute := grpcRouteList.Items[item]
requests = append(requests, apiReconciler.getAPIForGRPCRoute(ctx, &grpcRoute)...)
}

return requests
}

Expand Down

0 comments on commit 4389907

Please sign in to comment.