namespacelabeler

package
v0.59.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Labeler

type Labeler struct {
	// contains filtered or unexported fields
}

Labeler enables to enforce adding namespace labels to PrometheusRules and to metrics used in them

func New

func New(enforcedNsLabel string, excludeConfig []monitoringv1.ObjectReference, prometheusRuleLabeler bool) *Labeler

New - creates new Labeler enforcedNsLabel - label name to be enforced for namespace excludeConfig - list of ObjectReference to be excluded while enforcing adding namespace label prometheusRuleLabeler - whether this should apply for Prometheus or Thanos rules

func (*Labeler) EnforceNamespaceLabel

func (l *Labeler) EnforceNamespaceLabel(rule *monitoringv1.PrometheusRule) error

EnforceNamespaceLabel - adds(or modifies) namespace label to promRule labels with specified namespace and also adds namespace label to all the metrics used in promRule

func (*Labeler) GetEnforcedNamespaceLabel added in v0.56.0

func (l *Labeler) GetEnforcedNamespaceLabel() string

func (*Labeler) GetRelabelingConfigs added in v0.56.0

func (l *Labeler) GetRelabelingConfigs(monitorTypeMeta metav1.TypeMeta, monitorObjectMeta metav1.ObjectMeta, rc []*monitoringv1.RelabelConfig) []*monitoringv1.RelabelConfig

GetRelabelingConfigs - append the namespace enforcement relabeling rule

func (*Labeler) IsExcluded added in v0.56.0

func (l *Labeler) IsExcluded(prometheusTypeMeta metav1.TypeMeta, prometheusObjectMeta metav1.ObjectMeta) bool

IsExcluded returns true if the specified object is excluded from namespace enforcement, false otherwise

Jump to

Keyboard shortcuts

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