kubectl

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessLevelReadOnly  = "readonly"
	AccessLevelReadWrite = "readwrite"
	AccessLevelAdmin     = "admin"
)

Access level constants

Variables

This section is empty.

Functions

func GetKubectlToolNames added in v0.0.5

func GetKubectlToolNames() []string

GetKubectlToolNames returns the names of all kubectl tools

func MapOperationToCommand added in v0.0.5

func MapOperationToCommand(toolName, operation, resource string) (string, error)

MapOperationToCommand maps consolidated operations to kubectl commands

func RegisterKubectlTools added in v0.0.5

func RegisterKubectlTools(accessLevel string) []mcp.Tool

RegisterKubectlTools returns kubectl tools filtered by access level

Types

type Example added in v0.0.5

type Example struct {
	Description string
	Operation   string
	Resource    string
	Args        string
}

Example shows how to use a consolidated tool

type KubectlCommand

type KubectlCommand struct {
	Name        string
	Description string
	ArgsExample string // Example of command arguments, such as "pods" or "-f deployment.yaml"
}

KubectlCommand defines a specific kubectl command to be registered as a tool

func GetAdminKubectlCommands

func GetAdminKubectlCommands() []KubectlCommand

GetAdminKubectlCommands returns all admin kubectl commands

func GetReadOnlyKubectlCommands

func GetReadOnlyKubectlCommands() []KubectlCommand

GetReadOnlyKubectlCommands returns all read-only kubectl commands

func GetReadWriteKubectlCommands

func GetReadWriteKubectlCommands() []KubectlCommand

GetReadWriteKubectlCommands returns all read-write kubectl commands

type KubectlExecutor

type KubectlExecutor struct{}

KubectlExecutor implements the CommandExecutor interface for kubectl commands

func NewExecutor

func NewExecutor() *KubectlExecutor

NewExecutor creates a new KubectlExecutor instance

func (*KubectlExecutor) Execute

func (e *KubectlExecutor) Execute(params map[string]interface{}, cfg *config.ConfigData) (string, error)

Execute handles general kubectl command execution (for backward compatibility)

func (*KubectlExecutor) ExecuteSpecificCommand

func (e *KubectlExecutor) ExecuteSpecificCommand(cmd string, params map[string]interface{}, cfg *config.ConfigData) (string, error)

ExecuteSpecificCommand executes a specific kubectl command with the given arguments

type KubectlToolExecutor added in v0.0.5

type KubectlToolExecutor struct {
	// contains filtered or unexported fields
}

KubectlToolExecutor handles structured kubectl command execution for grouped tools

func NewKubectlToolExecutor added in v0.0.5

func NewKubectlToolExecutor() *KubectlToolExecutor

NewKubectlToolExecutor creates a new kubectl tool executor

func (*KubectlToolExecutor) Execute added in v0.0.5

func (e *KubectlToolExecutor) Execute(params map[string]interface{}, cfg *config.ConfigData) (string, error)

Execute processes structured kubectl commands with operation/resource/args parameters

func (*KubectlToolExecutor) GetCommandForValidation added in v0.0.5

func (e *KubectlToolExecutor) GetCommandForValidation(operation, resource, args string, toolName string) string

GetCommandForValidation returns the constructed command for security validation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL