Skip to content

External Resources #47

@rspurgeon

Description

@rspurgeon

External Resources

Overview

Implement external resources to enable kongctl to integrate with
resources managed outside of a particular set of declarative configuration
files. This allows users to reference existing resources without taking ownership
which supports a variety of use cases.

As kongctl expands capabilities, users need:

  • Ability to manage resources across teams while maintaining ability to reference resources defined elsewhere. Referencing resources across teams, enabling federated configuration management (one team owns a portal and another team externally references it for their API publication).
  • Migration paths that don't require abandoning existing declarative tools immediately. Phased Migration from one tool to kongctl
  • Ability to operate multiple tools in parallel

Solution

Introduce _external blocks that:

  • Define resources managed by external tools
  • Use selectors to query and identify specific resources
  • Resolve to resource IDs and data during planning
  • Enable dependencies between kongctl-managed and externally-managed resources

Key Features

  • Direct ID Reference: Reference resources by UUID when known
  • Field Selectors: Query resources by field values
  • Parent Relationships: Support hierarchical resource structures
  • Implicit ID Resolution: Automatic resolution of ID fields
  • Type Safety: Resource-type-aware validation and resolution

Success Criteria

  • Users can reference any supported Konnect resource managed externally
  • Clear error messages for ambiguous or missing resources
  • Seamless integration in dependency chains
  • Intuitive configuration syntax

Example Use Case

A team using decK for gateway configuration wants to adopt kongctl for API
management. They can reference their existing control planes and services
while managing APIs and API implementations through kongctl:

accepted design

portals:
  - ref: core-team-portal
    _external:
      selector:
        matchFields:
          name: "Core Team"

apis:
  - ref: sms
    _external:
      selector:
        matchFields:
          name: "SMS API"
    
    # Children to the external API resource
    versions:
      - ref: sms-v1
        version: !file apis/sms/openapi.yaml#info.version
        spec: !file apis/sms/openapi.yaml
        
    documents:
      - ref: sms-getting-started
        title: "SMS API: Getting Started"
        slug: sms-getting-started
        status: published
        content: !file apis/sms/docs/getting-started.md
        
    publications:
      - ref: sms-api-to-core-portal
        portal_id: core-team-portal # FK ref to external portal resource

alternative design

external_resources:
  - ref: prod-cp
    resource_type: control_plane
    id: 123e4567-e89b-12d3-a456-426614174000
  - ref: user-service
    resource_type: ce_service # core entity service
    control_plane: prod-cp    # Parent reference
    selector:
      matchFields:
        name: user-service

apis:
  - ref: user-api
    name: User Management API
    
api_implementations:
  - ref: impl
    api:
      ref: user-api
    service:
      control_plane_id: prod-cp  # Resolves to ID of external resource
      id: user-service           # Resolves to ID of external resource

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions