mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-06-02 20:15:36 +00:00
62 lines
1.5 KiB
Go
62 lines
1.5 KiB
Go
package common
|
|
|
|
import (
|
|
"context"
|
|
|
|
trivy "github.com/aquasecurity/trivy-operator/pkg/apis/aquasecurity/v1alpha1"
|
|
"github.com/k8sgpt-ai/k8sgpt/pkg/ai"
|
|
"github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes"
|
|
appsv1 "k8s.io/api/apps/v1"
|
|
autov1 "k8s.io/api/autoscaling/v1"
|
|
v1 "k8s.io/api/core/v1"
|
|
networkv1 "k8s.io/api/networking/v1"
|
|
policyv1 "k8s.io/api/policy/v1"
|
|
)
|
|
|
|
type IAnalyzer interface {
|
|
Analyze(analysis Analyzer) ([]Result, error)
|
|
}
|
|
|
|
type Analyzer struct {
|
|
Client *kubernetes.Client
|
|
Context context.Context
|
|
Namespace string
|
|
AIClient ai.IAI
|
|
PreAnalysis map[string]PreAnalysis
|
|
Results []Result
|
|
}
|
|
|
|
type PreAnalysis struct {
|
|
Pod v1.Pod
|
|
FailureDetails []Failure
|
|
Deployment appsv1.Deployment
|
|
ReplicaSet appsv1.ReplicaSet
|
|
PersistentVolumeClaim v1.PersistentVolumeClaim
|
|
Endpoint v1.Endpoints
|
|
Ingress networkv1.Ingress
|
|
HorizontalPodAutoscalers autov1.HorizontalPodAutoscaler
|
|
PodDisruptionBudget policyv1.PodDisruptionBudget
|
|
StatefulSet appsv1.StatefulSet
|
|
NetworkPolicy networkv1.NetworkPolicy
|
|
// Integrations
|
|
TrivyVulnerabilityReport trivy.VulnerabilityReport
|
|
}
|
|
|
|
type Result struct {
|
|
Kind string `json:"kind"`
|
|
Name string `json:"name"`
|
|
Error []Failure `json:"error"`
|
|
Details string `json:"details"`
|
|
ParentObject string `json:"parentObject"`
|
|
}
|
|
|
|
type Failure struct {
|
|
Text string
|
|
Sensitive []Sensitive
|
|
}
|
|
|
|
type Sensitive struct {
|
|
Unmasked string
|
|
Masked string
|
|
}
|