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

Function NewClient

02-mcp-for-devops/code/04/pkg/k8s/client.go:29–44  ·  view source on GitHub ↗
(configPath string, logger *logging.Logger)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

buildConfigFunction · 0.70

Tested by

no test coverage detected