crd

package
v0.0.0-...-1483051 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package crd handles Managed Prometheus Custom Resource Definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	Name     string `yaml:"name"`
	Interval string `yaml:"interval"`
	Rules    []Rule `yaml:"rules"`
}

Group of Rules.

type MetaData

type MetaData struct {
	Name      string `yaml:"name"`
	Namespace string `yaml:"namespace,omitempty"`
}

MetaData for the Rules CRD.

type Rule

type Rule struct {
	Alert       string            `yaml:"alert"`
	Expr        string            `yaml:"expr"`
	For         string            `yaml:"for,omitempty"`
	Labels      map[string]string `yaml:"labels"`
	Annotations map[string]string `yaml:"annotations"`
}

Rule is a single Prometheus Alert.

func (Rule) Include

func (r Rule) Include(cluster string) bool

Include returns true if the alert should be applied to the given cluster.

type Rules

type Rules struct {
	Version  string   `yaml:"apiVersion"`
	Kind     string   `yaml:"kind"`
	MetaData MetaData `yaml:"metadata"`
	Spec     Spec     `yaml:"spec"`
}

Rules Custom Resource representation.

In theory we should be able to import this from the Managed Prometheus repo, but they don't currently provide a separate repo with just the json annotated structs.

func (*Rules) AddAbsentRules

func (r *Rules) AddAbsentRules(cluster string)

AddAbsentRules adds an `absent()` alert for each Rule, where possible.

type Spec

type Spec struct {
	Groups []Group `yaml:"groups"`
}

Spec for parsing the yaml format of Prometheus alerts.

Jump to

Keyboard shortcuts

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