Documentation ¶
Index ¶
- Constants
- Variables
- func FilterPrometheus(ctx context.Context, prom *monitor.Prometheus) error
- func GetClusterClient(ctx context.Context, clusterName string, ...) (kubernetes.Interface, error)
- func GetMonitoringClient(ctx context.Context, clusterName string, ...) (monitoringclient.Interface, error)
- func ParseES(esStr string) (esclient.Client, error)
- func ParseInfluxdb(influxdbStr string) (influxclient.Client, error)
- func RenameInfluxDB(name string) string
- func ValidateLabels(labels map[string]string) error
- type ClusterClientSets
- type ClusterCredentialSet
- type ClusterSet
- type ClusterStatisticSet
- type ComponentHealth
- type DynamicClientSet
- type GenericRouteOperator
- type GenericRuleOperator
- type MetricServerClientSets
- type PersistentOperator
- type ResourceCounter
- type RouteOperator
- type RuleGroupOperator
- type RuleOperator
- type WorkloadCounter
Constants ¶
const (
// DefaultAlertKey defines the default key for prometheus and alertmanager labels
DefaultAlertKey = "alert"
)
const (
// ProjectDatabaseName defines database name for project metrics
ProjectDatabaseName = "projects"
)
Variables ¶
var ClusterNameToClient sync.Map
ClusterNameToClient mapping cluster to kubernetes client clusterName => kubernetes.Interface
var ClusterNameToMonitor sync.Map
ClusterNameToMonitor mapping cluster to monitoring client clusterName => monitoringclient.Clientset
Functions ¶
func FilterPrometheus ¶ added in v1.3.1
func FilterPrometheus(ctx context.Context, prom *monitor.Prometheus) error
FilterPrometheus is used to filter helm that do not belong to the tenant.
func GetClusterClient ¶
func GetClusterClient(ctx context.Context, clusterName string, platformClient platformversionedclient.PlatformV1Interface) (kubernetes.Interface, error)
GetClusterClient get kubernetes client via cluster name
func GetMonitoringClient ¶
func GetMonitoringClient(ctx context.Context, clusterName string, platformClient platformversionedclient.PlatformV1Interface) (monitoringclient.Interface, error)
GetMonitoringClient get monitoring client via cluster name
func ParseInfluxdb ¶
func ParseInfluxdb(influxdbStr string) (influxclient.Client, error)
ParseInfluxdb parse influxdb address and pwd
func RenameInfluxDB ¶
RenameInfluxDB replace invalid character for influxDB database
func ValidateLabels ¶
ValidateLabels returns if labels has default key, if not return error
Types ¶
type ClusterClientSets ¶ added in v1.3.1
type ClusterClientSets map[string]*kubernetes.Clientset
type ClusterCredentialSet ¶ added in v1.3.1
type ClusterCredentialSet map[string]*platformv1.ClusterCredential
type ClusterSet ¶ added in v1.3.1
type ClusterSet map[string]*platformv1.Cluster
type ClusterStatisticSet ¶ added in v1.3.1
type ClusterStatisticSet map[string]*monitor.ClusterStatistic
type ComponentHealth ¶ added in v1.3.1
func (*ComponentHealth) AllHealthy ¶ added in v1.6.0
func (ch *ComponentHealth) AllHealthy() bool
type DynamicClientSet ¶ added in v1.3.1
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 MetricServerClientSets ¶ added in v1.3.1
type PersistentOperator ¶
PersistentOperator defined the persistent method of rule operator
type ResourceCounter ¶ added in v1.3.1
type ResourceCounter struct { NodeTotal int NodeAbnormal int HasMetricServer bool CPUUsed float64 CPURequest float64 CPULimit float64 CPUCapacity float64 CPUAllocatable float64 CPUNotReadyCapacity float64 CPUNotReadyAllocatable float64 CPURequestRate float64 CPUAllocatableRate float64 CPUUsage float64 MemUsed int64 MemRequest int64 MemLimit int64 MemCapacity int64 MemAllocatable int64 MemNotReadyCapacity int64 MemNotReadyAllocatable int64 MemRequestRate float64 MemAllocatableRate float64 MemUsage float64 PodCount int CPUCapacityMap map[string]map[string]float64 CPUAllocatableMap map[string]map[string]float64 CPUNotReadyCapacityMap map[string]map[string]float64 CPUNotReadyAllocatableMap map[string]map[string]float64 MemCapacityMap map[string]map[string]int64 MemAllocatableMap map[string]map[string]int64 MemNotReadyCapacityMap map[string]map[string]int64 MemNotReadyAllocatableMap map[string]map[string]int64 }
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
type WorkloadCounter ¶ added in v1.3.1
func (*WorkloadCounter) Total ¶ added in v1.3.1
func (w *WorkloadCounter) Total() int