Documentation ¶
Index ¶
- Variables
- func Kind(kind string) schema.GroupKind
- func Resource(resource string) schema.GroupResource
- func VersionKind(kind string) schema.GroupVersionKind
- type Alert
- type Alerting
- type PrometheusServiceLevel
- type PrometheusServiceLevelList
- type PrometheusServiceLevelSpec
- type PrometheusServiceLevelStatus
- type SLI
- type SLIEvents
- type SLIPlugin
- type SLIRaw
- type SLO
Constants ¶
This section is empty.
Variables ¶
var ( // SchemeBuilder initializes a scheme builder. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) // AddToScheme is a global function that registers this API group & version to a scheme. AddToScheme = SchemeBuilder.AddToScheme )
var SchemeGroupVersion = schema.GroupVersion{Group: sloth.GroupName, Version: version}
SchemeGroupVersion is group version used to register these objects.
Functions ¶
func Resource ¶
func Resource(resource string) schema.GroupResource
Resource takes an unqualified resource and returns a Group qualified GroupResource.
func VersionKind ¶
func VersionKind(kind string) schema.GroupVersionKind
VersionKind takes an unqualified kind and returns back a Group qualified GroupVersionKind.
Types ¶
type Alert ¶
type Alert struct { // Disable disables the alert and makes Sloth not generating this alert. This // can be helpful for example to disable ticket(warning) alerts. Disable bool `json:"disable,omitempty"` // Labels are the Prometheus labels for the specific alert. For example can be // useful to route the Page alert to specific Slack channel. // +optional Labels map[string]string `json:"labels,omitempty"` // Annotations are the Prometheus annotations for the specific alert. // +optional Annotations map[string]string `json:"annotations,omitempty"` }
Alert configures specific SLO alert.
func (*Alert) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Alert.
func (*Alert) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Alerting ¶
type Alerting struct { // Name is the name used by the alerts generated for this SLO. // +optional Name string `json:"name,omitempty"` // Labels are the Prometheus labels that will have all the alerts generated by this SLO. // +optional Labels map[string]string `json:"labels,omitempty"` // Annotations are the Prometheus annotations that will have all the alerts generated by // this SLO. // +optional Annotations map[string]string `json:"annotations,omitempty"` // Page alert refers to the critical alert (check multiwindow-multiburn alerts). PageAlert Alert `json:"pageAlert,omitempty"` // TicketAlert alert refers to the warning alert (check multiwindow-multiburn alerts). TicketAlert Alert `json:"ticketAlert,omitempty"` }
Alerting wraps all the configuration required by the SLO alerts.
func (*Alerting) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Alerting.
func (*Alerting) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PrometheusServiceLevel ¶
type PrometheusServiceLevel struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec PrometheusServiceLevelSpec `json:"spec,omitempty"` Status PrometheusServiceLevelStatus `json:"status,omitempty"` }
+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:subresource:status +kubebuilder:printcolumn:name="SERVICE",type="string",JSONPath=".spec.service" +kubebuilder:printcolumn:name="DESIRED SLOs",type="integer",JSONPath=".status.processedSLOs" +kubebuilder:printcolumn:name="READY SLOs",type="integer",JSONPath=".status.promOpRulesGeneratedSLOs" +kubebuilder:printcolumn:name="GEN OK",type="boolean",JSONPath=".status.promOpRulesGenerated" +kubebuilder:printcolumn:name="GEN AGE",type="date",JSONPath=".status.lastPromOpRulesSuccessfulGenerated" +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +kubebuilder:resource:singular=prometheusservicelevel,path=prometheusservicelevels,shortName=psl;pslo,scope=Namespaced,categories=slo;slos;sli;slis
PrometheusServiceLevel is the expected service quality level using Prometheus as the backend used by Sloth.
func (*PrometheusServiceLevel) DeepCopy ¶
func (in *PrometheusServiceLevel) DeepCopy() *PrometheusServiceLevel
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusServiceLevel.
func (*PrometheusServiceLevel) DeepCopyInto ¶
func (in *PrometheusServiceLevel) DeepCopyInto(out *PrometheusServiceLevel)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*PrometheusServiceLevel) DeepCopyObject ¶
func (in *PrometheusServiceLevel) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type PrometheusServiceLevelList ¶
type PrometheusServiceLevelList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` Items []PrometheusServiceLevel `json:"items"` }
+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
PrometheusServiceLevelList is a list of PrometheusServiceLevel resources.
func (*PrometheusServiceLevelList) DeepCopy ¶
func (in *PrometheusServiceLevelList) DeepCopy() *PrometheusServiceLevelList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusServiceLevelList.
func (*PrometheusServiceLevelList) DeepCopyInto ¶
func (in *PrometheusServiceLevelList) DeepCopyInto(out *PrometheusServiceLevelList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*PrometheusServiceLevelList) DeepCopyObject ¶
func (in *PrometheusServiceLevelList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type PrometheusServiceLevelSpec ¶
type PrometheusServiceLevelSpec struct { // +kubebuilder:validation:Required // // Service is the application of the SLOs. Service string `json:"service"` // Labels are the Prometheus labels that will have all the recording // and alerting rules generated for the service SLOs. Labels map[string]string `json:"labels,omitempty"` // +kubebuilder:validation:MinItems=1 // // SLOs are the SLOs of the service. SLOs []SLO `json:"slos,omitempty"` }
ServiceLevelSpec is the spec for a PrometheusServiceLevel.
func (*PrometheusServiceLevelSpec) DeepCopy ¶
func (in *PrometheusServiceLevelSpec) DeepCopy() *PrometheusServiceLevelSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusServiceLevelSpec.
func (*PrometheusServiceLevelSpec) DeepCopyInto ¶
func (in *PrometheusServiceLevelSpec) DeepCopyInto(out *PrometheusServiceLevelSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PrometheusServiceLevelStatus ¶ added in v0.2.0
type PrometheusServiceLevelStatus struct { // PromOpRulesGeneratedSLOs tells how many SLOs have been processed and generated for Prometheus operator successfully. PromOpRulesGeneratedSLOs int `json:"promOpRulesGeneratedSLOs"` // ProcessedSLOs tells how many SLOs haven been processed for Prometheus operator. ProcessedSLOs int `json:"processedSLOs"` // PromOpRulesGenerated tells if the rules for prometheus operator CRD have been generated. PromOpRulesGenerated bool `json:"promOpRulesGenerated"` // LastPromOpRulesGeneration tells the last atemp made for a successful SLO rules generate. // +optional LastPromOpRulesSuccessfulGenerated *metav1.Time `json:"lastPromOpRulesSuccessfulGenerated,omitempty"` // ObservedGeneration tells the generation was acted on, normally this is required to stop an // infinite loop when the status is updated because it sends a watch updated event to the watchers // of the K8s object. ObservedGeneration int64 `json:"observedGeneration"` }
func (*PrometheusServiceLevelStatus) DeepCopy ¶ added in v0.2.0
func (in *PrometheusServiceLevelStatus) DeepCopy() *PrometheusServiceLevelStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusServiceLevelStatus.
func (*PrometheusServiceLevelStatus) DeepCopyInto ¶ added in v0.2.0
func (in *PrometheusServiceLevelStatus) DeepCopyInto(out *PrometheusServiceLevelStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SLI ¶
type SLI struct { // Raw is the raw SLI type. // +optional Raw *SLIRaw `json:"raw,omitempty"` // Events is the events SLI type. // +optional Events *SLIEvents `json:"events,omitempty"` // Plugin is the pluggable SLI type. // +optional Plugin *SLIPlugin `json:"plugin,omitempty"` }
SLI will tell what is good or bad for the SLO. All SLIs will be get based on time windows, that's why Sloth needs the queries to use `{{.window}}` template variable.
Only one of the SLI types can be used.
func (*SLI) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLI.
func (*SLI) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SLIEvents ¶
type SLIEvents struct { // ErrorQuery is a Prometheus query that will get the number/count of events // that we consider that are bad for the SLO (e.g "http 5xx", "latency > 250ms"...). // Requires the usage of `{{.window}}` template variable. ErrorQuery string `json:"errorQuery"` // TotalQuery is a Prometheus query that will get the total number/count of events // for the SLO (e.g "all http requests"...). // Requires the usage of `{{.window}}` template variable. TotalQuery string `json:"totalQuery"` }
SLIEvents is an SLI that is calculated as the division of bad events and total events, giving a ratio SLI. Normally this is the most common ratio type.
func (*SLIEvents) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLIEvents.
func (*SLIEvents) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SLIPlugin ¶ added in v0.3.0
type SLIPlugin struct { // Name is the name of the plugin that needs to load. ID string `json:"id"` // Options are the options used for the plugin. // +optional Options map[string]string `json:"options,omitempty"` }
SLIPlugin will use the SLI returned by the SLI plugin selected along with the options.
func (*SLIPlugin) DeepCopy ¶ added in v0.3.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLIPlugin.
func (*SLIPlugin) DeepCopyInto ¶ added in v0.3.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SLIRaw ¶
type SLIRaw struct { // ErrorRatioQuery is a Prometheus query that will get the raw error ratio (0-1) for the SLO. ErrorRatioQuery string `json:"errorRatioQuery"` }
SLIRaw is a error ratio SLI already calculated. Normally this will be used when the SLI is already calculated by other recording rule, system...
func (*SLIRaw) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLIRaw.
func (*SLIRaw) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SLO ¶
type SLO struct { // +kubebuilder:validation:Required // +kubebuilder:validation:MaxLength=128 // // Name is the name of the SLO. Name string `json:"name"` // Description is the description of the SLO. // +optional Description string `json:"description,omitempty"` // +kubebuilder:validation:Required // // Objective is target of the SLO the percentage (0, 100] (e.g 99.9). Objective float64 `json:"objective"` // Labels are the Prometheus labels that will have all the recording and // alerting rules for this specific SLO. These labels are merged with the // previous level labels. // +optional Labels map[string]string `json:"labels,omitempty"` // +kubebuilder:validation:Required // // SLI is the indicator (service level indicator) for this specific SLO. SLI SLI `json:"sli"` // +kubebuilder:validation:Required // // Alerting is the configuration with all the things related with the SLO // alerts. Alerting Alerting `json:"alerting"` }
SLO is the configuration/declaration of the service level objective of a service.
func (*SLO) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLO.
func (*SLO) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.