alerting

package
v0.0.0-...-be065d1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuleLevelNamesapce RuleLevel = "namespace"
	RuleLevelCluster   RuleLevel = "cluster"
	RuleLevelGlobal    RuleLevel = "global"

	RuleTypeTemplate RuleType = "template" // for template rule configured by exprBuilder to build expression
	RuleTypeCustom   RuleType = "custom"   // for custom rule configured by direct expression

	// for rule.labels
	RuleLabelKeyRuleLevel         = "rule_level"
	RuleLabelKeyRuleGroup         = "rule_group"
	RuleLabelKeyRuleType          = "rule_type"
	RuleLabelKeyCluster           = "cluster"
	RuleLabelKeyNamespace         = "namespace"
	RuleLabelKeySeverity          = "severity"
	RuleLabelKeyAlertType         = "alerttype"
	RuleLabelValueAlertTypeMetric = "metric"

	// label keys in RuleGroup/ClusterRuleGroup/GlobalRuleGroup.metadata.labels
	SourceGroupResourceLabelKeyEnable        = "alerting.kubesphere.io/enable"
	SourceGroupResourceLabelValueEnableTrue  = "true"
	SourceGroupResourceLabelValueEnableFalse = "false"

	// for PrometheusRule.metadata.labels
	PrometheusRuleResourceLabelKeyOwnerNamespace = "alerting.kubesphere.io/owner_namespace"
	PrometheusRuleResourceLabelKeyOwnerCluster   = "alerting.kubesphere.io/owner_cluster"
	PrometheusRuleResourceLabelKeyRuleLevel      = "alerting.kubesphere.io/rule_level"
	PrometheusRuleResourceLabelKeyBuiltin        = "alerting.kubesphere.io/builtin"
	PrometheusRuleResourceLabelValueBuiltinTrue  = "true"
	PrometheusRuleResourceLabelValueBuiltinFalse = "false"

	// name prefix for PrometheusRule
	PrometheusRulePrefix               = "alertrules-"
	PrometheusRulePrefixNamespaceLevel = PrometheusRulePrefix + "ns-"
	PrometheusRulePrefixClusterLevel   = PrometheusRulePrefix + "cl-"
	PrometheusRulePrefixGlobalLevel    = PrometheusRulePrefix + "gl-"

	PrometheusRuleNamespace = constants.KubeSphereMonitoringNamespace
)

Variables

This section is empty.

Functions

func ParseGlobalRuleEnforceMatchers

func ParseGlobalRuleEnforceMatchers(rule *alertingv2beta1.GlobalRule) []*promlabels.Matcher

Types

type ClusterRuleGroupReconciler

type ClusterRuleGroupReconciler struct {
	client.Client

	Log logr.Logger
}

func (*ClusterRuleGroupReconciler) Reconcile

func (*ClusterRuleGroupReconciler) SetupWithManager

func (r *ClusterRuleGroupReconciler) SetupWithManager(mgr ctrl.Manager) error

type EnforceExprFunc

type EnforceExprFunc func(expr string) (string, error)

func CreateEnforceExprFunc

func CreateEnforceExprFunc(enforceRuleMatchers []*promlabels.Matcher) EnforceExprFunc

type GlobalRuleGroupReconciler

type GlobalRuleGroupReconciler struct {
	client.Client

	Log logr.Logger
}

func (*GlobalRuleGroupReconciler) Reconcile

func (*GlobalRuleGroupReconciler) SetupWithManager

func (r *GlobalRuleGroupReconciler) SetupWithManager(mgr ctrl.Manager) error

type RuleGroupReconciler

type RuleGroupReconciler struct {
	client.Client

	Log logr.Logger
}

func (*RuleGroupReconciler) Reconcile

func (*RuleGroupReconciler) SetupWithManager

func (r *RuleGroupReconciler) SetupWithManager(mgr ctrl.Manager) error

type RuleLevel

type RuleLevel string

type RuleType

type RuleType string

Jump to

Keyboard shortcuts

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