fix(cli): allow minimal installs without a provider API key#1632
fix(cli): allow minimal installs without a provider API key#1632officialasishkumar wants to merge 2 commits intokagent-dev:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts the CLI install flow and Helm chart so that the minimal installation profile can be used as a provider-less bootstrap path (i.e., without requiring a provider API key or installing a default ModelConfig).
Changes:
- Add a Helm value (
providers.createDefaultModelConfig) and guard Helm templates so the defaultModelConfig/Secret can be skipped. - Update the
minimalembedded profile YAML to disable defaultModelConfigcreation and adjust CLI install credential checks accordingly. - Add unit tests covering the new CLI behavior and Helm template rendering behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| helm/kagent/values.yaml | Adds providers.createDefaultModelConfig defaulting to true. |
| helm/kagent/templates/modelconfig.yaml | Conditionally renders the default ModelConfig based on createDefaultModelConfig. |
| helm/kagent/templates/modelconfig-secret.yaml | Conditionally renders the provider API key Secret based on createDefaultModelConfig. |
| helm/kagent/tests/modelconfig_test.yaml | Adds a helm-unittest case asserting ModelConfig is not rendered when disabled. |
| helm/kagent/tests/modelconfig-secret_test.yaml | Adds a helm-unittest case asserting Secret is not rendered when disabled. |
| go/core/cli/internal/profiles/minimal.yaml | Disables default ModelConfig creation for the minimal profile. |
| go/core/cli/internal/profiles/profiles.go | Adds helper to indicate whether a profile installs the default ModelConfig. |
| go/core/cli/internal/profiles/README.md | Updates minimal profile description to reflect no default model config. |
| go/core/cli/internal/cli/agent/install.go | Skips provider credential enforcement when the selected profile doesn’t install a default ModelConfig; refactors profile resolution. |
| go/core/cli/internal/cli/agent/install_test.go | Adds unit tests for profile resolution and credential requirement logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -92,13 +110,9 @@ func InstallCmd(ctx context.Context, cfg *InstallCfg) *PortForward { | |||
| helmConfig := setupHelmConfig(modelProvider, apiKeyValue) | |||
There was a problem hiding this comment.
When the selected profile does not install a default ModelConfig (e.g. minimal), the CLI skips the API-key requirement, but it still reads the provider API key from the environment and passes it into Helm values (via setupHelmConfig). If the env var is set, this will store credentials in the Helm release even though the chart won’t create ModelConfig/Secret resources. Consider avoiding reading/passing apiKey into Helm when the profile disables default ModelConfig creation (and/or omit the providers..apiKey value entirely in that case).
There was a problem hiding this comment.
Stopped passing provider values into Helm when the selected profile skips the default ModelConfig, so the minimal install path no longer stores an unused API key in the release. Included in 8cb2bcf.
| {{- if ne .Values.providers.createDefaultModelConfig false }} | ||
| {{- $dot := . }} | ||
| {{- $model := index $dot.Values.providers $dot.Values.providers.default }} | ||
| {{- if and $model.apiKeySecretRef $model.apiKey }} |
There was a problem hiding this comment.
This template indexes .Values.providers using .Values.providers.default without a fallback. If providers.default is unset/empty, Helm can error before reaching the apiKey checks. modelconfig.yaml defensively defaults the provider key to "openAI"; modelconfig-secret.yaml should mirror that defaulting (or otherwise guard against a missing providers.default) to keep chart behavior consistent and robust.
There was a problem hiding this comment.
Mirrored the modelconfig.yaml fallback here, so an empty providers.default now falls back to openAI instead of indexing a missing key. Added a Helm unit test in 8cb2bcf.
Treat the minimal install profile as a provider-less bootstrap path so kagent install --profile minimal no longer blocks on OPENAI_API_KEY. Add a chart flag to skip rendering the default ModelConfig and enable it in the minimal profile so the installation does not create a broken default provider configuration. Refs kagent-dev#1622 Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
2be4e9e to
8cb2bcf
Compare
Summary
ModelConfigso it can be used as a provider-less bootstrap pathTesting
go test ./core/cli/internal/cli/agentmake helm-version >/dev/null && helm unittest helm/kagenthelm template test-install helm/kagent -f go/core/cli/internal/profiles/minimal.yaml --set providers.default=openAI | rg -n 'default-model-config|kagent-openai|kind: ModelConfig'Closes #1622