Documentation ¶
Overview ¶
Copyright 2022 The KubeSphere Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 The KubeSphere Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Operator ¶
type Operator interface { // ListCustomAlertingRules lists the custom alerting rules. ListCustomAlertingRules(ctx context.Context, namespace string, queryParams *v2alpha1.AlertingRuleQueryParams) (*v2alpha1.GettableAlertingRuleList, error) // ListCustomRulesAlerts lists the alerts of the custom alerting rules. ListCustomRulesAlerts(ctx context.Context, namespace string, queryParams *v2alpha1.AlertQueryParams) (*v2alpha1.AlertList, error) // GetCustomAlertingRule gets the custom alerting rule with the given name. GetCustomAlertingRule(ctx context.Context, namespace, ruleName string) (*v2alpha1.GettableAlertingRule, error) // ListCustomRuleAlerts lists the alerts of the custom alerting rule with the given name. ListCustomRuleAlerts(ctx context.Context, namespace, ruleName string) (*v2alpha1.AlertList, error) // CreateCustomAlertingRule creates a custom alerting rule. CreateCustomAlertingRule(ctx context.Context, namespace string, rule *v2alpha1.PostableAlertingRule) error // UpdateCustomAlertingRule updates the custom alerting rule with the given name. UpdateCustomAlertingRule(ctx context.Context, namespace, ruleName string, rule *v2alpha1.PostableAlertingRule) error // DeleteCustomAlertingRule deletes the custom alerting rule with the given name. DeleteCustomAlertingRule(ctx context.Context, namespace, ruleName string) error // CreateOrUpdateCustomAlertingRules creates or updates custom alerting rules in bulk. CreateOrUpdateCustomAlertingRules(ctx context.Context, namespace string, rs []*v2alpha1.PostableAlertingRule) (*v2alpha1.BulkResponse, error) // DeleteCustomAlertingRules deletes a batch of custom alerting rules. DeleteCustomAlertingRules(ctx context.Context, namespace string, ruleNames []string) (*v2alpha1.BulkResponse, error) // ListBuiltinAlertingRules lists the builtin(non-custom) alerting rules ListBuiltinAlertingRules(ctx context.Context, queryParams *v2alpha1.AlertingRuleQueryParams) (*v2alpha1.GettableAlertingRuleList, error) // ListBuiltinRulesAlerts lists the alerts of the builtin(non-custom) alerting rules ListBuiltinRulesAlerts(ctx context.Context, queryParams *v2alpha1.AlertQueryParams) (*v2alpha1.AlertList, error) // GetBuiltinAlertingRule gets the builtin(non-custom) alerting rule with the given id GetBuiltinAlertingRule(ctx context.Context, ruleId string) (*v2alpha1.GettableAlertingRule, error) // ListBuiltinRuleAlerts lists the alerts of the builtin(non-custom) alerting rule with the given id ListBuiltinRuleAlerts(ctx context.Context, ruleId string) (*v2alpha1.AlertList, error) }
Operator contains all operations to alerting rules. The operations may involve manipulations of prometheusrule custom resources where the rules are persisted, and querying the rules state from prometheus endpoint and thanos ruler endpoint. For the following apis, if namespace is empty, do operations to alerting rules with cluster level, or do operations only to rules of the specified namespaces. All custom rules will be configured for thanos ruler, so the operations to custom alerting rule can not be done if thanos ruler is not enabled.
func NewOperator ¶
func NewOperator(informers informers.InformerFactory, promResourceClient promresourcesclient.Interface, ruleClient alerting.RuleClient, option *alerting.Options) Operator
type RuleGroupOperator ¶
type RuleGroupOperator interface { ListRuleGroups(ctx context.Context, namespace string, queryParam *query.Query) (*api.ListResult, error) GetRuleGroup(ctx context.Context, namespace, name string) (*kapialertingv2beta1.RuleGroup, error) ListAlerts(ctx context.Context, namespace string, queryParam *query.Query) (*api.ListResult, error) ListGlobalRuleGroups(ctx context.Context, queryParam *query.Query) (*api.ListResult, error) GetGlobalRuleGroup(ctx context.Context, name string) (*kapialertingv2beta1.GlobalRuleGroup, error) ListGlobalAlerts(ctx context.Context, queryParam *query.Query) (*api.ListResult, error) ListClusterRuleGroups(ctx context.Context, queryParam *query.Query) (*api.ListResult, error) GetClusterRuleGroup(ctx context.Context, name string) (*kapialertingv2beta1.ClusterRuleGroup, error) ListClusterAlerts(ctx context.Context, queryParam *query.Query) (*api.ListResult, error) }
func NewRuleGroupOperator ¶
func NewRuleGroupOperator(informers informers.InformerFactory, ruleClient alerting.RuleClient) RuleGroupOperator