controllers

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelCCloudSupportGroup = "ccloud/support-group"
	LabelCCloudService      = "ccloud/service"

	LabelSupportGroup = "support_group"
	LabelTier         = "tier"
	LabelService      = "service"
)

These constants are exported for reusability across packages.

Variables

View Source
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

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.

Jump to

Keyboard shortcuts

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