MCPcopy Create free account
hub / github.com/VersusControl/devops-ai-guidelines / NewClient

Function NewClient

02-mcp-for-devops/code/03/pkg/k8s/client.go:26–41  ·  view source on GitHub ↗
(configPath string, logger *logrus.Logger)

Source from the content-addressed store, hash-verified

24}
25
26func NewClient(configPath string, logger *logrus.Logger) (*Client, error) {
27 config, err := buildConfig(configPath)
28 if err != nil {
29 return nil, fmt.Errorf("failed to build kubernetes config: %w", err)
30 }
31
32 clientset, err := kubernetes.NewForConfig(config)
33 if err != nil {
34 return nil, fmt.Errorf("failed to create kubernetes client: %w", err)
35 }
36
37 return &Client{
38 clientset: clientset,
39 logger: logger,
40 }, nil
41}
42
43func buildConfig(configPath string) (*rest.Config, error) {
44 // Try in-cluster config first

Callers

nothing calls this directly

Calls 1

buildConfigFunction · 0.70

Tested by

no test coverage detected