Documentation
¶
Index ¶
- Constants
- Variables
- func AbsenceRuleGroupName(promRule, ruleGroup string) string
- func ParseRuleGroups(logger logr.Logger, in []monitoringv1.RuleGroup, promRuleName string, ...) ([]monitoringv1.RuleGroup, error)
- func RegisterMetrics() *prometheus.Registry
- type AbsencePromRuleNameGenerator
- type KeepLabel
- type PrometheusRuleReconciler
Constants ¶
const ( LabelCCloudSupportGroup = "ccloud/support-group" LabelCCloudService = "ccloud/service" LabelSupportGroup = "support_group" LabelTier = "tier" LabelService = "service" )
These constants are exported for reusability across packages.
const (
DefaultAbsencePromRuleNameTemplate = `` /* 149-byte string literal not displayed */
)
Variables ¶
var IsTest bool
IsTest is set by the test suite during testing.
Functions ¶
func AbsenceRuleGroupName ¶ added in v0.9.6
AbsenceRuleGroupName returns the name of the RuleGroup that holds absence alert rules for a specific RuleGroup in a specific PrometheusRule.
func ParseRuleGroups ¶
func ParseRuleGroups(logger logr.Logger, in []monitoringv1.RuleGroup, promRuleName string, keepLabel KeepLabel) ([]monitoringv1.RuleGroup, error)
ParseRuleGroups takes a slice of RuleGroup that has alert rules and returns a new slice of RuleGroup that has the corresponding absence alert rules.
The labels specified in the keepLabel map will be carried over to the corresponding absence alerts unless templating (i.e. $labels) was used for these labels.
The rule group names for the absence alerts have the format: promRuleName/originalGroupName.
func RegisterMetrics ¶
func RegisterMetrics() *prometheus.Registry
RegisterMetrics registers all the metrics. If IsTest is true then it will also return a *prometheus.Registry than can be used in the test suite otherwise nil is returned.
Types ¶
type AbsencePromRuleNameGenerator ¶ added in v0.9.6
type AbsencePromRuleNameGenerator func(*monitoringv1.PrometheusRule) (string, error)
AbsencePromRuleNameGenerator is a function type that takes a PrometheusRule and generates a name for its corresponding PrometheusRule that holds the generated absence alert rules.
func CreateAbsencePromRuleNameGenerator ¶ added in v0.9.6
func CreateAbsencePromRuleNameGenerator(tmplStr string) (AbsencePromRuleNameGenerator, error)
CreateAbsencePromRuleNameGenerator creates an absencePromRuleNameGenerator function based on a template string.
type PrometheusRuleReconciler ¶
type PrometheusRuleReconciler struct { client.Client Scheme *runtime.Scheme Log logr.Logger PrometheusRuleName AbsencePromRuleNameGenerator // KeepLabel is a map of labels that will be retained from the original alert rule and // passed on to its corresponding absence alert rule. KeepLabel KeepLabel }
PrometheusRuleReconciler reconciles a PrometheusRule object.
func (*PrometheusRuleReconciler) Reconcile ¶
func (r *PrometheusRuleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile is part of the main Kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.11.0/pkg/reconcile
func (*PrometheusRuleReconciler) SetupWithManager ¶
func (r *PrometheusRuleReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.