Documentation
¶
Index ¶
- Constants
- Variables
- func CheckCronScheduleIsValid(schedule string) (bool, error)
- func EnsureDirExists(dir string) error
- func FetchLatestEvent(ctx context.Context, kubernetesClient *Client, namespace string, name string) (*v1.Event, error)
- func FileExists(path string) (bool, error)
- func GetAnalyzerMap() (map[string]IAnalyzer, map[string]IAnalyzer)
- func GetParent(client *Client, meta metav1.ObjectMeta) (string, bool)
- func GetPodListByLabels(client k.Interface, namespace string, labels map[string]string) (*v1.PodList, error)
- func ListFilters() ([]string, []string, []string)
- func MaskString(input string) string
- func RemoveDuplicates(slice []string) ([]string, []string)
- func ReplaceIfMatch(text string, pattern string, replacement string) string
- func SliceContainsString(slice []string, s string) bool
- func SliceDiff(source, dest []string) []string
- type Analysis
- type AnalysisErrors
- type AnalysisStatus
- type Analyzer
- type Client
- type CronJobAnalyzer
- type DeploymentAnalyzer
- type DeploymentInfo
- type Failure
- type HpaAnalyzer
- type IAnalyzer
- type IngressAnalyzer
- type JsonOutput
- type NetworkPolicyAnalyzer
- type NodeAnalyzer
- type PdbAnalyzer
- type PodAnalyzer
- type PodInfo
- type PreAnalysis
- type PvcAnalyzer
- type ReplicaSetAnalyzer
- type ReplicaSetInfo
- type ReplicationControllerInfo
- type Result
- type Sensitive
- type ServiceAnalyzer
- type StatefulSetAnalyzer
- type StatefulSetInfo
Constants ¶
View Source
const (
NormalResultOutput string = "没有检测到问题"
)
Variables ¶
View Source
var ( AnalyzerErrorsMetric = promauto.NewGaugeVec(prometheus.GaugeOpts{ Name: "analyzer_errors", Help: "Number of errors detected by analyzer", }, []string{"analyzer_name", "object_name", "namespace"}) )
Functions ¶
func CheckCronScheduleIsValid ¶
Check CRON schedule format
func EnsureDirExists ¶
func FetchLatestEvent ¶
func FileExists ¶
func GetPodListByLabels ¶
func ListFilters ¶
func MaskString ¶
func RemoveDuplicates ¶
func SliceContainsString ¶
Types ¶
type Analysis ¶
type Analysis struct {
Context context.Context
Filters []string
Client *Client
AIClient llm.ILLM
Results []Result
Errors []string
Namespace string
Cache cache.ICache
Explain bool
MaxConcurrency int
AnalysisAIProvider string // The name of the AI Provider used for this analysis
WithDoc bool
}
func NewAnalysis ¶
func (*Analysis) GetAIResults ¶
func (*Analysis) RunAnalysis ¶
type AnalysisErrors ¶
type AnalysisErrors []string
type AnalysisStatus ¶
type AnalysisStatus string
const ( StateOK AnalysisStatus = "OK" StateProblemDetected AnalysisStatus = "ProblemDetected" )
type Client ¶
type Client struct {
Client kubernetes.Interface
RestClient rest.Interface
Config *rest.Config
ServerVersion *version.Info
}
func (*Client) GetClient ¶
func (c *Client) GetClient() kubernetes.Interface
func (*Client) GetRestClient ¶
type CronJobAnalyzer ¶
type CronJobAnalyzer struct{}
type DeploymentAnalyzer ¶
type DeploymentAnalyzer struct {
}
DeploymentAnalyzer is an analyzer that checks for misconfigured Deployments
type DeploymentInfo ¶
type DeploymentInfo struct {
*appsv1.Deployment
}
func (DeploymentInfo) GetPodSpec ¶
func (d DeploymentInfo) GetPodSpec() corev1.PodSpec
type HpaAnalyzer ¶
type HpaAnalyzer struct{}
type IngressAnalyzer ¶
type IngressAnalyzer struct{}
type JsonOutput ¶
type JsonOutput struct {
Provider string `json:"provider"`
Errors AnalysisErrors `json:"errors"`
Status AnalysisStatus `json:"status"`
Problems int `json:"problems"`
Results []Result `json:"results"`
}
type NetworkPolicyAnalyzer ¶
type NetworkPolicyAnalyzer struct{}
type NodeAnalyzer ¶
type NodeAnalyzer struct{}
type PdbAnalyzer ¶
type PdbAnalyzer struct{}
type PodAnalyzer ¶
type PodAnalyzer struct {
}
type PreAnalysis ¶
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
Node v1.Node
}
type PvcAnalyzer ¶
type PvcAnalyzer struct{}
type ReplicaSetAnalyzer ¶
type ReplicaSetAnalyzer struct{}
type ReplicaSetInfo ¶
type ReplicaSetInfo struct {
*appsv1.ReplicaSet
}
define a structure for ReplicaSet
func (ReplicaSetInfo) GetPodSpec ¶
func (rs ReplicaSetInfo) GetPodSpec() corev1.PodSpec
type ReplicationControllerInfo ¶
type ReplicationControllerInfo struct {
*corev1.ReplicationController
}
define a structure for ReplicationController
func (ReplicationControllerInfo) GetPodSpec ¶
func (rc ReplicationControllerInfo) GetPodSpec() corev1.PodSpec
type ServiceAnalyzer ¶
type ServiceAnalyzer struct{}
type StatefulSetAnalyzer ¶
type StatefulSetAnalyzer struct{}
type StatefulSetInfo ¶
type StatefulSetInfo struct {
*appsv1.StatefulSet
}
define a structure for StatefulSet
func (StatefulSetInfo) GetPodSpec ¶
func (ss StatefulSetInfo) GetPodSpec() corev1.PodSpec
implement PodInfo for StatefulSetInfo
Click to show internal directories.
Click to hide internal directories.