Skip to content

feat(controller): let embedding controllers register reference kinds - #3630

Closed
codyhartsook wants to merge 4 commits into
codyhartsook/ownedRefsUIfrom
codyhartsook/refKinds
Closed

codyhartsook wants to merge 4 commits into
codyhartsook/ownedRefsUIfrom
codyhartsook/refKinds

Conversation

@codyhartsook

@codyhartsook codyhartsook commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Builds on #3604, which lets references name a group and kind but resolves only the built-in kinds. app.Options.ReferenceKinds lets an embedding controller register more, each as a collection of its objects projected to RemoteMCPServer or ModelConfig. With example.com/ToolServer registered, a template can name one:

tools:
- mcp:
    server: {group: example.com, kind: ToolServer, name: search}
server Resolves to
{name: search} The RemoteMCPServer named search, as today
{group: example.com, kind: ToolServer, name: search} The registered ToolServer named search, projected to a RemoteMCPServer
Any other kind InvalidKind, as today

Compilers, egress and revisions only see the projected object, and provenance records ToolServer because the projection sets TypeMeta. Registering a built-in kind fails at startup. It's a callback because the collections need kagent's kube client and krt options, which exist only inside Run.

How a registered kind resolves
flowchart LR
    embedder["Embedding controller"] -->|ReferenceKinds| runtime["NewRuntime"]
    runtime -->|collections by group and kind| fetch["fetchModel / fetchMCPServer"]
    template["AgentTemplate reference"] -->|group, kind, name| fetch
    fetch -->|built-in kind| builtin["Built-in collection"]
    fetch -->|registered kind| projected["Projected collection"]
    fetch -->|other kind| invalid["InvalidKind"]
    builtin --> compile["Compilers, egress, revisions"]
    projected --> compile
Loading

Change Type

/kind feature

Changelog

Controllers that embed kagent can register their own model and MCP server kinds for references through `app.Options.ReferenceKinds`.

Validation

  • make lint, and the translator and controller suites, including envtest.
  • New tests cover registered MCP server and model kinds, their provenance, and the built-in key check.

@github-actions github-actions Bot added the enhancement New feature or request label Nov 10, 2026
@codyhartsook codyhartsook changed the title feat(controller): let embedding programs register reference kinds feat(controller): let embedding controllers register reference kinds Nov 10, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 10, 2026
@codyhartsook
codyhartsook changed the base branch from codyhartsook/ownedRefs to codyhartsook/ownedRefsUI November 10, 2026 16:08
@codyhartsook
codyhartsook added this pull request to stack #3608 November 10, 2026 16:08
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Nov 10, 2026
@codyhartsook
codyhartsook force-pushed the codyhartsook/ownedRefsUI branch 2 times, most recently from ad0d241 to be8d132 Compare November 10, 2026 19:07
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
@codyhartsook
codyhartsook marked this pull request as ready for review November 10, 2026 19:41
@codyhartsook
codyhartsook requested a review from a team as a code owner November 10, 2026 19:41
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
@codyhartsook
codyhartsook force-pushed the codyhartsook/ownedRefsUI branch 2 times, most recently from daf10d2 to 11c092b Compare November 10, 2026 22:12
return key, ptr.Deref(krt.FetchOne(ctx, servers, krt.FilterObjectName(key)), nil), nil
}
return key, nil, fmt.Errorf("resolve MCP server %q: %w %s", key, ErrInvalidKind, kind)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different MCP kinds with the same namespace/name produce identical runtime names, causing Codex and Claude compilation to fail. This needs to distinguish registered kinds while preserving built-in names.

Install the regenerated CRDs **before** you upgrade the controller or apply
namespace-qualified manifests. Older schemas can prune the namespace fields.

Manifests and stored objects from v1.0.x work unchanged and keep their revision

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these updates do not belong to the cross-namespace-ref arch doc. we can drop the noise

// ObjectReference is the v1.0.x name of ModelConfigReference.
//
// Deprecated: use ModelConfigReference.
type ObjectReference = ModelConfigReference

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to preserve the older ref type through an alias? it's also odd for a generic ObjectReference to alias to a Model specific type

//
// Deprecated: use Group.
// +optional
APIGroup *string `json:"apiGroup,omitempty"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Move optional fields to the bottom, and deprecated to the very end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use a const for status values

@codyhartsook
codyhartsook marked this pull request as draft November 11, 2026 00:15
@codyhartsook

Copy link
Copy Markdown
Contributor Author

Closing for now. Nothing in this repo needs the extension point yet, so the typed references in #3604 stand on their own.

@codyhartsook
codyhartsook removed this pull request from stack #3608 November 11, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants