util

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 24 Imported by: 8

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 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 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 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

type ComponentHealth struct {
	Scheduler         bool
	ControllerManager bool
	Etcd              bool
}

func (*ComponentHealth) AllHealthy added in v1.6.0

func (ch *ComponentHealth) AllHealthy() bool

type DynamicClientSet added in v1.3.1

type DynamicClientSet map[string]dynamic.Interface

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 MetricServerClientSets map[string]*metricsv.Clientset

type PersistentOperator

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

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

type WorkloadCounter struct {
	Deployment  int
	DaemonSet   int
	StatefulSet int
	TApp        int
}

func (*WorkloadCounter) Total added in v1.3.1

func (w *WorkloadCounter) Total() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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