Documentation
¶
Overview ¶
Package agent provides the core Copilot agent functionality for Kubernetes cluster operations. It implements an interactive agent using the GitHub Copilot SDK that can monitor, query, and manage Kubernetes clusters through natural language interactions.
Package agent provides the core Copilot agent functionality for Kubernetes cluster operations. This file contains tool definitions and related helpers.
Package agent provides enhanced kubectl command validation. This file contains security and safety checks for kubectl command execution.
Index ¶
- Variables
- func Run(k8sProvider *k8s.Provider, mode ExecutionMode, outputFormat OutputFormat, ...) error
- type AgentType
- type CheckAllClustersParams
- type CheckAllClustersResult
- type CheckAllClustersSummary
- type CompareClusterParams
- type CompareClustersResult
- type CompareClustersSummary
- type ComparisonData
- type ExecutionMode
- type GetClusterStatusParams
- type KubectlExecParams
- type KubectlExecResult
- type ListClustersParams
- type ListClustersResult
- type OutputFormat
Constants ¶
This section is empty.
Variables ¶
var AppVersion = "dev"
Version information for display
Functions ¶
func Run ¶
func Run(k8sProvider *k8s.Provider, mode ExecutionMode, outputFormat OutputFormat, agentType AgentType) error
Run starts the Copilot agent with Kubernetes cluster tools
Types ¶
type AgentType ¶ added in v0.3.0
type AgentType string
AgentType defines the specialized agent persona
const ( // AgentDefault uses the standard Kopilot persona AgentDefault AgentType = "default" // AgentDebugger specializes in root cause analysis and failure diagnosis AgentDebugger AgentType = "debugger" // AgentSecurity specializes in RBAC auditing, privilege escalation, and CVE detection AgentSecurity AgentType = "security" // AgentOptimizer specializes in resource right-sizing and cost optimization AgentOptimizer AgentType = "optimizer" // AgentGitOps specializes in Flux/ArgoCD sync status and drift detection AgentGitOps AgentType = "gitops" )
func ParseAgentType ¶ added in v0.3.0
ParseAgentType converts a string to an AgentType, returning an error for unknown values
type CheckAllClustersParams ¶
type CheckAllClustersParams struct{}
CheckAllClustersParams defines no parameters for check_all_clusters
type CheckAllClustersResult ¶
type CheckAllClustersResult struct {
Summary CheckAllClustersSummary `json:"summary"`
Issues []string `json:"issues"`
Clusters []*k8s.ClusterStatus `json:"clusters"`
}
CheckAllClustersResult defines JSON output for check_all_clusters
type CheckAllClustersSummary ¶
type CheckAllClustersSummary struct {
TotalClusters int `json:"total_clusters"`
Reachable int `json:"reachable"`
FullyHealthy int `json:"fully_healthy"`
UnhealthyPods int `json:"unhealthy_pods"`
}
CheckAllClustersSummary defines JSON output summary for check_all_clusters
type CompareClusterParams ¶
type CompareClusterParams struct {
Contexts []string `json:"contexts" jsonschema:"Array of context names to compare (from list_clusters), minimum 2 required"`
}
CompareClusterParams defines parameters for compare_clusters
type CompareClustersResult ¶
type CompareClustersResult struct {
Summary CompareClustersSummary `json:"summary"`
Clusters []ComparisonData `json:"clusters"`
}
CompareClustersResult defines JSON output for compare_clusters
type CompareClustersSummary ¶
CompareClustersSummary defines summary JSON output for compare_clusters
type ComparisonData ¶
type ComparisonData struct {
Context string
Name string
Status string
Version string
Nodes string
HealthyNodes string
APIServer string
Error string
}
ComparisonData holds comparison information for a cluster
type ExecutionMode ¶
type ExecutionMode int
ExecutionMode defines how kubectl commands are executed
const ( // ModeReadOnly blocks all write operations ModeReadOnly ExecutionMode = iota // ModeInteractive asks for confirmation before write operations ModeInteractive )
func (ExecutionMode) String ¶
func (m ExecutionMode) String() string
String returns a human-readable name for the execution mode
type GetClusterStatusParams ¶
type GetClusterStatusParams struct {
Context string `json:"context" jsonschema:"The context name of the cluster to query (from list_clusters)"`
}
GetClusterStatusParams defines parameters for get_cluster_status
type KubectlExecParams ¶
type KubectlExecParams struct {
Context string `json:"context" jsonschema:"The cluster context name to execute against (required)"`
Args []string `json:"args" jsonschema:"The kubectl command arguments (e.g., ['get', 'pods', '-n', 'default'])"`
}
KubectlExecParams defines parameters for kubectl_exec
type KubectlExecResult ¶
type KubectlExecResult struct {
Cluster string `json:"cluster"`
Context string `json:"context"`
Command string `json:"command"`
Output string `json:"output"`
ExitCode *int `json:"exit_code,omitempty"`
Error string `json:"error,omitempty"`
}
KubectlExecResult defines JSON output for kubectl_exec
type ListClustersParams ¶
type ListClustersParams struct{}
ListClustersParams defines no parameters for list_clusters
type ListClustersResult ¶
type ListClustersResult struct {
CurrentContext string `json:"current_context"`
Clusters []*k8s.ClusterInfo `json:"clusters"`
}
ListClustersResult defines JSON output for list_clusters
type OutputFormat ¶
type OutputFormat string
OutputFormat defines the output format for tool responses
const ( // OutputText returns human-readable output OutputText OutputFormat = "text" // OutputJSON returns JSON output OutputJSON OutputFormat = "json" )