The ServiceLevelObjective custom resource defines a Service Level Objective (SLO) for a specific service, based on a ServiceLevelIndicatorTemplate resource.
apiVersion: sre.banzaicloud.io/v1alpha1
kind: ServiceLevelObjective
metadata:
name: <Name of the SLO>
namespace: <Namespace of the SLO>
spec:
description: <Description of the SLO>
selector:
name: <Name of the service that the SLO applies to>
namespace: <Namespace of the service that the SLO applies to>
sli:
parameters:
reporter: <The Envoy proxy that reports the metric (source | destination)>
templateRef:
name: <Name of the SLI template that the SLO is based on>
namespace: <Namespace of the SLI template that the SLO is based on>
slo:
goal: <The goal of the SLO as a floating-point number, for example, "99.9" for 99.9% success level>
rolling:
length: <The time period for which the SLO is calculated, for example, 24h>
For example, the following ServiceLevelObjective resource defines and 99.9% SLO for the HTTP requests in a 30-day rolling window for the Frontpage service included in Backyards’ demo application:
apiVersion: sre.banzaicloud.io/v1alpha1
kind: ServiceLevelObjective
metadata:
name: frontpage-30d-rolling-availability
namespace: backyards-demo
spec:
description: HTTP request success rate should be above 99.9% for a rolling period of 30 days
selector:
name: frontpage
namespace: backyards-demo
sli:
parameters:
reporter: destination
templateRef:
name: http-requests-success-rate
namespace: backyards-system
slo:
goal: "99.9"
rolling:
length: 720h
For a more detailed tutorial, see the Defining application level SLOs using Backyards blog post.
CR reference 🔗︎
This section describes the fields of the ServiceLevelObjective custom resource. Note that the ServiceLevelObjective is a namespaced custom resource.
apiVersion (string) 🔗︎
Must be sre.banzaicloud.io/v1alpha1
kind (string) 🔗︎
Must be ServiceLevelObjective
spec (object) 🔗︎
The configuration and parameters of the Service Level Objective.
spec.description (string) 🔗︎
A human-readable description of the SLO. This text appears on the Backyards web interface as well. For example:
spec:
description: |
HTTP request success rate should be above 99.9% for a rolling period of 30 days
spec.selector (object) 🔗︎
Specifies which service the SLO applies to using its name and namespace, for example:
spec:
selector:
name: frontpage
namespace: backyards-demo
spec.sli (object) 🔗︎
Contains a templateRef
that specifies which Service Level Indicator template to use in this SLO, and the parameters
passed to the template. For the details of the available parameters, see the CR of the respective Service Level Indicator template.
spec.sli.templateRef (object) 🔗︎
Specifies Service Level Indicator template to use in this SLO using its name and namespace, for example:
sli:
templateRef:
name: http-requests-duration
namespace: backyards-system
You can list the available templates by running the following command:
$ kubectl get slit -A
NAMESPACE NAME AGE
backyards-system grpc-requests-success-rate 3d1h
backyards-system http-requests-duration 3d1h
backyards-system http-requests-success-rate 3d1h
spec.slo (object) 🔗︎
Configures the type and goal of the Service Level Objective. For example, for a 14-day window:
slo:
goal: '99.9'
rolling:
length: 336h0m0s
spec.slo.calendar (object) 🔗︎
For calendar-based SLO windows, specifies the length of the window: month|week|day, for example:
slo:
calendar:
length: week
spec.slo.goal (string) 🔗︎
The actual goal of the SLO as a floating-point number, for example, “99.9” for 99.9% success level.
spec.slo.rolling (object) 🔗︎
For rolling SLO windows, specifies the length of the window, for example, for a 14-day window:
rolling:
length: 336h0m0s
status (object) 🔗︎
The current state of the Service Level Objective. This object is managed by Backyards.