kubecontroller

package
v0.0.0-...-e8427ed Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(config HandlerConfig) (controller.Handler, error)

func NewPrometheusServiceLevelsRetriver

func NewPrometheusServiceLevelsRetriver(ns string, labelSelector labels.Selector, repo RetrieverKubernetesRepository) controller.Retriever

NewPrometheusServiceLevelsRetriver returns the retriever for Prometheus service levels events.

Types

type Generator

type Generator interface {
	Generate(ctx context.Context, r generate.Request) (*generate.Response, error)
}

Generator Knows how to generate SLO prometheus rules from app SLO model.

type HandlerConfig

type HandlerConfig struct {
	Generator        Generator
	SpecLoader       SpecLoader
	Repository       Repository
	KubeStatusStorer KubeStatusStorer
	ExtraLabels      map[string]string
	// IgnoreHandleBefore makes the handles of objects with a success state and no spec change,
	// be ignored if the last success is less than this setting.
	// Be aware that this setting should be less than the controller resync interval.
	IgnoreHandleBefore time.Duration
	Logger             log.Logger
}

HandlerConfig is the controller handler configuration.

type KubeStatusStorer

type KubeStatusStorer interface {
	EnsurePrometheusServiceLevelStatus(ctx context.Context, slo *slothv1.PrometheusServiceLevel, err error) error
}

KubeStatusStorer knows how to set the status of Prometheus service levels Kubernetes CRD.

type Repository

type Repository interface {
	StoreSLOs(ctx context.Context, kmeta k8sprometheus.K8sMeta, slos []k8sprometheus.StorageSLO) error
}

Repository knows how to store generated SLO Prometheus rules.

type RetrieverKubernetesRepository

type RetrieverKubernetesRepository interface {
	ListPrometheusServiceLevels(ctx context.Context, ns string, opts metav1.ListOptions) (*slothv1.PrometheusServiceLevelList, error)
	WatchPrometheusServiceLevels(ctx context.Context, ns string, opts metav1.ListOptions) (watch.Interface, error)
}

RetrieverKubernetesRepository is the service to manage k8s resources by the Kubernetes controller retrievers.

type SpecLoader

type SpecLoader interface {
	LoadSpec(ctx context.Context, spec *slothv1.PrometheusServiceLevel) (*k8sprometheus.SLOGroup, error)
}

SpecLoader Knows how to load a Kubernetes Spec into an app model.

Jump to

Keyboard shortcuts

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