Documentation
¶
Overview ¶
Package compute provides handler functions for Azure compute resource tools.
Index ¶
- Constants
- func CollectAKSNodeLogsHandler(client *azureclient.AzureClient, cfg *config.ConfigData) tools.ResourceHandler
- func GetAKSVMSSInfoHandler(client *azureclient.AzureClient, cfg *config.ConfigData) tools.ResourceHandler
- func GetNodePoolsFromAKS(ctx context.Context, cluster *armcontainerservice.ManagedCluster, ...) ([]*armcontainerservice.ManagedClusterAgentPoolProfile, error)
- func GetOperationAccessLevel(operation string) string
- func GetVMSSIDFromNodePool(ctx context.Context, cluster *armcontainerservice.ManagedCluster, ...) (string, error)
- func GetVMSSInstancesFromNodePool(ctx context.Context, cluster *armcontainerservice.ManagedCluster, ...) ([]interface{}, error)
- func MapOperationToCommand(operation string, resourceType string) (string, error)
- func RegisterAKSVMSSInfoTool() mcp.Tool
- func RegisterAzComputeOperations(cfg *config.ConfigData) mcp.Tool
- func RegisterCollectAKSNodeLogsTool() mcp.Tool
- func ValidateOperationAccess(operation string, cfg *config.ConfigData) error
- type ComputeOperationType
- type ComputeOperationsExecutor
- type ResourceType
- type VMRunCommandExecutor
Constants ¶
const ( // VM operations - safe operations only OpVMShow ComputeOperationType = "show" OpVMList ComputeOperationType = "list" OpVMStart ComputeOperationType = "start" OpVMStop ComputeOperationType = "stop" OpVMRestart ComputeOperationType = "restart" OpVMGetInstanceView ComputeOperationType = "get-instance-view" // VMSS operations - only safe operations for AKS-managed VMSS OpVMSSShow ComputeOperationType = "show" OpVMSSList ComputeOperationType = "list" OpVMSSRestart ComputeOperationType = "restart" OpVMSSReimage ComputeOperationType = "reimage" OpVMSSGetInstanceView ComputeOperationType = "get-instance-view" // Resource types ResourceTypeVM ResourceType = "vm" ResourceTypeVMSS ResourceType = "vmss" )
const ( // Maximum number of log lines to prevent overwhelming output DefaultLogLines = 500 MaxLogLines = 2000 // Log types LogTypeKubelet = "kubelet" LogTypeContainerd = "containerd" LogTypeKernel = "kernel" LogTypeSyslog = "syslog" // Log levels LogLevelError = "ERROR" LogLevelWarn = "WARN" LogLevelInfo = "INFO" )
Variables ¶
This section is empty.
Functions ¶
func CollectAKSNodeLogsHandler ¶ added in v0.0.15
func CollectAKSNodeLogsHandler(client *azureclient.AzureClient, cfg *config.ConfigData) tools.ResourceHandler
CollectAKSNodeLogsHandler returns a handler for the collect_aks_node_logs tool
func GetAKSVMSSInfoHandler ¶
func GetAKSVMSSInfoHandler(client *azureclient.AzureClient, cfg *config.ConfigData) tools.ResourceHandler
GetAKSVMSSInfoHandler returns a handler for the get_aks_vmss_info command
func GetNodePoolsFromAKS ¶
func GetNodePoolsFromAKS( ctx context.Context, cluster *armcontainerservice.ManagedCluster, client *azureclient.AzureClient, ) ([]*armcontainerservice.ManagedClusterAgentPoolProfile, error)
GetNodePoolsFromAKS extracts all node pools from an AKS cluster
func GetOperationAccessLevel ¶ added in v0.0.6
GetOperationAccessLevel returns the required access level for an operation
func GetVMSSIDFromNodePool ¶
func GetVMSSIDFromNodePool( ctx context.Context, cluster *armcontainerservice.ManagedCluster, nodePoolName string, client *azureclient.AzureClient, ) (string, error)
GetVMSSIDFromNodePool extracts the VMSS resource ID from a node pool
func GetVMSSInstancesFromNodePool ¶
func GetVMSSInstancesFromNodePool( ctx context.Context, cluster *armcontainerservice.ManagedCluster, nodePoolName string, client *azureclient.AzureClient, ) ([]interface{}, error)
GetVMSSInstancesFromNodePool gets VM instances from a VMSS for a specific node pool
func MapOperationToCommand ¶ added in v0.0.6
MapOperationToCommand maps an operation and resource type to its corresponding az command
func RegisterAKSVMSSInfoTool ¶
RegisterAKSVMSSInfoTool registers the get_aks_vmss_info tool
func RegisterAzComputeOperations ¶ added in v0.0.6
func RegisterAzComputeOperations(cfg *config.ConfigData) mcp.Tool
RegisterAzComputeOperations registers the unified compute operations tool
func RegisterCollectAKSNodeLogsTool ¶ added in v0.0.15
RegisterCollectAKSNodeLogsTool registers the collect_aks_node_logs tool
func ValidateOperationAccess ¶ added in v0.0.6
func ValidateOperationAccess(operation string, cfg *config.ConfigData) error
ValidateOperationAccess checks if the operation is allowed for the given access level
Types ¶
type ComputeOperationType ¶ added in v0.0.6
type ComputeOperationType string
ComputeOperationType defines the type of compute operation
type ComputeOperationsExecutor ¶ added in v0.0.6
type ComputeOperationsExecutor struct{}
ComputeOperationsExecutor handles execution of compute operations
func NewComputeOperationsExecutor ¶ added in v0.0.6
func NewComputeOperationsExecutor() *ComputeOperationsExecutor
NewComputeOperationsExecutor creates a new ComputeOperationsExecutor
func (*ComputeOperationsExecutor) Execute ¶ added in v0.0.6
func (e *ComputeOperationsExecutor) Execute(ctx context.Context, params map[string]interface{}, cfg *config.ConfigData) (string, error)
Execute handles the compute operations
type ResourceType ¶ added in v0.0.6
type ResourceType string
ResourceType defines the compute resource type
type VMRunCommandExecutor ¶ added in v0.0.15
type VMRunCommandExecutor struct {
// contains filtered or unexported fields
}
VMRunCommandExecutor executes commands on VMSS instances using Azure Run Command
func NewVMRunCommandExecutor ¶ added in v0.0.15
func NewVMRunCommandExecutor(azClient *azureclient.AzureClient) *VMRunCommandExecutor
NewVMRunCommandExecutor creates a new VMRunCommandExecutor
func (*VMRunCommandExecutor) ExecuteOnVMSSInstance ¶ added in v0.0.15
func (e *VMRunCommandExecutor) ExecuteOnVMSSInstance( ctx context.Context, subscriptionID, resourceGroup, vmssName, instanceID string, command string, ) (string, error)
ExecuteOnVMSSInstance executes a shell command on a specific VMSS instance