-
Notifications
You must be signed in to change notification settings - Fork 25
Helm integration #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Helm integration #58
Conversation
Thanks for contributing, I'll review it ASAP |
type Helm struct { | ||
settings *cli.EnvSettings | ||
} | ||
|
||
// NewHelm creates a new Helm instance (optionally for a specific kubeconfig) | ||
func NewHelm() *Helm { | ||
return &Helm{ | ||
settings: cli.New(), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start, but it's inconsistent with the current behavior and usage of client-go.
It's a requirement that helm shares the settings used by client-go and are resolved here:
kubernetes-mcp-server/pkg/kubernetes/configuration.go
Lines 23 to 45 in fa5bb81
func resolveKubernetesConfigurations(kubernetes *Kubernetes) error { | |
// Always set clientCmdConfig | |
pathOptions := clientcmd.NewDefaultPathOptions() | |
if kubernetes.Kubeconfig != "" { | |
pathOptions.LoadingRules.ExplicitPath = kubernetes.Kubeconfig | |
} | |
kubernetes.clientCmdConfig = clientcmd.NewNonInteractiveDeferredLoadingClientConfig( | |
&clientcmd.ClientConfigLoadingRules{ExplicitPath: pathOptions.GetDefaultFilename()}, | |
&clientcmd.ConfigOverrides{ClusterInfo: clientcmdapi.Cluster{Server: ""}}) | |
var err error | |
if kubernetes.IsInCluster() { | |
kubernetes.cfg, err = InClusterConfig() | |
if err == nil && kubernetes.cfg != nil { | |
return nil | |
} | |
} | |
// Out of cluster | |
kubernetes.cfg, err = kubernetes.clientCmdConfig.ClientConfig() | |
if kubernetes.cfg != nil && kubernetes.cfg.UserAgent == "" { | |
kubernetes.cfg.UserAgent = rest.DefaultKubernetesUserAgent() | |
} | |
return err | |
} |
genericclioptions.ConfigFlags
internally uses a clientConfig
(clientcmd.ClientConfig
).
Once the cli.EnvSettings
are fully resolved, the private fields should match those that we use internally in kubernetes-mcp-server
.
so we probably want some sort of logic that overrides some of the settings after doing cli.New()
.
I did something similar here:
This PR introduces the first stage of Helm integration into the MCP server, following the project’s architectural guidelines of using the Helm Go SDK (not the Helm CLI) for native Kubernetes and Helm operations.
Key Features:
Motivation
How to Test
npx @modelcontextprotocol/inspector@latest $(pwd)/kubernetes-mcp-server
Roadmap / Next Steps
Future PRs will add:
Related Issue
Closes #55