util

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAlertKey defines the default key for prometheus and alertmanager labels
	DefaultAlertKey = "alert"
)
View Source
const (
	// ProjectDatabaseName defines database name for project metrics
	ProjectDatabaseName = "projects"
)

Variables

View Source
var ClusterNameToClient sync.Map

ClusterNameToClient mapping cluster to kubernetes client clusterName => kubernetes.Interface

View Source
var ClusterNameToMonitor sync.Map

ClusterNameToMonitor mapping cluster to monitoring client clusterName => monitoringclient.Clientset

Functions

func GetClusterClient

func GetClusterClient(clusterName string, platformClient platformversionedclient.PlatformV1Interface) (kubernetes.Interface, error)

GetClusterClient get kubernetes client via cluster name

func GetMonitoringClient

func GetMonitoringClient(clusterName string, platformClient platformversionedclient.PlatformV1Interface) (monitoringclient.Interface, error)

GetMonitoringClient get monitoring client via cluster name

func ParseES

func ParseES(esStr string) (esclient.Client, error)

ParseES parse es address and user pwd

func ParseInfluxdb

func ParseInfluxdb(influxdbStr string) (influxclient.Client, error)

ParseInfluxdb parse influxdb address and pwd

func RenameInfluxDB

func RenameInfluxDB(name string) string

RenameInfluxDB replace invalid character for influxDB database

func ValidateLabels

func ValidateLabels(labels map[string]string) error

ValidateLabels returns if labels has default key, if not return error

Types

type GenericRouteOperator

type GenericRouteOperator interface {
	RouteOperator
	PersistentOperator
}

GenericRouteOperator defines the generic alert route for alertmanager

type GenericRuleOperator

type GenericRuleOperator interface {
	RuleOperator
	RuleGroupOperator
	PersistentOperator
	LoadPromRule([]v1.RuleGroup) error
	SavePromRule() []v1.RuleGroup
}

GenericRuleOperator defines the generic rule operator for prometheus

type PersistentOperator

type PersistentOperator interface {
	Load(r io.Reader) error
	Save(w io.Writer) error
}

PersistentOperator defined the persistent method of rule operator

type RouteOperator

type RouteOperator interface {
	InsertRoute(route *alert_config.Route) (*alert_config.Route, error)
	DeleteRoute(alertValue string) (*alert_config.Route, error)
	UpdateRoute(alertValue string, route *alert_config.Route) (*alert_config.Route, error)
	GetRoute(alertValue string) (*alert_config.Route, error)
	ListRoute() ([]*alert_config.Route, error)
}

RouteOperator defines the CRUD interface of alert route

type RuleGroupOperator

type RuleGroupOperator interface {
	InsertRuleGroup(group *v1.RuleGroup) (int, *v1.RuleGroup, error)
	DeleteRuleGroup(groupName string) (*v1.RuleGroup, error)
	UpdateRuleGroup(groupName string, rev int, group *v1.RuleGroup) (int, *v1.RuleGroup, error)
	GetRuleGroup(groupName string) (int, *v1.RuleGroup, error)
	ListGroup() ([]*v1.RuleGroup, error)
}

RuleGroupOperator defines the CRUD interface of rule group operator

type RuleOperator

type RuleOperator interface {
	InsertRule(groupName string, rule *v1.Rule) (int, *v1.Rule, error)
	DeleteRule(groupName, recordName string) (*v1.Rule, error)
	UpdateRule(groupName, recordName string, rev int, rule *v1.Rule) (int, *v1.Rule, error)
	GetRule(groupName, recordName string) (int, *v1.Rule, error)
	ListRule(groupName string) ([]*v1.Rule, error)
}

RuleOperator defines the CRUD interface of rule record operator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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