Documentation
¶
Index ¶
- Constants
- Variables
- func AbsencePrometheusRuleName(promServer string) string
- func ParseRuleGroups(logger logr.Logger, in []monitoringv1.RuleGroup, promRuleName string, ...) ([]monitoringv1.RuleGroup, error)
- func RegisterMetrics() *prometheus.Registry
- type KeepLabel
- type LabelOpts
- 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.
Variables ¶
var IsTest bool
IsTest is set by the test suite during testing.
Functions ¶
func AbsencePrometheusRuleName ¶
func AbsencePrometheusRuleName(promServer string) string
AbsencePrometheusRuleName returns the name of an AbsencePrometheusRule resource that holds the absence alert rules concerning a specific Prometheus server (e.g. openstack, kubernetes, etc.).
func ParseRuleGroups ¶
func ParseRuleGroups(logger logr.Logger, in []monitoringv1.RuleGroup, promRuleName string, opts LabelOpts) ([]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 original tier and service labels from the alert rules will be carried over to the corresponding absence alerts unless templating (i.e. $labels) was used for these labels in which case the provided default tier and service will be used.
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 KeepLabel ¶
type KeepLabel map[string]bool
KeepLabel specifies which labels to keep on an absence alert rule.
type LabelOpts ¶
type LabelOpts struct {
DefaultSupportGroup string
DefaultTier string
DefaultService string
Keep KeepLabel
}
LabelOpts holds the options that define labels for an absence alert rule.
type PrometheusRuleReconciler ¶
type PrometheusRuleReconciler struct {
client.Client
Scheme *runtime.Scheme
Log logr.Logger
// KeepLabel is a map of labels that will be retained from the original alert rule and
// passed on to its corresponding absent 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://pkgo.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.