config

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventHandlerConfig

type EventHandlerConfig struct {
	Enabled      bool          // 是否启用事件处理器
	Watcher      WatcherConfig // Watcher配置
	Worker       WorkerConfig  // Worker配置
	EventConfigs []models.K8sEventConfig
	ClusterRules map[string]RuleConfig // 集群级规则配置;key 为集群ID/名称,value 为该集群的事件过滤规则
	Webhooks     map[string][]string   // WebhookID列表,key 为集群ID/名称,value 为该集群的WebhookID列表
}

EventHandlerConfig 中文函数注释:定义事件处理器的完整配置。

func DefaultEventHandlerConfig

func DefaultEventHandlerConfig() *EventHandlerConfig

DefaultEventHandlerConfig 中文函数注释:创建默认的事件处理器配置。

func LoadAllFromDB

func LoadAllFromDB() *EventHandlerConfig

LoadAllFromDB 中文函数注释: 1. 读取所有启用的 K8sEventConfig 记录; 2. Worker/Watcher 等运行参数从插件配置表中加载; 3. 若不存在启用规则,则返回 nil 交由上层使用默认配置。

type RuleConfig

type RuleConfig struct {
	Namespaces []string `json:"namespaces" yaml:"namespaces"` // 命名空间白名单/黑名单
	Names      []string `json:"names" yaml:"names"`           // 命名白名单/黑名单
	Reasons    []string `json:"reasons" yaml:"reasons"`       // 原因匹配
	Reverse    bool     `json:"reverse" yaml:"reverse"`       // 反向选择开关
}

RuleConfig 中文函数注释:定义事件过滤规则配置。

func (*RuleConfig) IsEmpty

func (r *RuleConfig) IsEmpty() bool

IsEmpty 中文函数注释:判断规则配置是否为空。

type WatcherConfig

type WatcherConfig struct {
	BufferSize int `json:"buffer_size" yaml:"buffer_size"` // 事件缓冲区大小
}

WatcherConfig 中文函数注释:Watcher配置。

type WorkerConfig

type WorkerConfig struct {
	BatchSize       int `json:"batch_size" yaml:"batch_size"`             // 批处理大小
	ProcessInterval int `json:"process_interval" yaml:"process_interval"` // 处理间隔(秒)
	MaxRetries      int `json:"max_retries" yaml:"max_retries"`           // 最大重试次数
}

WorkerConfig 中文函数注释:Worker配置。

Jump to

Keyboard shortcuts

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