From 8b0cb6b24f825c9ca5ddfd2f7961882a9c5d1502 Mon Sep 17 00:00:00 2001 From: Raghavendiran-Github Date: Tue, 31 Mar 2026 14:16:20 +0530 Subject: [PATCH] feat(cli): add --no-default-agents flag to kagent install Signed-off-by: Raghavendiran-Github --- go/core/cli/cmd/kagent/main.go | 1 + go/core/cli/internal/cli/agent/install.go | 28 +++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/go/core/cli/cmd/kagent/main.go b/go/core/cli/cmd/kagent/main.go index 8792835b0..a631550ba 100644 --- a/go/core/cli/cmd/kagent/main.go +++ b/go/core/cli/cmd/kagent/main.go @@ -64,6 +64,7 @@ func main() { _ = installCmd.RegisterFlagCompletionFunc("profile", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return profiles.Profiles, cobra.ShellCompDirectiveNoFileComp }) + installCmd.Flags().BoolVar(&installCfg.NoDefaultAgents, "no-default-agents", false, "Disable all default agents for a minimal installation") uninstallCmd := &cobra.Command{ Use: "uninstall", diff --git a/go/core/cli/internal/cli/agent/install.go b/go/core/cli/internal/cli/agent/install.go index 27f5577c9..acfb973bd 100644 --- a/go/core/cli/internal/cli/agent/install.go +++ b/go/core/cli/internal/cli/agent/install.go @@ -20,8 +20,24 @@ import ( ) type InstallCfg struct { - Config *config.Config - Profile string + Config *config.Config + Profile string + NoDefaultAgents bool +} + +// defaultAgents is the list of agent names installed by the kagent helm chart. +// Used by --no-default-agents to disable all of them via helm --set flags. +var defaultAgents = []string{ + "k8s-agent", + "kgateway-agent", + "istio-agent", + "promql-agent", + "observability-agent", + "argo-rollouts-agent", + "helm-agent", + "cilium-policy-agent", + "cilium-manager-agent", + "cilium-debug-agent", } // installChart installs or upgrades a Helm chart with the given parameters @@ -101,6 +117,14 @@ func InstallCmd(ctx context.Context, cfg *InstallCfg) *PortForward { helmConfig.inlineValues = profiles.GetProfileYaml(cfg.Profile) } + // --no-default-agents: disable every default agent via --set flags. + // Using --set ensures this takes precedence over any inline profile values. + if cfg.NoDefaultAgents { + for _, agent := range defaultAgents { + helmConfig.values = append(helmConfig.values, fmt.Sprintf("agents.%s.enabled=false", agent)) + } + } + return install(ctx, cfg.Config, helmConfig, modelProvider) }