Skip to content

"Fetched all managed portals" called repetitively during planning and inefficient api lookup #52

@rspurgeon

Description

@rspurgeon

When applying a simple change (A single version change in a single api resource), I see many calls to fetching all portals. This is tremendously inefficient.

In addition, we fail to find the API by ID directly instead using a name based lookup unsuccessfully and then falling back to ID lookup. The opposite should be the happy path.

./kongctl apply -f ./docs/examples/declarative/portal/portal.yaml -f ./docs/examples/declarative/portal/apis.yaml --log-level debug --auto-approve
time=2025-08-19T11:32:26.607-05:00 level=DEBUG msg="Processing namespaces" count=1 namespaces=[default]
time=2025-08-19T11:32:27.711-05:00 level=DEBUG msg="apiPlannerImpl.PlanChanges called" desiredAPIs=2
time=2025-08-19T11:32:27.712-05:00 level=DEBUG msg="planAPIChanges called" desiredCount=2
time=2025-08-19T11:32:27.918-05:00 level=DEBUG msg="Building portal reference mapping" desired_portals=1
time=2025-08-19T11:32:27.918-05:00 level=DEBUG msg="Added desired portal to mapping" ref=getting-started-portal id=9184fb60-4f56-46b9-b06f-4c0996b7a8a4
time=2025-08-19T11:32:27.978-05:00 level=DEBUG msg="Fetched all managed portals" count=1
time=2025-08-19T11:32:28.458-05:00 level=DEBUG msg="Building portal reference mapping" desired_portals=1
time=2025-08-19T11:32:28.458-05:00 level=DEBUG msg="Added desired portal to mapping" ref=getting-started-portal id=9184fb60-4f56-46b9-b06f-4c0996b7a8a4
time=2025-08-19T11:32:28.516-05:00 level=DEBUG msg="Fetched all managed portals" count=1
time=2025-08-19T11:32:29.114-05:00 level=DEBUG msg="Building portal reference mapping" desired_portals=1
time=2025-08-19T11:32:29.114-05:00 level=DEBUG msg="Added desired portal to mapping" ref=getting-started-portal id=9184fb60-4f56-46b9-b06f-4c0996b7a8a4
time=2025-08-19T11:32:29.182-05:00 level=DEBUG msg="Fetched all managed portals" count=1
time=2025-08-19T11:32:29.182-05:00 level=DEBUG msg="Checking publication existence" api=sms portal_ref=getting-started-portal resolved_portal_id=9184fb60-4f56-46b9-b06f-4c0996b7a8a4 exists=true
time=2025-08-19T11:32:29.247-05:00 level=DEBUG msg="Building portal reference mapping" desired_portals=1
time=2025-08-19T11:32:29.247-05:00 level=DEBUG msg="Added desired portal to mapping" ref=getting-started-portal id=9184fb60-4f56-46b9-b06f-4c0996b7a8a4
time=2025-08-19T11:32:29.310-05:00 level=DEBUG msg="Fetched all managed portals" count=1
time=2025-08-19T11:32:29.310-05:00 level=DEBUG msg="Checking publication existence" api=voice portal_ref=getting-started-portal resolved_portal_id=9184fb60-4f56-46b9-b06f-4c0996b7a8a4 exists=true

RESOURCE CHANGES
----------------------------------------------------------------------
Namespace: default (1 changes: 1 update)
  api (1 resources):
    ~ sms
      <configuration changes detected>

SUMMARY
----------------------------------------------------------------------
  Total changes: 1
  Namespaces affected: 1
  Resources to update: 1

  Resource breakdown:
    api: 1

Applying changes:
[1/1] [namespace: default] Updating api: sms... time=2025-08-19T11:32:29.310-05:00 level=DEBUG msg="Updating api" change="{ID:1:u:api:sms ResourceType:api ResourceRef:sms ResourceID:b1e94148-3e4e-42d6-91ff-23c03e6c54c7 ResourceMonikers:map[] Action:UPDATE Fields:map[version:3.3.0] References:map[] Parent:<nil> Protection:<nil> Namespace:default DependsOn:[]}"
time=2025-08-19T11:32:29.310-05:00 level=DEBUG msg="Looking up API by name" name=[unknown]
time=2025-08-19T11:32:29.409-05:00 level=DEBUG msg="Found managed APIs" count=2
time=2025-08-19T11:32:29.409-05:00 level=DEBUG msg="API not found in managed resources, trying fallback lookup" name=[unknown]
time=2025-08-19T11:32:29.499-05:00 level=DEBUG msg="Found total APIs" count=2
time=2025-08-19T11:32:29.499-05:00 level=DEBUG msg="API not found in any lookup strategy" name=[unknown]
time=2025-08-19T11:32:29.554-05:00 level=DEBUG msg="Resource found via ID lookup" resource_type=api name=[unknown] id=b1e94148-3e4e-42d6-91ff-23c03e6c54c7
✓

Complete.
Applied 1 changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions