Documentation ¶
Index ¶
- Variables
- type CRSpecLoader
- type IOWriterPrometheusOperatorYAMLRepo
- type K8sMeta
- type KubernetesService
- func (k KubernetesService) EnsurePrometheusRule(ctx context.Context, pr *monitoringv1.PrometheusRule) error
- func (k KubernetesService) EnsurePrometheusServiceLevelStatus(ctx context.Context, slo *slothv1.PrometheusServiceLevel, err error) error
- func (k KubernetesService) ListPrometheusServiceLevels(ctx context.Context, ns string, labelSelector map[string]string) (*slothv1.PrometheusServiceLevelList, error)
- func (k KubernetesService) WatchPrometheusServiceLevels(ctx context.Context, ns string, labelSelector map[string]string) (watch.Interface, error)
- type PrometheusOperatorCRDRepo
- type PrometheusRulesEnsurer
- type SLOGroup
- type StorageSLO
- type YAMLSpecLoader
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoSLORules will be used when there are no rules to store. The upper layer // could ignore or handle the error in cases where there wasn't an output. ErrNoSLORules = fmt.Errorf("0 SLO Prometheus rules generated") )
Functions ¶
This section is empty.
Types ¶
type CRSpecLoader ¶ added in v0.2.0
type CRSpecLoader struct {
// contains filtered or unexported fields
}
func NewCRSpecLoader ¶ added in v0.3.0
func NewCRSpecLoader(plugins map[string]prometheus.SLIPlugin) CRSpecLoader
func (CRSpecLoader) LoadSpec ¶ added in v0.3.0
func (c CRSpecLoader) LoadSpec(ctx context.Context, spec *k8sprometheusv1.PrometheusServiceLevel) (*SLOGroup, error)
type IOWriterPrometheusOperatorYAMLRepo ¶
type IOWriterPrometheusOperatorYAMLRepo struct {
// contains filtered or unexported fields
}
IOWriterPrometheusOperatorYAMLRepo knows to store all the SLO rules (recordings and alerts) grouped in an IOWriter in Kubernetes prometheus operator YAML format.
func NewIOWriterPrometheusOperatorYAMLRepo ¶
func NewIOWriterPrometheusOperatorYAMLRepo(writer io.Writer, logger log.Logger) IOWriterPrometheusOperatorYAMLRepo
func (IOWriterPrometheusOperatorYAMLRepo) StoreSLOs ¶
func (i IOWriterPrometheusOperatorYAMLRepo) StoreSLOs(ctx context.Context, kmeta K8sMeta, slos []StorageSLO) error
type K8sMeta ¶
type K8sMeta struct { Kind string `validate:"required"` APIVersion string `validate:"required"` Name string `validate:"required"` UID string Namespace string Annotations map[string]string Labels map[string]string }
K8sMeta is the Kubernetes metadata simplified.
type KubernetesService ¶ added in v0.2.0
type KubernetesService struct {
// contains filtered or unexported fields
}
func NewKubernetesService ¶ added in v0.2.0
func NewKubernetesService(slothCli slothclientset.Interface, monitoringCli monitoringclientset.Interface, logger log.Logger) KubernetesService
NewKubernetesService returns a new Kubernetes Service.
func (KubernetesService) EnsurePrometheusRule ¶ added in v0.2.0
func (k KubernetesService) EnsurePrometheusRule(ctx context.Context, pr *monitoringv1.PrometheusRule) error
func (KubernetesService) EnsurePrometheusServiceLevelStatus ¶ added in v0.2.0
func (k KubernetesService) EnsurePrometheusServiceLevelStatus(ctx context.Context, slo *slothv1.PrometheusServiceLevel, err error) error
EnsurePrometheusServiceLevelStatus updates the status of a PrometheusServiceLeve, be aware that updating an status will trigger a watch update event on a controller. In case of no error we will update "last correct Prometheus operation rules generated" TS so we can be in a infinite loop of handling, the handler should break this loop somehow (e.g: if ok and last generated < 5m, ignore).
func (KubernetesService) ListPrometheusServiceLevels ¶ added in v0.2.0
func (k KubernetesService) ListPrometheusServiceLevels(ctx context.Context, ns string, labelSelector map[string]string) (*slothv1.PrometheusServiceLevelList, error)
type PrometheusOperatorCRDRepo ¶ added in v0.2.0
type PrometheusOperatorCRDRepo struct {
// contains filtered or unexported fields
}
PrometheusOperatorCRDRepo knows to store all the SLO rules (recordings and alerts) grouped as a Kubernetes prometheus operator CR using Kubernetes API server.
func NewPrometheusOperatorCRDRepo ¶ added in v0.2.0
func NewPrometheusOperatorCRDRepo(ensurer PrometheusRulesEnsurer, logger log.Logger) PrometheusOperatorCRDRepo
func (PrometheusOperatorCRDRepo) StoreSLOs ¶ added in v0.2.0
func (p PrometheusOperatorCRDRepo) StoreSLOs(ctx context.Context, kmeta K8sMeta, slos []StorageSLO) error
type PrometheusRulesEnsurer ¶ added in v0.2.0
type PrometheusRulesEnsurer interface {
EnsurePrometheusRule(ctx context.Context, pr *monitoringv1.PrometheusRule) error
}
type SLOGroup ¶
type SLOGroup struct { K8sMeta K8sMeta prometheus.SLOGroup }
SLOGroup is a Kubernetes SLO group. Is created based on a regular Prometheus SLO model and Kubernetes data.
type StorageSLO ¶
type StorageSLO struct { SLO prometheus.SLO Rules prometheus.SLORules }
type YAMLSpecLoader ¶
type YAMLSpecLoader struct {
// contains filtered or unexported fields
}
YAMLSpecLoader knows how to load Kubernetes ServiceLevel YAML specs and converts them to a model.
func NewYAMLSpecLoader ¶ added in v0.3.0
func NewYAMLSpecLoader(plugins map[string]prometheus.SLIPlugin) YAMLSpecLoader
NewYAMLSpecLoader returns a YAML spec loader.