alertmanager

package
v0.67.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package alertmanager provides a client for configuring and managing Alertmanager tenants on a Mimir instance.

It implements the Service interface which exposes two operations:

  • [Service.ConfigureFromSecret]: validate and push an Alertmanager configuration stored in a Kubernetes Secret to Mimir.
  • [Service.DeleteForTenant]: remove the Alertmanager configuration for a given tenant from Mimir (idempotent).

The Validate function provides lightweight config+template validation for use in admission webhooks without making any HTTP calls.

Index

Constants

View Source
const (
	// AlertmanagerConfigKey is the key to the alertmanager configuration in the secret.
	AlertmanagerConfigKey = "alertmanager.yaml"
	// TemplatesSuffix is the suffix used to identify the templates in the secret.
	TemplatesSuffix = ".tmpl"

	// AlertmanagerConfigFinalizer is the finalizer added to Alertmanager config secrets.
	// It ensures the config is deleted from Mimir before the secret is garbage collected.
	AlertmanagerConfigFinalizer = "observability.giantswarm.io/alertmanager-config"
)

Variables

This section is empty.

Functions

func Validate

func Validate(secret *v1.Secret) error

Validate checks that the secret contains a valid Alertmanager configuration and that all template files parse correctly. It is the single entry point used by the admission webhook — callers that need the extracted data should use ConfigureFromSecret instead.

Types

type APIError

type APIError struct {
	Code    int
	Message string
}

APIError represents an error response from the Mimir Alertmanager API, capturing the HTTP status code and response body for diagnostics.

func (APIError) Error

func (e APIError) Error() string

type Service

type Service interface {
	// ConfigureFromSecret pushes the Alertmanager configuration stored in secret to Mimir for the given tenant.
	ConfigureFromSecret(ctx context.Context, secret *v1.Secret, tenantID string) error
	// DeleteForTenant removes the Alertmanager configuration for the given tenant from Mimir.
	// It is idempotent: if no configuration exists, it returns nil.
	DeleteForTenant(ctx context.Context, tenantID string) error
}

Service is the interface for configuring Alertmanager.

func New

func New(cfg pkgconfig.Config) Service

Jump to

Keyboard shortcuts

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