# README
v1
import "github.com/slok/sloth/pkg/kubernetes/api/sloth/v1"
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
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
)
SchemeGroupVersion is group version used to register these objects.
var SchemeGroupVersion = schema.GroupVersion{Group: sloth.GroupName, Version: version}
func Kind
func Kind(kind string) schema.GroupKind
Kind takes an unqualified kind and returns back a Group qualified GroupKind.
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.
type Alert
Alert configures specific SLO 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"`
}
func (*Alert) DeepCopy
func (in *Alert) DeepCopy() *Alert
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Alert.
func (*Alert) DeepCopyInto
func (in *Alert) DeepCopyInto(out *Alert)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Alerting
Alerting wraps all the configuration required by the SLO alerts.
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"`
}
func (*Alerting) DeepCopy
func (in *Alerting) DeepCopy() *Alerting
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Alerting.
func (*Alerting) DeepCopyInto
func (in *Alerting) DeepCopyInto(out *Alerting)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PrometheusServiceLevel
+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.
type PrometheusServiceLevel struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec PrometheusServiceLevelSpec `json:"spec,omitempty"`
Status PrometheusServiceLevelStatus `json:"status,omitempty"`
}
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
+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
PrometheusServiceLevelList is a list of PrometheusServiceLevel resources.
type PrometheusServiceLevelList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []PrometheusServiceLevel `json:"items"`
}
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
ServiceLevelSpec is the spec for a PrometheusServiceLevel.
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"`
}
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
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
func (in *PrometheusServiceLevelStatus) DeepCopy() *PrometheusServiceLevelStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusServiceLevelStatus.
func (*PrometheusServiceLevelStatus) DeepCopyInto
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
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.
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"`
}
func (*SLI) DeepCopy
func (in *SLI) DeepCopy() *SLI
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLI.
func (*SLI) DeepCopyInto
func (in *SLI) DeepCopyInto(out *SLI)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SLIEvents
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.
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"`
}
func (*SLIEvents) DeepCopy
func (in *SLIEvents) DeepCopy() *SLIEvents
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLIEvents.
func (*SLIEvents) DeepCopyInto
func (in *SLIEvents) DeepCopyInto(out *SLIEvents)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SLIPlugin
SLIPlugin will use the SLI returned by the SLI plugin selected along with the options.
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"`
}
func (*SLIPlugin) DeepCopy
func (in *SLIPlugin) DeepCopy() *SLIPlugin
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLIPlugin.
func (*SLIPlugin) DeepCopyInto
func (in *SLIPlugin) DeepCopyInto(out *SLIPlugin)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SLIRaw
SLIRaw is a error ratio SLI already calculated. Normally this will be used when the SLI is already calculated by other recording rule, system...
type SLIRaw struct {
// ErrorRatioQuery is a Prometheus query that will get the raw error ratio (0-1) for the SLO.
ErrorRatioQuery string `json:"errorRatioQuery"`
}
func (*SLIRaw) DeepCopy
func (in *SLIRaw) DeepCopy() *SLIRaw
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLIRaw.
func (*SLIRaw) DeepCopyInto
func (in *SLIRaw) DeepCopyInto(out *SLIRaw)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SLO
SLO is the configuration/declaration of the service level objective of a service.
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"`
}
func (*SLO) DeepCopy
func (in *SLO) DeepCopy() *SLO
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SLO.
func (*SLO) DeepCopyInto
func (in *SLO) DeepCopyInto(out *SLO)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
Generated by gomarkdoc