Skip to content

feat: add secret creation with modelconfig in REST API#1781

Merged
EItanya merged 4 commits intokagent-dev:mainfrom
supreme-gg-gg:feat/modelconfig-secret
May 1, 2026
Merged

feat: add secret creation with modelconfig in REST API#1781
EItanya merged 4 commits intokagent-dev:mainfrom
supreme-gg-gg:feat/modelconfig-secret

Conversation

@supreme-gg-gg
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions Bot added the enhancement New feature or request label Apr 30, 2026
@supreme-gg-gg supreme-gg-gg marked this pull request as ready for review April 30, 2026 03:22
Copilot AI review requested due to automatic review settings April 30, 2026 03:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for creating/updating “companion” Kubernetes Secrets as part of the ModelConfig REST create/update flows, enabling clients to submit secret material alongside a ModelConfig spec.

Changes:

  • Extend REST API request payloads to accept secrets (name/key/value/type) on create/update.
  • Implement validation + create/update logic for companion Secrets in the ModelConfig HTTP handler.
  • Add handler tests covering successful companion secret creation/update and invalid secret names.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
ui/src/types/index.ts Adds SecretMaterial and extends ModelConfig create/update request types with optional secrets.
go/api/httpapi/types.go Adds SecretMaterial + secrets fields to ModelConfig create/update API request structs.
go/core/internal/httpserver/handlers/modelconfig.go Validates secret material and creates/updates companion Secrets during ModelConfig create/update.
go/core/internal/httpserver/handlers/modelconfig_test.go Adds tests for companion secret behavior and validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go/core/internal/httpserver/handlers/modelconfig.go Outdated
Comment thread go/core/internal/httpserver/handlers/modelconfig.go
Comment thread go/core/internal/httpserver/handlers/modelconfig.go Outdated
Comment thread go/core/internal/httpserver/handlers/modelconfig.go Outdated
Copy link
Copy Markdown
Contributor

@EItanya EItanya left a comment

Choose a reason for hiding this comment

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

I agree with Copilot's comments here. I think we should be careful about the secrets we edit/overwrite here. Since these are implicitly managed by kagent it may even be worth creating the ModelConfig first, and then using an OwnerReference to make sure these secrets are cleaned up when the ModelConfig is deleted.

Comment thread ui/src/types/index.ts Outdated
name: string;
key: string;
value: string;
type?: 'Opaque';
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 specify type, let's keep it Opaque for now and add it if it becomes necessary later?

Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
This reverts commit 48fe02a.

Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
@supreme-gg-gg supreme-gg-gg force-pushed the feat/modelconfig-secret branch from 4f20942 to 0892226 Compare April 30, 2026 16:43
@supreme-gg-gg
Copy link
Copy Markdown
Contributor Author

Yes I totally agree with that, I've address copilot's reviews as well. Now modelconfig is created first then the secret, on updates it checks that the secret is owned by the modelconfig, and deleting the modelconfig deletes the secrets as well (due to owner reference)

@EItanya EItanya merged commit f3ac0cf into kagent-dev:main May 1, 2026
24 checks passed
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.

3 participants