Skip to content

Commit 8b0cb6b

Browse files
feat(cli): add --no-default-agents flag to kagent install
Signed-off-by: Raghavendiran-Github <raghavendiran46461@gmail.com>
1 parent e06146b commit 8b0cb6b

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

go/core/cli/cmd/kagent/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func main() {
6464
_ = installCmd.RegisterFlagCompletionFunc("profile", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
6565
return profiles.Profiles, cobra.ShellCompDirectiveNoFileComp
6666
})
67+
installCmd.Flags().BoolVar(&installCfg.NoDefaultAgents, "no-default-agents", false, "Disable all default agents for a minimal installation")
6768

6869
uninstallCmd := &cobra.Command{
6970
Use: "uninstall",

go/core/cli/internal/cli/agent/install.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,24 @@ import (
2020
)
2121

2222
type InstallCfg struct {
23-
Config *config.Config
24-
Profile string
23+
Config *config.Config
24+
Profile string
25+
NoDefaultAgents bool
26+
}
27+
28+
// defaultAgents is the list of agent names installed by the kagent helm chart.
29+
// Used by --no-default-agents to disable all of them via helm --set flags.
30+
var defaultAgents = []string{
31+
"k8s-agent",
32+
"kgateway-agent",
33+
"istio-agent",
34+
"promql-agent",
35+
"observability-agent",
36+
"argo-rollouts-agent",
37+
"helm-agent",
38+
"cilium-policy-agent",
39+
"cilium-manager-agent",
40+
"cilium-debug-agent",
2541
}
2642

2743
// installChart installs or upgrades a Helm chart with the given parameters
@@ -101,6 +117,14 @@ func InstallCmd(ctx context.Context, cfg *InstallCfg) *PortForward {
101117
helmConfig.inlineValues = profiles.GetProfileYaml(cfg.Profile)
102118
}
103119

120+
// --no-default-agents: disable every default agent via --set flags.
121+
// Using --set ensures this takes precedence over any inline profile values.
122+
if cfg.NoDefaultAgents {
123+
for _, agent := range defaultAgents {
124+
helmConfig.values = append(helmConfig.values, fmt.Sprintf("agents.%s.enabled=false", agent))
125+
}
126+
}
127+
104128
return install(ctx, cfg.Config, helmConfig, modelProvider)
105129
}
106130

0 commit comments

Comments
 (0)