KeptnEvaluationDefinition
A KeptnEvaluationDefinition
assigns target values
to
KeptnMetric queries.
These are used as part of evaluation tasks
that can be run by the Keptn Lifecycle Toolkit
as part of pre- and post-analysis phases of a workload or application.
Yaml Synopsis
apiVersion: lifecycle.keptn.sh/v1alpha3
kind: KeptnEvaluationDefinition
metadata:
name: <evaluation-name>
spec:
objectives:
- evaluationTarget: "<value>"
keptnMetricRef:
name: available-cpus
namespace: some-namespace
Fields
-
apiVersion – API version being used. Must be
v1alpha3
or later for this syntax. -
kind – Resource type. Must be set to
KeptnEvaluationDefinition
-
metadata
- name – Unique name of this evaluation
such as
pre-deploy-eval
orpost-deploy-resource-eval
. Names must comply with the Kubernetes Object Names and IDs specification.
- name – Unique name of this evaluation
such as
-
spec
-
objectives – define the evaluations to be performed. Each objective is expressed as a
keptnMetricRef
and anevaluationTarget
value.- KeptnMericRef – A reference to the
KeptnMetric object that contains the value,
identified by
name
andnamespace
- evaluationTarget – Desired value of the query,
expressed as an arithmetic formula,
usually less than (
<
) or greater than (>
) This is used to define success or failure criteria for the referencedKeptnMetric
in order to pass or fail the pre- and post-evaluation stages
- KeptnMericRef – A reference to the
KeptnMetric object that contains the value,
identified by
-
Usage
A KeptnEvaluationDefinition
references one or more
KeptnMetric CRDs.
When multiple KeptnMetric
s are used,
the Keptn Lifecycle Toolkit considers the evaluation successful
if all metrics meet their evaluationTarget
.
Example
apiVersion: lifecycle.keptn.sh/v1alpha3
kind: KeptnEvaluationDefinition
metadata:
name: my-prometheus-evaluation
namespace: example
spec:
source: prometheus
objectives:
- keptnMetricRef:
name: available-cpus
namespace: example
evaluationTarget: ">1"
- keptnMetricRef:
name: cpus-throttling
namespace: example
evaluationTarget: "<0.01"
Files
API Reference:
Differences between versions
In the v1alpha1
and v1alpha2
API versions,
KeptnEvaluationDefinition
referenced the KeptnEvaluationProvider
CR
to identify the data source associated with this definition
and itself contained the queries
that are now taken from the specified
KeptnMetric CRD.
The synopsis was:
apiVersion: lifecycle.keptn.sh/v1alpha2
kind: KeptnEvaluationDefinition
metadata:
name: <evaluation-name>
spec:
source: prometheus | dynatrace | datadog
objectives:
- name: query-1
query: "xxxx"
evaluationTarget: <20
- name: query-2
query: "yyyy"
evaluationTarget: >4
Beginning with v1alpha3
API version,
KeptnEvaluationDefinition
references a keptnMetricRef
that points to a
KeptnMetric CR,
that defines the data source, the query and the namespace to use.
The KeptnEvaluationDefinition
merely specifies the evaluation target.