Repository navigation
feat(api): own typed references for models and MCP servers - #3604
codyhartsook wants to merge 1 commit into
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
394029c to
be0e138
Compare
be0e138 to
97287a8
Compare
97287a8 to
65f7e29
Compare
65f7e29 to
a1b1e84
Compare
shashankram
left a comment
There was a problem hiding this comment.
Reviewed the updated head a1b1e84. The egress reference changes are fully removed, and the remaining model and MCP reference changes look correct. No blocking findings.
a1b1e84 to
26d670e
Compare
| // +kubebuilder:validation:XValidation:rule="!has(self.apiGroup)",message="use group instead of apiGroup" | ||
| // +kubebuilder:validation:XValidation:rule="!has(self.group) || self.group == 'api.kagent.dev' || (has(self.kind) && self.kind != 'RemoteMCPServer')",message="a group other than api.kagent.dev requires its own kind" | ||
| type MCPServerReference struct { | ||
| // v1.0.x Go clients encode an unset apiGroup as null. Keeping the field lets |
There was a problem hiding this comment.
Same thing as below. I might be missing something. I don't think we care about breaking Go clients right now, so I think we can remove this field. Rollbacks aren't currently supported afaik
There was a problem hiding this comment.
Decided to keep the field and reworded its comment to give the reason. The kagent CLI sends apiGroup: null, and the gRPC API rejects unknown fields (structuredobject.go:75), so a v1.0.x CLI would break against a new server. The kind default stays because the upgrade suite rolls back to the previous release.
timflannagan
left a comment
There was a problem hiding this comment.
Also something that I forgot to mention. I think we should update STYLE.md + any other relevant docs to avoid using types where we don't own the API evolution, e.g. corev1
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
26d670e to
98d76a3
Compare
|
On the STYLE.md note: updated STYLE.md and docs/kubernetes-api.md. References use kagent-owned types, not |
Description
v1alpha3 model and MCP server references can't name another kind:
corev1.TypedObjectReferenceapiGroupmeans the core group, so CEL rules pin it toRemoteMCPServer. The CRD docs describe ReferenceGrant and a feature gate kagent doesn't use.v1alpha3.ObjectReferenceThis PR gives both one kagent-owned shape, like v1alpha2's
TypedReference: optionalgroupandkindnext toname. Omitted values keep today's meaning, and a group other thanapi.kagent.devmust name its own kind. Any other kind fails with reasonInvalidKindonResolvedRefs, as in Gateway API. Egress policy references keepLocalObjectReferenceuntil a second policy kind exists.A second kind must ship at least one release after this one. A v1.0.x controller ignores
groupandkindon a model reference and quietly resolves the same-namedModelConfig, which may call the model with a different credential. Before rolling back to v1.0.x, point model references back toModelConfig.Compatibility with v1.0.x
kinddefaults toRemoteMCPServerin the schema, so v1.0.x controllers and clients can still update the object.apiGroupstays as a deprecated MCP field that must be omitted. v1.0.x Go clients, including the kagent CLI, send it asnull, and the gRPC API rejects unknown fields.ObjectReferenceis renamedModelConfigReference, andMCPToolBinding.Serverchanges type.groupandkindfrom model references at the next write.docs/kubernetes-api.mdandSTYLE.mdnow say to own reference types instead of reusingcorev1ones. Thename must not be emptyCEL rules on model references are gone, since the schema already requires a non-empty name.Stacked on this: #3607 keeps
groupandkindon references the UI saves.Change Type
Changelog
Validation
make lint, including kube-api-linter, andmake manifests.api/v1alpha3,translator,controller,grpcserver,substrateandcli.groupwithout its own kind is rejected on both references.mainand this branch for the kagent, Codex and Claude harnesses. The revision digests match.