Skip to content

Commit d56bfa4

Browse files
odubajDTMeg McRobertsbacherfl
authored
docs: adapt KeptnEvaluationDefinition and introduce KeptnMetricsProvider (#944)
Signed-off-by: odubajDT <[email protected]> Signed-off-by: odubajDT <[email protected]> Co-authored-by: Meg McRoberts <[email protected]> Co-authored-by: Florian Bacher <[email protected]>
1 parent 5bac785 commit d56bfa4

File tree

2 files changed

+46
-37
lines changed

2 files changed

+46
-37
lines changed

README.md

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ keptn.sh/post-deployment-tasks: slack-notification,performance-test
122122
123123
The value of these annotations are
124124
Keptn [CRDs](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/)
125-
called [KeptnTaskDefinition](#keptn-task-definition)s. These CRDs contains re-usable "functions" that can
125+
called [KeptnTaskDefinition](#keptntaskdefinition)s. These CRDs contains re-usable "functions" that can
126126
executed before and after the deployment. In this example, before the deployment starts, a check for open problems in
127127
your infrastructure
128128
is performed. If everything is fine, the deployment continues and afterward, a slack notification is sent with the
@@ -246,14 +246,14 @@ For each pod, at the very end of the scheduling cycle, the plugin verifies wheth
246246
terminated, by retrieving the current status of the WorkloadInstance. Only if that is successful, the pod is bound to a
247247
node.
248248

249-
### Keptn App
249+
### KeptnApp
250250

251251
An App contains information about all workloads and checks associated with an application.
252252
It will use the following structure for the specification of the pre/post deployment and pre/post evaluations checks
253253
that should be executed at app level:
254254

255255
```yaml
256-
apiVersion: lifecycle.keptn.sh/v1alpha2
256+
apiVersion: lifecycle.keptn.sh/v1alpha3
257257
kind: KeptnApp
258258
metadata:
259259
name: podtato-head
@@ -275,15 +275,15 @@ spec:
275275
While changes in the workload version will affect only workload checks, a change in the app version will also cause a
276276
new execution of app level checks.
277277

278-
### Keptn Workload
278+
### KeptnWorkload
279279

280280
A Workload contains information about which tasks should be performed during the `preDeployment` as well as
281281
the `postDeployment`
282282
phase of a deployment. In its state it keeps track of the currently active `Workload Instances`, which are responsible
283283
for doing those checks for
284284
a particular instance of a Deployment/StatefulSet/ReplicaSet (e.g. a Deployment of a certain version).
285285

286-
### Keptn Workload Instance
286+
### KeptnWorkloadInstance
287287

288288
A Workload Instance is responsible for executing the pre- and post deployment checks of a workload. In its state, it
289289
keeps track of the current status of all checks, as well as the overall state of
@@ -293,7 +293,7 @@ desired state. If it detects that the referenced object has reached
293293
its desired state (e.g. all pods of a deployment are up and running), it will be able to tell that
294294
a `PostDeploymentCheck` can be triggered.
295295

296-
### Keptn Task Definition
296+
### KeptnTaskDefinition
297297

298298
A `KeptnTaskDefinition` is a CRD used to define tasks that can be run by the Keptn Lifecycle Toolkit
299299
as part of pre- and post-deployment phases of a deployment.
@@ -307,10 +307,10 @@ A task definition can be configured in three different ways:
307307
- referring to an HTTP script
308308
- referring to another `KeptnTaskDefinition`
309309

310-
An inline task definition looks like the following:
310+
An inline KeptnTaskDefinition looks like the following:
311311

312312
```yaml
313-
apiVersion: lifecycle.keptn.sh/v1alpha2
313+
apiVersion: lifecycle.keptn.sh/v1alpha3
314314
kind: KeptnTaskDefinition
315315
metadata:
316316
name: deployment-hello
@@ -328,7 +328,7 @@ To runtime can also fetch the script on the fly from a remote webserver. For thi
328328
following:
329329

330330
```yaml
331-
apiVersion: lifecycle.keptn.sh/v1alpha2
331+
apiVersion: lifecycle.keptn.sh/v1alpha3
332332
kind: KeptnTaskDefinition
333333
metadata:
334334
name: hello-keptn-http
@@ -344,7 +344,7 @@ Finally, `KeptnTaskDefinition` can build on top of other `KeptnTaskDefinition`s.
344344
This is a common use case where a general function can be re-used in multiple places with different parameters.
345345

346346
```yaml
347-
apiVersion: lifecycle.keptn.sh/v1alpha2
347+
apiVersion: lifecycle.keptn.sh/v1alpha3
348348
kind: KeptnTaskDefinition
349349
metadata:
350350
name: slack-notification-dev
@@ -367,45 +367,46 @@ K8s secrets can also be passed to the function using the `secureParameters` fiel
367367
Here, the `secret` value is the K8s secret name that will be mounted into the runtime and made available to the function
368368
via the environment variable `SECURE_DATA`.
369369

370-
### Keptn Task
370+
### KeptnTask
371371

372372
A Task is responsible for executing the TaskDefinition of a workload.
373373
The execution is done spawning a K8s Job to handle a single Task.
374374
In its state, it keeps track of the current status of the K8s Job created.
375375

376-
### Keptn Evaluation Definition
376+
### KeptnEvaluationDefinition
377377

378378
A `KeptnEvaluationDefinition` is a CRD used to define evaluation tasks that can be run by the Keptn Lifecycle Toolkit
379379
as part of pre- and post-analysis phases of a workload or application.
380380

381-
A Keptn evaluation definition looks like the following:
381+
A KeptnEvaluationDefinition looks like the following:
382382

383383
```yaml
384-
apiVersion: lifecycle.keptn.sh/v1alpha2
384+
apiVersion: lifecycle.keptn.sh/v1alpha3
385385
kind: KeptnEvaluationDefinition
386386
metadata:
387387
name: my-prometheus-evaluation
388388
spec:
389-
source: prometheus
390389
objectives:
391-
- name: query-1
392-
query: "xxxx"
390+
- keptnMetricRef:
391+
name: cpu
392+
namespace: ns
393393
evaluationTarget: <20
394-
- name: query-2
395-
query: "yyyy"
394+
- keptnMetricRef:
395+
name: memory
396+
namespace: ns
396397
evaluationTarget: >4
397398
```
398399

399-
### Keptn Evaluation Provider
400+
### KeptnMetricsProvider
400401

401-
A `KeptnEvaluationProvider` is a CRD used to define evaluation provider, which will provide data for the
402-
pre- and post-analysis phases of a workload or application.
402+
A `KeptnMetricsProvider` CRD defines the evaluation provider that provides data for the
403+
pre- and post-analysis phases of a Keptn workload or Keptn application.
403404

404-
A Keptn evaluation provider looks like the following:
405+
A KeptnMetricsProvider definition looks like the following:
405406

406407
```yaml
407-
apiVersion: lifecycle.keptn.sh/v1alpha2
408-
kind: KeptnEvaluationProvider
408+
apiVersion: metrics.keptn.sh/v1alpha2
409+
kind: KeptnMetricsProvider
409410
metadata:
410411
name: prometheus
411412
spec:
@@ -414,16 +415,20 @@ spec:
414415
key: prometheusLoginCredentials
415416
```
416417

417-
### Keptn Metric
418+
**Note:** The KeptnMetricsProvider is a new resource in KLT 0.7.0.
419+
The [migration documentation](./docs/content/en/docs/tasks/migrate-keptnevaluationprovider/_index.md)
420+
provides information about how to upgrade from 0.6.0 and earlier versions to 0.7.0.
418421

419-
A `KeptnMetric` is a CRD used to define SLI provider with a query and to store metric data fetched from the provider.
420-
Providing the metrics as CRD into a K8s cluster will facilitate the reusability of this data across multiple components.
422+
### KeptnMetric
423+
424+
A `KeptnMetric` CRD defines the SLI provider with a query and stores metric data fetched from the provider.
425+
Providing the metrics as CRD into a Kubernetes cluster makes this data reusable across multiple projects or workloads.
421426
Furthermore, this allows using multiple observability platforms for different metrics.
422427

423-
A `KeptnMetric` looks like the following:
428+
A KeptnMetric definition looks like the following:
424429

425430
```yaml
426-
apiVersion: metrics.keptn.sh/v1alpha1
431+
apiVersion: metrics.keptn.sh/v1alpha2
427432
kind: KeptnMetric
428433
metadata:
429434
name: keptnmetric-sample
@@ -435,12 +440,16 @@ spec:
435440
fetchIntervalSeconds: 5
436441
```
437442

438-
To be able to use `KeptnMetric` as part of your evaluation, you need to add `keptn-metric` as your value
439-
for `.spec.source` in `KeptnEvaluationDefiniton`. Further you need specify
440-
the `.spec.objectives[i].name` of `KeptnEvaluationDefiniton` to the same value as it is stored in `.metadata.name`
441-
of `KeptnMetric` resource. The `.spec.objectives[i].query` parameter
442-
of `KeptnEvaluationDefiniton` will be ignored and `.spec.query` of `KeptnMetric` will be use instead as a query to fetch
443-
the data.
443+
To use `KeptnMetric` as part of your evaluation, you must set the
444+
`.spec.objectives[i].keptnMetricRef.name` and `.spec.objectives[i].keptnMetricRef.namespace` of
445+
`KeptnEvaluationDefiniton` resource to the same value that is stored in `.metadata.name` and `metadata.namespace`
446+
of the `KeptnMetric` resource. Specifying the `.spec.objectives[i].keptnMetricRef.namespace` is optional.
447+
If it's not specified, KLT searches for the `KeptnMetric` resource in the namespace where `KeptnEvaluationDefinition`
448+
resource is stored. If the `KeptnMetric` resource cannot be found there, it searches in the default KLT namespace (`keptn-lifecycle-toolkit-system`).
449+
450+
**Note:** Please be aware that, if
451+
the `.spec.objectives[i].keptnMetricRef.namespace` of `KeptnEvaluationDefinition`
452+
resource is specified and the `KeptnMetric` resource does not exist in this namespace, the evaluation fails.
444453

445454
## Install a dev build
446455

docs/content/en/docs/snippets/tasks/install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ In version 0.6.0 and later, you can install the Lifecycle Toolkit using the curr
77
<!---x-release-please-start-version-->
88

99
```shell
10-
kubectl apply -f https://github.com/keptn/lifecycle-toolkit/releases/download/v0.5.0/manifest.yaml
10+
kubectl apply -f https://github.com/keptn/lifecycle-toolkit/releases/download/v0.6.0/manifest.yaml
1111
kubectl wait --for=condition=Available deployment/lifecycle-operator -n keptn-lifecycle-toolkit-system --timeout=120s
1212
```
1313

0 commit comments

Comments
 (0)