analyze

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDrift

func CheckDrift(pod *corev1.Pod) []string

func EstimateCost

func EstimateCost(pod *corev1.Pod) float64

Types

type Analyzer

type Analyzer interface {
	Analyze(ctx context.Context, evidence *Evidence) (*Diagnosis, error)
}

type Diagnosis

type Diagnosis struct {
	RootCause       string
	Suggestion      string
	Explanation     string
	ConfidenceScore float64 // 0.0 to 1.0
}

Diagnosis represents the result of an analysis

type Evidence

type Evidence struct {
	Pod               *corev1.Pod
	Node              *corev1.Node      // Details of the node running the pod
	Events            []corev1.Event    // Events related to the pod
	NamespaceEvents   []corev1.Event    // Recent events in the namespace (for context)
	Logs              map[string]string // ContainerName -> Last N lines of logs
	PreviousLogs      map[string]string // ContainerName -> Last N lines of previous logs (if crashed)
	ConfigWarnings    []string          // Missing ConfigMaps, Secrets, etc.
	NetworkContext    []string          // Services, Endpoints status
	ResourceInfo      []string          // QoS, Limits, OOMKilled history
	ImageAnalysis     []string          // Tag validation, known vulnerabilities
	SecurityAudit     []string          // ServiceAccount, SecurityContext
	Availability      []string          // PDB status
	ChangeDiff        []string          // Diff vs previous revision
	IngressInfo       []string          // Ingress details
	ScalingInfo       []string          // HPA details
	StorageInfo       []string          // PVC details
	SchedulingInfo    []string          // Taints/Affinity
	LifecycleInfo     []string          // Hooks
	ProbeInfo         []string          // Liveness/Readiness issues
	SecretValidation  []string          // Content checks (trailing newlines)
	MeshInfo          []string          // Sidecar status
	InitExitInfo      []string          // Init container exit codes
	OwnerChain        []string          // Hierarchy
	NetPolicyInfo     []string          // Network Policies
	CertInfo          []string          // Certificate expiration
	QuotaInfo         []string          // ResourceQuotas
	LogInsights       []string          // Pattern matching results
	AffinityInfo      []string          // Node/Pod Affinity
	PSAInfo           []string          // Pod Security Admission
	SpreadInfo        []string          // Topology Spread
	PriorityInfo      []string          // PriorityClass
	FinalizerInfo     []string          // Finalizers
	DNSInfo           []string          // CoreDNS status
	NodeExtInfo       []string          // Kernel, Runtime, Pressure
	SecurityExtInfo   []string          // Caps, Seccomp, AppArmor
	VolumeExtInfo     []string          // HostPath, HugePages, DownwardAPI
	ServiceExtInfo    []string          // Port mismatch, LB status
	IngressExtInfo    []string          // TLS, Class
	ConfigSyntaxInfo  []string          // JSON/YAML validation
	PodStateExtInfo   []string          // Zombie, Backoff
	ControllerExtInfo []string          // Deployment strategy, CronJob
	LocalDocs         string            // Content of local troubleshooting docs
	SourceSnippets    []Snippet         // Code snippets linked from stack traces
	Manifest          string            // YAML representation (optional)
}

Evidence collects all relevant data for analysis

func GatherEvidence

func GatherEvidence(ctx context.Context, client kubernetes.Interface, namespace, podName string) (*Evidence, error)

GatherEvidence collects data from the cluster

type HeuristicAnalyzer

type HeuristicAnalyzer struct{}

func NewHeuristicAnalyzer

func NewHeuristicAnalyzer() *HeuristicAnalyzer

func (*HeuristicAnalyzer) Analyze

func (a *HeuristicAnalyzer) Analyze(ctx context.Context, evidence *Evidence) (*Diagnosis, error)

type Snippet

type Snippet struct {
	File    string
	Line    int
	Content string // Contextual lines around the error
}

Snippet represents a piece of source code related to a log error

func FindSourceSnippets

func FindSourceSnippets(logs string) []Snippet

Jump to

Keyboard shortcuts

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