From 68942a70c24aafa1d80a607ad9b915f0253bdb48 Mon Sep 17 00:00:00 2001 From: David Ahmadov Date: Tue, 19 Dec 2023 06:10:12 +0000 Subject: [PATCH] new docs Signed-off-by: David Ahmadov --- .../assets/yaml-crd-ref-template.md_1.yaml | 6 + .../contribute/docs/yaml-crd-ref-template.md | 9 +- .../assets/usecase-orchestrate.md_1.yaml | 11 ++ .../assets/usecase-orchestrate.md_2.yaml | 11 ++ .../docs/core-concepts/usecase-orchestrate.md | 28 +-- .../assets/lifecycle-management.md_1.yaml | 21 +++ .../assets/lifecycle-management.md_2.yaml | 15 ++ .../assets/lifecycle-management.md_3.yaml | 7 + .../assets/lifecycle-management.md_4.yaml | 26 +++ .../getting-started/assets/metrics.md_1.yaml | 7 + .../getting-started/assets/metrics.md_2.yaml | 11 ++ .../getting-started/assets/metrics.md_3.yaml | 21 +++ .../getting-started/assets/metrics.md_4.yaml | 1 + .../getting-started/assets/metrics.md_5.yaml | 23 +++ .../assets/observability.md_1.yaml | 9 + .../assets/observability.md_2.yaml | 6 + .../assets/observability.md_3.yaml | 39 ++++ .../assets/observability.md_4.yaml | 6 + .../assets/observability.md_5.yaml | 39 ++++ .../assets/observability.md_6.yaml | 10 ++ .../assets/observability.md_7.yaml | 21 +++ .../assets/observability.md_8.yaml | 16 ++ .../getting-started/lifecycle-management.md | 81 +-------- docs-new/docs/getting-started/metrics.md | 78 +------- .../docs/getting-started/observability.md | 170 +----------------- .../assets/auto-app-discovery.md_1.yaml | 3 + .../assets/auto-app-discovery.md_2.yaml | 42 +++++ .../assets/auto-app-discovery.md_3.yaml | 14 ++ .../guides/assets/evaluatemetrics.md_1.yaml | 8 + .../guides/assets/evaluatemetrics.md_2.yaml | 11 ++ .../guides/assets/evaluatemetrics.md_3.yaml | 21 +++ .../guides/assets/evaluatemetrics.md_4.yaml | 11 ++ .../docs/guides/assets/integrate.md_1.yaml | 4 + .../docs/guides/assets/integrate.md_2.yaml | 3 + .../docs/guides/assets/integrate.md_3.yaml | 4 + .../restart-application-deployment.md_1.yaml | 62 +++++++ .../restart-application-deployment.md_2.yaml | 10 ++ .../restart-application-deployment.md_3.yaml | 13 ++ docs-new/docs/guides/assets/tasks.md_1.yaml | 13 ++ docs-new/docs/guides/assets/tasks.md_2.yaml | 13 ++ docs-new/docs/guides/assets/tasks.md_3.yaml | 15 ++ docs-new/docs/guides/assets/tasks.md_4.yaml | 8 + docs-new/docs/guides/assets/tasks.md_5.yaml | 16 ++ docs-new/docs/guides/auto-app-discovery.md | 68 +------ docs-new/docs/guides/evaluatemetrics.md | 63 +------ docs-new/docs/guides/integrate.md | 20 +-- .../guides/restart-application-deployment.md | 94 +--------- docs-new/docs/guides/tasks.md | 80 +-------- .../docs/installation/assets/index.md_1.yaml | 6 + .../docs/installation/assets/index.md_2.yaml | 1 + .../installation/assets/tips-tricks.md_1.yaml | 6 + .../assets/cert-manager.md_1.yaml | 23 +++ .../configuration/cert-manager.md | 26 +-- docs-new/docs/installation/index.md | 13 +- docs-new/docs/installation/tips-tricks.md | 9 +- .../migrate/assets/metrics-observe.md_1.yaml | 27 +++ .../migrate/assets/metrics-observe.md_2.yaml | 10 ++ .../migrate/assets/metrics-observe.md_3.yaml | 14 ++ docs-new/docs/migrate/metrics-observe.md | 60 +------ .../docs/reference/crd-reference/analysis.md | 21 +-- .../crd-reference/analysisdefinition.md | 56 +----- .../crd-reference/analysisvaluetemplate.md | 12 +- docs-new/docs/reference/crd-reference/app.md | 43 +---- .../crd-reference/assets/analysis.md_1.yaml | 18 ++ .../assets/analysisdefinition.md_1.yaml | 22 +++ .../assets/analysisdefinition.md_2.yaml | 28 +++ .../assets/analysisvaluetemplate.md_1.yaml | 9 + .../crd-reference/assets/app.md_1.yaml | 21 +++ .../crd-reference/assets/app.md_2.yaml | 16 ++ .../crd-reference/assets/config.md_1.yaml | 8 + .../crd-reference/assets/config.md_2.yaml | 8 + .../assets/evaluationdefinition.md_1.yaml | 10 ++ .../assets/evaluationdefinition.md_2.yaml | 16 ++ .../assets/evaluationdefinition.md_3.yaml | 13 ++ .../crd-reference/assets/metric.md_1.yaml | 18 ++ .../crd-reference/assets/metric.md_2.yaml | 12 ++ .../crd-reference/assets/metric.md_3.yaml | 7 + .../assets/metricsprovider.md_1.yaml | 12 ++ .../assets/metricsprovider.md_2.yaml | 10 ++ .../assets/metricsprovider.md_3.yaml | 10 ++ .../crd-reference/assets/task.md_1.yaml | 18 ++ .../assets/taskdefinition.md_1.yaml | 9 + .../assets/taskdefinition.md_2.yaml | 9 + .../assets/taskdefinition.md_3.yaml | 12 ++ .../assets/taskdefinition.md_4.yaml | 12 ++ .../assets/taskdefinition.md_5.yaml | 15 ++ .../assets/taskdefinition.md_6.yaml | 8 + .../assets/taskdefinition.md_7.yaml | 13 ++ .../assets/taskdefinition.md_8.yaml | 8 + .../assets/taskdefinition.md_9.yaml | 30 ++++ .../docs/reference/crd-reference/config.md | 22 +-- .../crd-reference/evaluationdefinition.md | 48 +---- .../docs/reference/crd-reference/metric.md | 46 +---- .../crd-reference/metricsprovider.md | 41 +---- docs-new/docs/reference/crd-reference/task.md | 21 +-- .../reference/crd-reference/taskdefinition.md | 143 +-------------- .../docs/use-cases/assets/non-k8s.md_1.yaml | 12 ++ .../docs/use-cases/assets/non-k8s.md_2.yaml | 13 ++ .../docs/use-cases/assets/non-k8s.md_3.yaml | 13 ++ docs-new/docs/use-cases/non-k8s.md | 47 +---- 100 files changed, 1149 insertions(+), 1224 deletions(-) create mode 100644 docs-new/docs/contribute/docs/assets/yaml-crd-ref-template.md_1.yaml create mode 100644 docs-new/docs/core-concepts/assets/usecase-orchestrate.md_1.yaml create mode 100644 docs-new/docs/core-concepts/assets/usecase-orchestrate.md_2.yaml create mode 100644 docs-new/docs/getting-started/assets/lifecycle-management.md_1.yaml create mode 100644 docs-new/docs/getting-started/assets/lifecycle-management.md_2.yaml create mode 100644 docs-new/docs/getting-started/assets/lifecycle-management.md_3.yaml create mode 100644 docs-new/docs/getting-started/assets/lifecycle-management.md_4.yaml create mode 100644 docs-new/docs/getting-started/assets/metrics.md_1.yaml create mode 100644 docs-new/docs/getting-started/assets/metrics.md_2.yaml create mode 100644 docs-new/docs/getting-started/assets/metrics.md_3.yaml create mode 100644 docs-new/docs/getting-started/assets/metrics.md_4.yaml create mode 100644 docs-new/docs/getting-started/assets/metrics.md_5.yaml create mode 100644 docs-new/docs/getting-started/assets/observability.md_1.yaml create mode 100644 docs-new/docs/getting-started/assets/observability.md_2.yaml create mode 100644 docs-new/docs/getting-started/assets/observability.md_3.yaml create mode 100644 docs-new/docs/getting-started/assets/observability.md_4.yaml create mode 100644 docs-new/docs/getting-started/assets/observability.md_5.yaml create mode 100644 docs-new/docs/getting-started/assets/observability.md_6.yaml create mode 100644 docs-new/docs/getting-started/assets/observability.md_7.yaml create mode 100644 docs-new/docs/getting-started/assets/observability.md_8.yaml create mode 100644 docs-new/docs/guides/assets/auto-app-discovery.md_1.yaml create mode 100644 docs-new/docs/guides/assets/auto-app-discovery.md_2.yaml create mode 100644 docs-new/docs/guides/assets/auto-app-discovery.md_3.yaml create mode 100644 docs-new/docs/guides/assets/evaluatemetrics.md_1.yaml create mode 100644 docs-new/docs/guides/assets/evaluatemetrics.md_2.yaml create mode 100644 docs-new/docs/guides/assets/evaluatemetrics.md_3.yaml create mode 100644 docs-new/docs/guides/assets/evaluatemetrics.md_4.yaml create mode 100644 docs-new/docs/guides/assets/integrate.md_1.yaml create mode 100644 docs-new/docs/guides/assets/integrate.md_2.yaml create mode 100644 docs-new/docs/guides/assets/integrate.md_3.yaml create mode 100644 docs-new/docs/guides/assets/restart-application-deployment.md_1.yaml create mode 100644 docs-new/docs/guides/assets/restart-application-deployment.md_2.yaml create mode 100644 docs-new/docs/guides/assets/restart-application-deployment.md_3.yaml create mode 100644 docs-new/docs/guides/assets/tasks.md_1.yaml create mode 100644 docs-new/docs/guides/assets/tasks.md_2.yaml create mode 100644 docs-new/docs/guides/assets/tasks.md_3.yaml create mode 100644 docs-new/docs/guides/assets/tasks.md_4.yaml create mode 100644 docs-new/docs/guides/assets/tasks.md_5.yaml create mode 100644 docs-new/docs/installation/assets/index.md_1.yaml create mode 100644 docs-new/docs/installation/assets/index.md_2.yaml create mode 100644 docs-new/docs/installation/assets/tips-tricks.md_1.yaml create mode 100644 docs-new/docs/installation/configuration/assets/cert-manager.md_1.yaml create mode 100644 docs-new/docs/migrate/assets/metrics-observe.md_1.yaml create mode 100644 docs-new/docs/migrate/assets/metrics-observe.md_2.yaml create mode 100644 docs-new/docs/migrate/assets/metrics-observe.md_3.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/analysis.md_1.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/analysisdefinition.md_1.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/analysisdefinition.md_2.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/analysisvaluetemplate.md_1.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/app.md_1.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/app.md_2.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/config.md_1.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/config.md_2.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_1.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_2.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_3.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/metric.md_1.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/metric.md_2.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/metric.md_3.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/metricsprovider.md_1.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/metricsprovider.md_2.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/metricsprovider.md_3.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/task.md_1.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/taskdefinition.md_1.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/taskdefinition.md_2.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/taskdefinition.md_3.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/taskdefinition.md_4.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/taskdefinition.md_5.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/taskdefinition.md_6.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/taskdefinition.md_7.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/taskdefinition.md_8.yaml create mode 100644 docs-new/docs/reference/crd-reference/assets/taskdefinition.md_9.yaml create mode 100644 docs-new/docs/use-cases/assets/non-k8s.md_1.yaml create mode 100644 docs-new/docs/use-cases/assets/non-k8s.md_2.yaml create mode 100644 docs-new/docs/use-cases/assets/non-k8s.md_3.yaml diff --git a/docs-new/docs/contribute/docs/assets/yaml-crd-ref-template.md_1.yaml b/docs-new/docs/contribute/docs/assets/yaml-crd-ref-template.md_1.yaml new file mode 100644 index 00000000000..7b7a9d8351a --- /dev/null +++ b/docs-new/docs/contribute/docs/assets/yaml-crd-ref-template.md_1.yaml @@ -0,0 +1,6 @@ +apiVersion: +kind: +metadata: + name: +spec: + ... diff --git a/docs-new/docs/contribute/docs/yaml-crd-ref-template.md b/docs-new/docs/contribute/docs/yaml-crd-ref-template.md index d68094617ca..83e4d75a69d 100644 --- a/docs-new/docs/contribute/docs/yaml-crd-ref-template.md +++ b/docs-new/docs/contribute/docs/yaml-crd-ref-template.md @@ -8,14 +8,7 @@ Copy this template to create a new CRD reference page. ## Synopsis -```yaml -apiVersion: -kind: -metadata: - name: -spec: - ... -``` +{% include "yaml-crd-ref-template.md_1.yaml" %} ## Fields diff --git a/docs-new/docs/core-concepts/assets/usecase-orchestrate.md_1.yaml b/docs-new/docs/core-concepts/assets/usecase-orchestrate.md_1.yaml new file mode 100644 index 00000000000..fbaaa666370 --- /dev/null +++ b/docs-new/docs/core-concepts/assets/usecase-orchestrate.md_1.yaml @@ -0,0 +1,11 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnEvaluationDefinition +metadata: + name: evaluate-dependencies + namespace: simplenode-dev +spec: + objectives: + - keptnMetricRef: + name: available-cpus + namespace: simplenode-dev + evaluationTarget: ">4" diff --git a/docs-new/docs/core-concepts/assets/usecase-orchestrate.md_2.yaml b/docs-new/docs/core-concepts/assets/usecase-orchestrate.md_2.yaml new file mode 100644 index 00000000000..c7b086b2620 --- /dev/null +++ b/docs-new/docs/core-concepts/assets/usecase-orchestrate.md_2.yaml @@ -0,0 +1,11 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTaskDefinition +metadata: + name: notify +spec: + function: + inline: + code: | + + secureParameters: + secret: slack-notification diff --git a/docs-new/docs/core-concepts/usecase-orchestrate.md b/docs-new/docs/core-concepts/usecase-orchestrate.md index 50a01832e90..29e595a096e 100644 --- a/docs-new/docs/core-concepts/usecase-orchestrate.md +++ b/docs-new/docs/core-concepts/usecase-orchestrate.md @@ -94,19 +94,7 @@ file. For example, the definition of the `evaluate-dependencies` evaluation looks like this: -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnEvaluationDefinition -metadata: - name: evaluate-dependencies - namespace: simplenode-dev -spec: - objectives: - - keptnMetricRef: - name: available-cpus - namespace: simplenode-dev - evaluationTarget: ">4" -``` +{% include "usecase-orchestrate.md_1.yaml" %} You see that the `available-cpus` metric is defined in the [keptn-metric.yaml](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/keptn-metric.yaml) @@ -128,19 +116,7 @@ we have a `notify` task that composes some Markdown text to be sent as Slack notifications The `KeptnTaskDefinition` looks like this: -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnTaskDefinition -metadata: - name: notify -spec: - function: - inline: - code: | - - secureParameters: - secret: slack-notification -``` +{% include "usecase-orchestrate.md_2.yaml" %} The code to be executed is expressed as a [Deno](https://deno.com) diff --git a/docs-new/docs/getting-started/assets/lifecycle-management.md_1.yaml b/docs-new/docs/getting-started/assets/lifecycle-management.md_1.yaml new file mode 100644 index 00000000000..6f85d1db9e2 --- /dev/null +++ b/docs-new/docs/getting-started/assets/lifecycle-management.md_1.yaml @@ -0,0 +1,21 @@ +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTaskDefinition +metadata: + name: send-event + namespace: keptndemo +spec: + retries: 0 + timeout: 5s + container: + name: curlcontainer + image: curlimages/curl:latest + args: [ + '-X', + 'POST', + 'http://webhook.webhook.svc.cluster.local:8084/YOUR-UUID-HERE', + '-H', + 'Content-Type: application/json', + '-d', + '{ "from": "keptn send-event" }' + ] diff --git a/docs-new/docs/getting-started/assets/lifecycle-management.md_2.yaml b/docs-new/docs/getting-started/assets/lifecycle-management.md_2.yaml new file mode 100644 index 00000000000..59011b62b7d --- /dev/null +++ b/docs-new/docs/getting-started/assets/lifecycle-management.md_2.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTask +metadata: + name: runsendevent1 + namespace: keptndemo +spec: + taskDefinition: send-event + context: + appName: "my-test-app" + appVersion: "1.0.0" + objectType: "" + taskType: "" + workloadName: "my-test-workload" + workloadVersion: "1.0.0" diff --git a/docs-new/docs/getting-started/assets/lifecycle-management.md_3.yaml b/docs-new/docs/getting-started/assets/lifecycle-management.md_3.yaml new file mode 100644 index 00000000000..221c28cf5dc --- /dev/null +++ b/docs-new/docs/getting-started/assets/lifecycle-management.md_3.yaml @@ -0,0 +1,7 @@ +... +labels: + app.kubernetes.io/part-of: keptndemoapp + app.kubernetes.io/name: nginx + app.kubernetes.io/version: 0.0.2 + keptn.sh/post-deployment-tasks: "send-event" +... diff --git a/docs-new/docs/getting-started/assets/lifecycle-management.md_4.yaml b/docs-new/docs/getting-started/assets/lifecycle-management.md_4.yaml new file mode 100644 index 00000000000..96802057b8a --- /dev/null +++ b/docs-new/docs/getting-started/assets/lifecycle-management.md_4.yaml @@ -0,0 +1,26 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment + namespace: keptndemo + labels: + app.kubernetes.io/name: nginx +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: nginx + template: + metadata: + labels: + app.kubernetes.io/part-of: keptndemoapp + app.kubernetes.io/name: nginx + app.kubernetes.io/version: 0.0.2 + keptn.sh/post-deployment-tasks: "send-event" + spec: + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 diff --git a/docs-new/docs/getting-started/assets/metrics.md_1.yaml b/docs-new/docs/getting-started/assets/metrics.md_1.yaml new file mode 100644 index 00000000000..faa4ccf4897 --- /dev/null +++ b/docs-new/docs/getting-started/assets/metrics.md_1.yaml @@ -0,0 +1,7 @@ +kind: KeptnMetricsProvider +metadata: + name: dev-prometheus + namespace: simplenode-dev +spec: + type: prometheus + targetserver: "http://prometheus-k8s-monitoring-svc.cluster.local:9090" diff --git a/docs-new/docs/getting-started/assets/metrics.md_2.yaml b/docs-new/docs/getting-started/assets/metrics.md_2.yaml new file mode 100644 index 00000000000..21f8a60b932 --- /dev/null +++ b/docs-new/docs/getting-started/assets/metrics.md_2.yaml @@ -0,0 +1,11 @@ +kind: KeptnMetricsProvider +metadata: + name: dev-dynatrace + namespace: simplenode-dev +spec: + type: dynatrace + targetServer: "https://hci34192.live.dynatrace.com" + secretKeyRef: + name: dynatrace + key: DT_TOKEN +... diff --git a/docs-new/docs/getting-started/assets/metrics.md_3.yaml b/docs-new/docs/getting-started/assets/metrics.md_3.yaml new file mode 100644 index 00000000000..de11d4f0b28 --- /dev/null +++ b/docs-new/docs/getting-started/assets/metrics.md_3.yaml @@ -0,0 +1,21 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: Keptnmetric +metadata: + name: available-cpus + namespace: simplenode-dev +spec: + provider: + name: dev-prometheus + query: "sum(kube_node_status_capacity{resources`cpu`})" + fetchIntervalSeconds: 10 +--- +apiVersion: metrics.keptn.sh/v1beta1 +kind: Keptnmetric +metadata: + name: availability-slo + namespace: simplenode-dev +spec: + provider: + name: dev-dynatrace + query: "func:slo.availability_simplenodeservice" + fetchIntervalSeconds: 10 diff --git a/docs-new/docs/getting-started/assets/metrics.md_4.yaml b/docs-new/docs/getting-started/assets/metrics.md_4.yaml new file mode 100644 index 00000000000..152b122e62b --- /dev/null +++ b/docs-new/docs/getting-started/assets/metrics.md_4.yaml @@ -0,0 +1 @@ +kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta2/namespaces//keptnmetrics.metrics.sh//" diff --git a/docs-new/docs/getting-started/assets/metrics.md_5.yaml b/docs-new/docs/getting-started/assets/metrics.md_5.yaml new file mode 100644 index 00000000000..5b6d2c6f3eb --- /dev/null +++ b/docs-new/docs/getting-started/assets/metrics.md_5.yaml @@ -0,0 +1,23 @@ +$ kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta2/namespaces/simplenode-dev/keptnmetrics.metrics.sh/available-cpus/available-cpus" + +{ + "kind": "MetricValueList", + "apiVersion": "custom.metrics.k8s.io/v1beta2", + "metadata": {}, + "items": [ + { + "describedObject": { + "kind": "KeptnMetric", + "namespace": "simplenode-dev", + "name": "available-cpus", + "apiVersion": "metrics.keptn.sh/v1beta1" + }, + "metric": { + "name": "available-cpus", + "selector": {} + }, + "timestamp": "2023-05-11T08:05:36Z", + "value": "6" + } + ] +} diff --git a/docs-new/docs/getting-started/assets/observability.md_1.yaml b/docs-new/docs/getting-started/assets/observability.md_1.yaml new file mode 100644 index 00000000000..e36ed40f5ce --- /dev/null +++ b/docs-new/docs/getting-started/assets/observability.md_1.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: options.keptn.sh/v1alpha1 +kind: KeptnConfig +metadata: + name: keptnconfig-sample + namespace: keptn-system +spec: + OTelCollectorUrl: 'jaeger-collector.keptn-system.svc.cluster.local:4317' + keptnAppCreationRequestTimeoutSeconds: 30 diff --git a/docs-new/docs/getting-started/assets/observability.md_2.yaml b/docs-new/docs/getting-started/assets/observability.md_2.yaml new file mode 100644 index 00000000000..5d855d58041 --- /dev/null +++ b/docs-new/docs/getting-started/assets/observability.md_2.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: keptndemo + annotations: + keptn.sh/lifecycle-toolkit: enabled diff --git a/docs-new/docs/getting-started/assets/observability.md_3.yaml b/docs-new/docs/getting-started/assets/observability.md_3.yaml new file mode 100644 index 00000000000..db689656a16 --- /dev/null +++ b/docs-new/docs/getting-started/assets/observability.md_3.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment + namespace: keptndemo + labels: + app.kubernetes.io/name: nginx +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: nginx + template: + metadata: + labels: + app.kubernetes.io/part-of: keptndemoapp + app.kubernetes.io/name: nginx + app.kubernetes.io/version: 0.0.1 + spec: + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 +--- +apiVersion: apps/v1 +kind: Service +apiVersion: v1 +kind: Service +metadata: + name: nginx + namespace: keptndemo +spec: + selector: + app.kubernetes.io/name: nginx + ports: + - protocol: TCP + port: 8080 + targetPort: 80 diff --git a/docs-new/docs/getting-started/assets/observability.md_4.yaml b/docs-new/docs/getting-started/assets/observability.md_4.yaml new file mode 100644 index 00000000000..ab6039c6f21 --- /dev/null +++ b/docs-new/docs/getting-started/assets/observability.md_4.yaml @@ -0,0 +1,6 @@ +apiVersion: jaegertracing.io/v1 +kind: Jaeger +metadata: + name: jaeger +spec: + strategy: allInOne diff --git a/docs-new/docs/getting-started/assets/observability.md_5.yaml b/docs-new/docs/getting-started/assets/observability.md_5.yaml new file mode 100644 index 00000000000..a0ed412e1d7 --- /dev/null +++ b/docs-new/docs/getting-started/assets/observability.md_5.yaml @@ -0,0 +1,39 @@ +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + labels: + grafana_datasource: "1" + name: grafana-datasources + namespace: monitoring +stringData: + datasources.yaml: |- + { + "apiVersion": 1, + "datasources": [ + { + "access": "proxy", + "editable": false, + "name": "prometheus", + "orgId": 1, + "type": "prometheus", + "url": "http://observability-stack-kube-p-prometheus.monitoring.svc:9090", + "version": 1 + }, + { + "orgId":1, + "name":"Jaeger", + "type":"jaeger", + "typeName":"Jaeger", + "typeLogoUrl":"public/app/plugins/datasource/jaeger/img/jaeger_logo.svg", + "access":"proxy", + "url":"http://jaeger-query.keptn-system.svc.cluster.local:16686", + "user":"", + "database":"", + "basicAuth":false, + "isDefault":false, + "jsonData":{"spanBar":{"type":"None"}}, + "readOnly":false + } + ] + } diff --git a/docs-new/docs/getting-started/assets/observability.md_6.yaml b/docs-new/docs/getting-started/assets/observability.md_6.yaml new file mode 100644 index 00000000000..dadb233f68c --- /dev/null +++ b/docs-new/docs/getting-started/assets/observability.md_6.yaml @@ -0,0 +1,10 @@ +grafana: + adminPassword: admin + sidecar.datasources.defaultDatasourceEnabled: false +prometheus: + prometheusSpec: + additionalScrapeConfigs: + - job_name: "scrape_klt" + scrape_interval: 5s + static_configs: + - targets: ['lifecycle-operator-metrics-service.keptn-system.svc.cluster.local:2222'] diff --git a/docs-new/docs/getting-started/assets/observability.md_7.yaml b/docs-new/docs/getting-started/assets/observability.md_7.yaml new file mode 100644 index 00000000000..3d365e2949a --- /dev/null +++ b/docs-new/docs/getting-started/assets/observability.md_7.yaml @@ -0,0 +1,21 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnApp +metadata: + name: + namespace: +spec: + version: "x.y" + revision: x + workloads: + - name: + version: + - name: + version: + preDeploymentTasks: + - + postDeploymentTasks: + - + preDeploymentEvaluations: + - + postDeploymentEvaluations: + - diff --git a/docs-new/docs/getting-started/assets/observability.md_8.yaml b/docs-new/docs/getting-started/assets/observability.md_8.yaml new file mode 100644 index 00000000000..4416ee049e1 --- /dev/null +++ b/docs-new/docs/getting-started/assets/observability.md_8.yaml @@ -0,0 +1,16 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnApp +metadata: + name: podtato-head + namespace: podtato-kubectl +spec: + version: "latest" + workloads: + - name: podtato-head-left-arm + version: "my_vers12.5" + - name: podtato-head-left-leg + version: "my_v24" + postDeploymentTasks: + - post-deployment-hello + preDeploymentEvaluations: + - my-prometheus-definition diff --git a/docs-new/docs/getting-started/lifecycle-management.md b/docs-new/docs/getting-started/lifecycle-management.md index f77ebe9c25b..cd172f52283 100644 --- a/docs-new/docs/getting-started/lifecycle-management.md +++ b/docs-new/docs/getting-started/lifecycle-management.md @@ -71,29 +71,7 @@ Add a task which will trigger after a deployment. Change `UUID` to whatever value you have. Apply this manifest: -```yaml ---- -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnTaskDefinition -metadata: - name: send-event - namespace: keptndemo -spec: - retries: 0 - timeout: 5s - container: - name: curlcontainer - image: curlimages/curl:latest - args: [ - '-X', - 'POST', - 'http://webhook.webhook.svc.cluster.local:8084/YOUR-UUID-HERE', - '-H', - 'Content-Type: application/json', - '-d', - '{ "from": "keptn send-event" }' - ] -``` +{% include "lifecycle-management.md_1.yaml" %} ### Verify it works @@ -105,23 +83,7 @@ In the following steps we will have Keptn orchestrate this for us automatically. Apply this manifest: -```yaml ---- -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnTask -metadata: - name: runsendevent1 - namespace: keptndemo -spec: - taskDefinition: send-event - context: - appName: "my-test-app" - appVersion: "1.0.0" - objectType: "" - taskType: "" - workloadName: "my-test-workload" - workloadVersion: "1.0.0" -``` +{% include "lifecycle-management.md_2.yaml" %} If it works, `kubectl -n keptndemo get jobs` should show: @@ -151,48 +113,13 @@ Getting started guide. Add a new label so the `labels` section looks like this: -```yaml -... -labels: - app.kubernetes.io/part-of: keptndemoapp - app.kubernetes.io/name: nginx - app.kubernetes.io/version: 0.0.2 - keptn.sh/post-deployment-tasks: "send-event" -... -``` +{% include "lifecycle-management.md_3.yaml" %} Increase the version number to `0.0.2` and re-apply the manifest. Here is a full version of the new YAML: -```yaml ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nginx-deployment - namespace: keptndemo - labels: - app.kubernetes.io/name: nginx -spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/name: nginx - template: - metadata: - labels: - app.kubernetes.io/part-of: keptndemoapp - app.kubernetes.io/name: nginx - app.kubernetes.io/version: 0.0.2 - keptn.sh/post-deployment-tasks: "send-event" - spec: - containers: - - name: nginx - image: nginx:1.14.2 - ports: - - containerPort: 80 -``` +{% include "lifecycle-management.md_4.yaml" %} > Best Practice: Start with post deployment tasks. > Pre-deployment tasks can potentially block deployments (see below). diff --git a/docs-new/docs/getting-started/metrics.md b/docs-new/docs/getting-started/metrics.md index e75330ee26b..b0871536bec 100644 --- a/docs-new/docs/getting-started/metrics.md +++ b/docs-new/docs/getting-started/metrics.md @@ -102,15 +102,7 @@ Definition of [dev-prometheus](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/keptn-prometheus-provider.yaml) data source: -```yaml -kind: KeptnMetricsProvider -metadata: - name: dev-prometheus - namespace: simplenode-dev -spec: - type: prometheus - targetserver: "http://prometheus-k8s-monitoring-svc.cluster.local:9090" -``` +{% include "metrics.md_1.yaml" %} Definition of the [dev-dynatrace](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/dynatrace-provider.yaml.tmp) @@ -118,19 +110,7 @@ data source. Note that the `dev-dynatrace` server is protected by a secret key so that information is included in the provider definition: -```yaml -kind: KeptnMetricsProvider -metadata: - name: dev-dynatrace - namespace: simplenode-dev -spec: - type: dynatrace - targetServer: "https://hci34192.live.dynatrace.com" - secretKeyRef: - name: dynatrace - key: DT_TOKEN -... -``` +{% include "metrics.md_2.yaml" %} ### Define KeptnMetric information @@ -153,29 +133,7 @@ The [keptn-metric.yaml](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/keptn-metric.yaml) file for our example looks like: -```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: Keptnmetric -metadata: - name: available-cpus - namespace: simplenode-dev -spec: - provider: - name: dev-prometheus - query: "sum(kube_node_status_capacity{resources`cpu`})" - fetchIntervalSeconds: 10 ---- -apiVersion: metrics.keptn.sh/v1beta1 -kind: Keptnmetric -metadata: - name: availability-slo - namespace: simplenode-dev -spec: - provider: - name: dev-dynatrace - query: "func:slo.availability_simplenodeservice" - fetchIntervalSeconds: 10 -``` +{% include "metrics.md_3.yaml" %} Note the following: @@ -233,37 +191,11 @@ cpu-throttling my-provider sum(kube_node_status_capacity{resource=`cpu`}) 6 The syntax to retrieve metrics through the Kubernetes API is: -```yaml -kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta2/namespaces//keptnmetrics.metrics.sh//" -``` +{% include "metrics.md_4.yaml" %} For example, the output for the `available-cpus` looks like: -```yaml -$ kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta2/namespaces/simplenode-dev/keptnmetrics.metrics.sh/available-cpus/available-cpus" - -{ - "kind": "MetricValueList", - "apiVersion": "custom.metrics.k8s.io/v1beta2", - "metadata": {}, - "items": [ - { - "describedObject": { - "kind": "KeptnMetric", - "namespace": "simplenode-dev", - "name": "available-cpus", - "apiVersion": "metrics.keptn.sh/v1beta1" - }, - "metric": { - "name": "available-cpus", - "selector": {} - }, - "timestamp": "2023-05-11T08:05:36Z", - "value": "6" - } - ] -} -``` +{% include "metrics.md_5.yaml" %} You can also display the metrics graphically using a dashboard such as Grafana. diff --git a/docs-new/docs/getting-started/observability.md b/docs-new/docs/getting-started/observability.md index dc2ea221a51..83955774120 100644 --- a/docs-new/docs/getting-started/observability.md +++ b/docs-new/docs/getting-started/observability.md @@ -60,17 +60,7 @@ but creating this configuration now means the system is preconfigured. Save this file as `keptnconfig.yaml`. It doesn't matter where this file is located on your local machine: -```yaml ---- -apiVersion: options.keptn.sh/v1alpha1 -kind: KeptnConfig -metadata: - name: keptnconfig-sample - namespace: keptn-system -spec: - OTelCollectorUrl: 'jaeger-collector.keptn-system.svc.cluster.local:4317' - keptnAppCreationRequestTimeoutSeconds: 30 -``` +{% include "observability.md_1.yaml" %} Apply the file and wait for Keptn to pick up the new configuration: @@ -87,14 +77,7 @@ and can be influenced by network latency. Save this file as `namespace.yaml`. The annotation means that Keptn is active for workloads in this namespace. -```yaml -apiVersion: v1 -kind: Namespace -metadata: - name: keptndemo - annotations: - keptn.sh/lifecycle-toolkit: enabled -``` +{% include "observability.md_2.yaml" %} Create the namespace: @@ -108,47 +91,7 @@ It is time to deploy the demo application. Save this manifest as `app.yaml`: -```yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nginx-deployment - namespace: keptndemo - labels: - app.kubernetes.io/name: nginx -spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/name: nginx - template: - metadata: - labels: - app.kubernetes.io/part-of: keptndemoapp - app.kubernetes.io/name: nginx - app.kubernetes.io/version: 0.0.1 - spec: - containers: - - name: nginx - image: nginx:1.14.2 - ports: - - containerPort: 80 ---- -apiVersion: apps/v1 -kind: Service -apiVersion: v1 -kind: Service -metadata: - name: nginx - namespace: keptndemo -spec: - selector: - app.kubernetes.io/name: nginx - ports: - - protocol: TCP - port: 8080 - targetPort: 80 -``` +{% include "observability.md_3.yaml" %} Now apply it: @@ -296,14 +239,7 @@ helm install cert-manager --namespace cert-manager --version v1.12.2 jetstack/ce Save this file as `jaeger.yaml` (it can be saved anywhere on your computer): -```yaml -apiVersion: jaegertracing.io/v1 -kind: Jaeger -metadata: - name: jaeger -spec: - strategy: allInOne -``` +{% include "observability.md_4.yaml" %} Install Jaeger to store and visualise the deployment traces generated by Keptn: @@ -343,47 +279,7 @@ This file will configure Grafana to look at the Jaeger service and the Prometheu Save this file as `datasources.yaml`: -```yaml -apiVersion: v1 -kind: Secret -type: Opaque -metadata: - labels: - grafana_datasource: "1" - name: grafana-datasources - namespace: monitoring -stringData: - datasources.yaml: |- - { - "apiVersion": 1, - "datasources": [ - { - "access": "proxy", - "editable": false, - "name": "prometheus", - "orgId": 1, - "type": "prometheus", - "url": "http://observability-stack-kube-p-prometheus.monitoring.svc:9090", - "version": 1 - }, - { - "orgId":1, - "name":"Jaeger", - "type":"jaeger", - "typeName":"Jaeger", - "typeLogoUrl":"public/app/plugins/datasource/jaeger/img/jaeger_logo.svg", - "access":"proxy", - "url":"http://jaeger-query.keptn-system.svc.cluster.local:16686", - "user":"", - "database":"", - "basicAuth":false, - "isDefault":false, - "jsonData":{"spanBar":{"type":"None"}}, - "readOnly":false - } - ] - } -``` +{% include "observability.md_5.yaml" %} Now apply it: @@ -401,18 +297,7 @@ This will install: Save this file as `values.yaml`: -```yaml -grafana: - adminPassword: admin - sidecar.datasources.defaultDatasourceEnabled: false -prometheus: - prometheusSpec: - additionalScrapeConfigs: - - job_name: "scrape_klt" - scrape_interval: 5s - static_configs: - - targets: ['lifecycle-operator-metrics-service.keptn-system.svc.cluster.local:2222'] -``` +{% include "observability.md_6.yaml" %} ```shell helm repo add prometheus-community https://prometheus-community.github.io/helm-charts @@ -474,29 +359,7 @@ View the Keptn Applications Dashboard and you should see the DORA metrics and an To customize workloads and checks associated with the application, we can edit the autogenerated KeptnApp or create our own. -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnApp -metadata: - name: - namespace: -spec: - version: "x.y" - revision: x - workloads: - - name: - version: - - name: - version: - preDeploymentTasks: - - - postDeploymentTasks: - - - preDeploymentEvaluations: - - - postDeploymentEvaluations: - - -``` +{% include "observability.md_7.yaml" %} ## Fields @@ -562,24 +425,7 @@ If used, these fields must be populated manually: ## Example -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnApp -metadata: - name: podtato-head - namespace: podtato-kubectl -spec: - version: "latest" - workloads: - - name: podtato-head-left-arm - version: "my_vers12.5" - - name: podtato-head-left-leg - version: "my_v24" - postDeploymentTasks: - - post-deployment-hello - preDeploymentEvaluations: - - my-prometheus-definition -``` +{% include "observability.md_8.yaml" %} You may have noticed that the `KeptnApp` Custom Resources are created automatically by Keptn. diff --git a/docs-new/docs/guides/assets/auto-app-discovery.md_1.yaml b/docs-new/docs/guides/assets/auto-app-discovery.md_1.yaml new file mode 100644 index 00000000000..87a8747b659 --- /dev/null +++ b/docs-new/docs/guides/assets/auto-app-discovery.md_1.yaml @@ -0,0 +1,3 @@ +metadata: + name: simpleapp + namespace: simplenode-dev diff --git a/docs-new/docs/guides/assets/auto-app-discovery.md_2.yaml b/docs-new/docs/guides/assets/auto-app-discovery.md_2.yaml new file mode 100644 index 00000000000..73e3f66f3ae --- /dev/null +++ b/docs-new/docs/guides/assets/auto-app-discovery.md_2.yaml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: podtato-kubectl + annotations: + keptn.sh/lifecycle-toolkit: "enabled" + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-frontend + namespace: podtato-kubectl +spec: + template: + metadata: + labels: + app.kubernetes.io/name: podtato-head-frontend + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/version: 0.1.0 + spec: + containers: + - name: podtato-head-frontend + image: podtato-head-frontend +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-hat + namespace: podtato-kubectl +spec: + replicas: 1 + template: + metadata: + labels: + app.kubernetes.io/name: podtato-head-hat + app.kubernetes.io/part-of: podtato-head + app.kubernetes.io/version: 0.1.1 + spec: + containers: + - name: podtato-head-hat + image: podtato-head-hat diff --git a/docs-new/docs/guides/assets/auto-app-discovery.md_3.yaml b/docs-new/docs/guides/assets/auto-app-discovery.md_3.yaml new file mode 100644 index 00000000000..4853bbbdd8f --- /dev/null +++ b/docs-new/docs/guides/assets/auto-app-discovery.md_3.yaml @@ -0,0 +1,14 @@ +apiVersion: lifecycle.keptn.sh/v1alpha2 +kind: KeptnApp +metadata: + name: podtato-head + namespace: podtato-kubectl + annotations: + app.kubernetes.io/managed-by: "keptn" +spec: + version: "" + workloads: + - name: podtato-head-frontend + version: 0.1.0 + - name: podtato-head-hat + version: 1.1.1 diff --git a/docs-new/docs/guides/assets/evaluatemetrics.md_1.yaml b/docs-new/docs/guides/assets/evaluatemetrics.md_1.yaml new file mode 100644 index 00000000000..981febc382f --- /dev/null +++ b/docs-new/docs/guides/assets/evaluatemetrics.md_1.yaml @@ -0,0 +1,8 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: KeptnMetricsProvider +metadata: + name: prometheus-provider + namespace: simplenode-dev +spec: + type: prometheus + targetServer: "http://prometheus-k8s.monitoring.svc.cluster.local:9090" diff --git a/docs-new/docs/guides/assets/evaluatemetrics.md_2.yaml b/docs-new/docs/guides/assets/evaluatemetrics.md_2.yaml new file mode 100644 index 00000000000..ce49be532a0 --- /dev/null +++ b/docs-new/docs/guides/assets/evaluatemetrics.md_2.yaml @@ -0,0 +1,11 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: KeptnMetricsProvider +metadata: + name: dynatrace-provider + namespace: podtato-kubectl +spec: + type: dynatrace + targetServer: "" + secretKeyRef: + name: dt-api-token + key: DT_TOKEN diff --git a/docs-new/docs/guides/assets/evaluatemetrics.md_3.yaml b/docs-new/docs/guides/assets/evaluatemetrics.md_3.yaml new file mode 100644 index 00000000000..de11d4f0b28 --- /dev/null +++ b/docs-new/docs/guides/assets/evaluatemetrics.md_3.yaml @@ -0,0 +1,21 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: Keptnmetric +metadata: + name: available-cpus + namespace: simplenode-dev +spec: + provider: + name: dev-prometheus + query: "sum(kube_node_status_capacity{resources`cpu`})" + fetchIntervalSeconds: 10 +--- +apiVersion: metrics.keptn.sh/v1beta1 +kind: Keptnmetric +metadata: + name: availability-slo + namespace: simplenode-dev +spec: + provider: + name: dev-dynatrace + query: "func:slo.availability_simplenodeservice" + fetchIntervalSeconds: 10 diff --git a/docs-new/docs/guides/assets/evaluatemetrics.md_4.yaml b/docs-new/docs/guides/assets/evaluatemetrics.md_4.yaml new file mode 100644 index 00000000000..b4bc0731226 --- /dev/null +++ b/docs-new/docs/guides/assets/evaluatemetrics.md_4.yaml @@ -0,0 +1,11 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: KeptnMetric +metadata: + name: good-metric +spec: + provider: + name: my-provider + query: "sum(kube_pod_container_resource_limits{resource='cpu'})" + fetchIntervalSeconds: 10 + range: + interval: "3m" diff --git a/docs-new/docs/guides/assets/integrate.md_1.yaml b/docs-new/docs/guides/assets/integrate.md_1.yaml new file mode 100644 index 00000000000..dcf976876c2 --- /dev/null +++ b/docs-new/docs/guides/assets/integrate.md_1.yaml @@ -0,0 +1,4 @@ +keptn.sh/workload: myAwesomeWorkload +keptn.sh/version: myAwesomeWorkloadVersion +keptn.sh/app: myAwesomeAppName +keptn.sh/container: myAwesomeContainer diff --git a/docs-new/docs/guides/assets/integrate.md_2.yaml b/docs-new/docs/guides/assets/integrate.md_2.yaml new file mode 100644 index 00000000000..d7f31beba5d --- /dev/null +++ b/docs-new/docs/guides/assets/integrate.md_2.yaml @@ -0,0 +1,3 @@ +app.kubernetes.io/name: myAwesomeWorkload +app.kubernetes.io/version: myAwesomeWorkloadVersion +app.kubernetes.io/part-of: myAwesomeAppName diff --git a/docs-new/docs/guides/assets/integrate.md_3.yaml b/docs-new/docs/guides/assets/integrate.md_3.yaml new file mode 100644 index 00000000000..5374a8769f1 --- /dev/null +++ b/docs-new/docs/guides/assets/integrate.md_3.yaml @@ -0,0 +1,4 @@ +keptn.sh/pre-deployment-evaluations: <`EvaluationDefinition`-name> +keptn.sh/pre-deployment-tasks: <`TaskDefinition`-name> +keptn.sh/post-deployment-evaluations: <`EvaluationDefinition`-name> +keptn.sh/post-deployment-tasks: <`TaskDefinition`-name> diff --git a/docs-new/docs/guides/assets/restart-application-deployment.md_1.yaml b/docs-new/docs/guides/assets/restart-application-deployment.md_1.yaml new file mode 100644 index 00000000000..36e0f830c06 --- /dev/null +++ b/docs-new/docs/guides/assets/restart-application-deployment.md_1.yaml @@ -0,0 +1,62 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: restartable-apps + annotations: + keptn.sh/lifecycle-toolkit: "enabled" +--- +apiVersion: lifecycle.keptn.sh/v1alpha2 +kind: KeptnApp +metadata: + name: podtato-head + namespace: restartable-apps +spec: + version: "0.1.1" + revision: 1 + workloads: + - name: podtato-head-entry + version: "0.1.2" + preDeploymentTasks: + - pre-deployment-check +--- +apiVersion: lifecycle.keptn.sh/v1alpha2 +kind: KeptnTaskDefinition +metadata: + name: pre-deployment-check + namespace: restartable-apps +spec: + function: + inline: + code: | + console.error("I failed") + process.exit(1) +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podtato-head-entry + namespace: restartable-apps + labels: + app: podtato-head +spec: + selector: + matchLabels: + component: podtato-head-entry + template: + metadata: + labels: + component: podtato-head-entry + keptn.sh/workload: podtato-head-entry + keptn.sh/app: podtato-head + keptn.sh/version: "0.1.2" + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: ghcr.io/podtato-head/entry:0.2.7 + imagePullPolicy: Always + ports: + - containerPort: 9000 + env: + - name: PODTATO_PORT + value: "9000" diff --git a/docs-new/docs/guides/assets/restart-application-deployment.md_2.yaml b/docs-new/docs/guides/assets/restart-application-deployment.md_2.yaml new file mode 100644 index 00000000000..b8c258a9c18 --- /dev/null +++ b/docs-new/docs/guides/assets/restart-application-deployment.md_2.yaml @@ -0,0 +1,10 @@ +apiVersion: lifecycle.keptn.sh/v1alpha2 +kind: KeptnTaskDefinition +metadata: + name: pre-deployment-check + namespace: restartable-apps +spec: + function: + inline: + code: | + console.error("Success") diff --git a/docs-new/docs/guides/assets/restart-application-deployment.md_3.yaml b/docs-new/docs/guides/assets/restart-application-deployment.md_3.yaml new file mode 100644 index 00000000000..80dfd9bd249 --- /dev/null +++ b/docs-new/docs/guides/assets/restart-application-deployment.md_3.yaml @@ -0,0 +1,13 @@ +apiVersion: lifecycle.keptn.sh/v1alpha2 +kind: KeptnApp +metadata: + name: podtato-head + namespace: restartable-apps +spec: + version: "0.1.1" + revision: 2 # Increased this value from 1 to 2 + workloads: + - name: podtato-head-entry + version: "0.1.2" + preDeploymentTasks: + - pre-deployment-check diff --git a/docs-new/docs/guides/assets/tasks.md_1.yaml b/docs-new/docs/guides/assets/tasks.md_1.yaml new file mode 100644 index 00000000000..3daacec6a08 --- /dev/null +++ b/docs-new/docs/guides/assets/tasks.md_1.yaml @@ -0,0 +1,13 @@ +apiVersion: lifecycle.keptn.sh/v1alpha2 +kind: KeptnTaskDefinition +metadata: + name: slack-notification-dev +spec: + function: + functionRef: + name: slack-notification + parameters: + map: + textMessage: "This is my configuration" + secureParameters: + secret: slack-token diff --git a/docs-new/docs/guides/assets/tasks.md_2.yaml b/docs-new/docs/guides/assets/tasks.md_2.yaml new file mode 100644 index 00000000000..df1eeeb8ce9 --- /dev/null +++ b/docs-new/docs/guides/assets/tasks.md_2.yaml @@ -0,0 +1,13 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTaskDefinition +metadata: + name: dummy-task + namespace: "default" +spec: + function: + secureParameters: + secret: my-secret + inline: + code: | + let secret_text = Deno.env.get("SECURE_DATA"); + // secret_text = "foo" diff --git a/docs-new/docs/guides/assets/tasks.md_3.yaml b/docs-new/docs/guides/assets/tasks.md_3.yaml new file mode 100644 index 00000000000..645ac6134a9 --- /dev/null +++ b/docs-new/docs/guides/assets/tasks.md_3.yaml @@ -0,0 +1,15 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTaskDefinition +metadata: + name: dummy-task + namespace: "default" +spec: + function: + secureParameters: + secret: my-secret + inline: + code: | + let secret_text = Deno.env.get("SECURE_DATA"); + let secret_text_obj = JSON.parse(secret_text); + // secret_text_obj["foo"] = "bar" + // secret_text_obj["foo2"] = "bar2" diff --git a/docs-new/docs/guides/assets/tasks.md_4.yaml b/docs-new/docs/guides/assets/tasks.md_4.yaml new file mode 100644 index 00000000000..41074844174 --- /dev/null +++ b/docs-new/docs/guides/assets/tasks.md_4.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: deno-demo-secret + namespace: default +type: Opaque +data: + SECURE_DATA: YmFyCg== # base64 encoded string, e.g. 'bar' diff --git a/docs-new/docs/guides/assets/tasks.md_5.yaml b/docs-new/docs/guides/assets/tasks.md_5.yaml new file mode 100644 index 00000000000..589e3cd9d00 --- /dev/null +++ b/docs-new/docs/guides/assets/tasks.md_5.yaml @@ -0,0 +1,16 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnTaskDefinition +metadata: + name: deployment-hello + namespace: "default" +spec: + function: + secureParameters: + secret: deno-demo-secret + inline: + code: | + console.log("Deployment Hello Task has been executed"); + + let foo = Deno.env.get('SECURE_DATA'); + console.log(foo); + Deno.exit(0); diff --git a/docs-new/docs/guides/auto-app-discovery.md b/docs-new/docs/guides/auto-app-discovery.md index 4331fd83a42..a19b98b4230 100644 --- a/docs-new/docs/guides/auto-app-discovery.md +++ b/docs-new/docs/guides/auto-app-discovery.md @@ -15,11 +15,7 @@ kubectl get keptnworkloadversion -n podtato-kubectl -w The generated `KeptnApp` file includes `metadata` that names this `KeptnApp` and identifies the Namespace where it resides. -```yaml -metadata: - name: simpleapp - namespace: simplenode-dev -``` +{% include "auto-app-discovery.md_1.yaml" %} It also includes a `spec.workloads` list that defines the workloads to be included. @@ -37,70 +33,12 @@ Note that: 1. The `Deployment` workloads are annotated appropriately. This example does not use other workloads. -```yaml -apiVersion: v1 -kind: Namespace -metadata: - name: podtato-kubectl - annotations: - keptn.sh/lifecycle-toolkit: "enabled" - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: podtato-head-frontend - namespace: podtato-kubectl -spec: - template: - metadata: - labels: - app.kubernetes.io/name: podtato-head-frontend - app.kubernetes.io/part-of: podtato-head - app.kubernetes.io/version: 0.1.0 - spec: - containers: - - name: podtato-head-frontend - image: podtato-head-frontend ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: podtato-head-hat - namespace: podtato-kubectl -spec: - replicas: 1 - template: - metadata: - labels: - app.kubernetes.io/name: podtato-head-hat - app.kubernetes.io/part-of: podtato-head - app.kubernetes.io/version: 0.1.1 - spec: - containers: - - name: podtato-head-hat - image: podtato-head-hat -``` +{% include "auto-app-discovery.md_2.yaml" %} Applying these resources results in the creation of the following `KeptnApp` resource: -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha2 -kind: KeptnApp -metadata: - name: podtato-head - namespace: podtato-kubectl - annotations: - app.kubernetes.io/managed-by: "keptn" -spec: - version: "" - workloads: - - name: podtato-head-frontend - version: 0.1.0 - - name: podtato-head-hat - version: 1.1.1 -``` +{% include "auto-app-discovery.md_3.yaml" %} With the `KeptnApp` resource created, you get observability of your application's deployments diff --git a/docs-new/docs/guides/evaluatemetrics.md b/docs-new/docs/guides/evaluatemetrics.md index 354ac507a00..e3e1b3f64eb 100644 --- a/docs-new/docs/guides/evaluatemetrics.md +++ b/docs-new/docs/guides/evaluatemetrics.md @@ -68,33 +68,12 @@ For example, the `KeptnMetricProvider` resource for a Prometheus data source that does not use a secret could look like: -```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: KeptnMetricsProvider -metadata: - name: prometheus-provider - namespace: simplenode-dev -spec: - type: prometheus - targetServer: "http://prometheus-k8s.monitoring.svc.cluster.local:9090" -``` +{% include "evaluatemetrics.md_1.yaml" %} The `KeptnMetricProvider` resource for a Dynatrace provider that uses a secret could look like: -```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: KeptnMetricsProvider -metadata: - name: dynatrace-provider - namespace: podtato-kubectl -spec: - type: dynatrace - targetServer: "" - secretKeyRef: - name: dt-api-token - key: DT_TOKEN -``` +{% include "evaluatemetrics.md_2.yaml" %} ### Define KeptnMetric information @@ -117,29 +96,7 @@ The [keptn-metric.yaml](https://github.com/keptn-sandbox/klt-on-k3s-with-argocd/blob/main/simplenode-dev/keptn-metric.yaml) file for our example looks like: -```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: Keptnmetric -metadata: - name: available-cpus - namespace: simplenode-dev -spec: - provider: - name: dev-prometheus - query: "sum(kube_node_status_capacity{resources`cpu`})" - fetchIntervalSeconds: 10 ---- -apiVersion: metrics.keptn.sh/v1beta1 -kind: Keptnmetric -metadata: - name: availability-slo - namespace: simplenode-dev -spec: - provider: - name: dev-dynatrace - query: "func:slo.availability_simplenodeservice" - fetchIntervalSeconds: 10 -``` +{% include "evaluatemetrics.md_3.yaml" %} Note the following: @@ -250,16 +207,4 @@ In other words, the span is The default value is set to be `5m` if the `range.interval` is not set. -```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: KeptnMetric -metadata: - name: good-metric -spec: - provider: - name: my-provider - query: "sum(kube_pod_container_resource_limits{resource='cpu'})" - fetchIntervalSeconds: 10 - range: - interval: "3m" -``` +{% include "evaluatemetrics.md_4.yaml" %} diff --git a/docs-new/docs/guides/integrate.md b/docs-new/docs/guides/integrate.md index 1b5380c1903..7c7c6f6710c 100644 --- a/docs-new/docs/guides/integrate.md +++ b/docs-new/docs/guides/integrate.md @@ -63,22 +63,13 @@ resources for the version it detects. The basic keptn.sh keys that can be used for annotations or labels are: -```yaml -keptn.sh/workload: myAwesomeWorkload -keptn.sh/version: myAwesomeWorkloadVersion -keptn.sh/app: myAwesomeAppName -keptn.sh/container: myAwesomeContainer -``` +{% include "integrate.md_1.yaml" %} Alternatively, you can use Kubernetes keys for annotations or labels. These are part of the Kubernetes [Recommended Labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/): -```yaml -app.kubernetes.io/name: myAwesomeWorkload -app.kubernetes.io/version: myAwesomeWorkloadVersion -app.kubernetes.io/part-of: myAwesomeAppName -``` +{% include "integrate.md_2.yaml" %} These keys are defined as: @@ -220,12 +211,7 @@ you must manually edit the YAML file to add them. Specify one of the following annotations/labels for each evaluation or task you want to execute: -```yaml -keptn.sh/pre-deployment-evaluations: <`EvaluationDefinition`-name> -keptn.sh/pre-deployment-tasks: <`TaskDefinition`-name> -keptn.sh/post-deployment-evaluations: <`EvaluationDefinition`-name> -keptn.sh/post-deployment-tasks: <`TaskDefinition`-name> -``` +{% include "integrate.md_3.yaml" %} The value of these annotations corresponds to the name of Keptn [resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) diff --git a/docs-new/docs/guides/restart-application-deployment.md b/docs-new/docs/guides/restart-application-deployment.md index fe9ba38c2c2..0568a210dab 100644 --- a/docs-new/docs/guides/restart-application-deployment.md +++ b/docs-new/docs/guides/restart-application-deployment.md @@ -22,70 +22,7 @@ to enter their respective deployment phases. To illustrate this, consider the following example: -```yaml -apiVersion: v1 -kind: Namespace -metadata: - name: restartable-apps - annotations: - keptn.sh/lifecycle-toolkit: "enabled" ---- -apiVersion: lifecycle.keptn.sh/v1alpha2 -kind: KeptnApp -metadata: - name: podtato-head - namespace: restartable-apps -spec: - version: "0.1.1" - revision: 1 - workloads: - - name: podtato-head-entry - version: "0.1.2" - preDeploymentTasks: - - pre-deployment-check ---- -apiVersion: lifecycle.keptn.sh/v1alpha2 -kind: KeptnTaskDefinition -metadata: - name: pre-deployment-check - namespace: restartable-apps -spec: - function: - inline: - code: | - console.error("I failed") - process.exit(1) ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: podtato-head-entry - namespace: restartable-apps - labels: - app: podtato-head -spec: - selector: - matchLabels: - component: podtato-head-entry - template: - metadata: - labels: - component: podtato-head-entry - keptn.sh/workload: podtato-head-entry - keptn.sh/app: podtato-head - keptn.sh/version: "0.1.2" - spec: - terminationGracePeriodSeconds: 5 - containers: - - name: server - image: ghcr.io/podtato-head/entry:0.2.7 - imagePullPolicy: Always - ports: - - containerPort: 9000 - env: - - name: PODTATO_PORT - value: "9000" -``` +{% include "restart-application-deployment.md_1.yaml" %} In this example, the `KeptnApp` executes a pre-deployment check which clearly fails because of the `pre-deployment-check` task, @@ -125,18 +62,7 @@ kubectl -n restartable-apps edit keptntaskdefinitions.lifecycle.keptn.sh pre-dep Modify the manifest to look like this: -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha2 -kind: KeptnTaskDefinition -metadata: - name: pre-deployment-check - namespace: restartable-apps -spec: - function: - inline: - code: | - console.error("Success") -``` +{% include "restart-application-deployment.md_2.yaml" %} To restart the deployment of our `KeptnApplication`, edit the manifest: @@ -147,21 +73,7 @@ kubectl -n restartable-apps edit keptnapps.lifecycle.keptn.sh podtato-head Increment the value of the `spec.revision` field by one: -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha2 -kind: KeptnApp -metadata: - name: podtato-head - namespace: restartable-apps -spec: - version: "0.1.1" - revision: 2 # Increased this value from 1 to 2 - workloads: - - name: podtato-head-entry - version: "0.1.2" - preDeploymentTasks: - - pre-deployment-check -``` +{% include "restart-application-deployment.md_3.yaml" %} After those changes have been made, you will notice a new revision of the `podtato-head` `KeptnAppVersion`: diff --git a/docs-new/docs/guides/tasks.md b/docs-new/docs/guides/tasks.md index 5c75dd8bc2c..54c882ad0c8 100644 --- a/docs-new/docs/guides/tasks.md +++ b/docs-new/docs/guides/tasks.md @@ -187,21 +187,7 @@ while the `secret` parameters refer to a single Kubernetes `secret`. Consider the following example: -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha2 -kind: KeptnTaskDefinition -metadata: - name: slack-notification-dev -spec: - function: - functionRef: - name: slack-notification - parameters: - map: - textMessage: "This is my configuration" - secureParameters: - secret: slack-token -``` +{% include "tasks.md_1.yaml" %} Note the following about using parameters with functions: @@ -229,21 +215,7 @@ execute this command: kubectl create secret generic my-secret --from-literal=SECURE_DATA=foo ``` -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnTaskDefinition -metadata: - name: dummy-task - namespace: "default" -spec: - function: - secureParameters: - secret: my-secret - inline: - code: | - let secret_text = Deno.env.get("SECURE_DATA"); - // secret_text = "foo" -``` +{% include "tasks.md_2.yaml" %} To pass multiple variables you can create a Kubernetes secret using a JSON string: @@ -253,23 +225,7 @@ kubectl create secret generic my-secret \ --from-literal=SECURE_DATA="{\"foo\": \"bar\", \"foo2\": \"bar2\"}" ``` -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnTaskDefinition -metadata: - name: dummy-task - namespace: "default" -spec: - function: - secureParameters: - secret: my-secret - inline: - code: | - let secret_text = Deno.env.get("SECURE_DATA"); - let secret_text_obj = JSON.parse(secret_text); - // secret_text_obj["foo"] = "bar" - // secret_text_obj["foo2"] = "bar2" -``` +{% include "tasks.md_3.yaml" %} ### Pass secrets to a function @@ -286,34 +242,8 @@ For example, if you have a task function that should make use of secret data, you must first ensure that the secret containing the `SECURE_DATA` key exists For example: -```yaml -apiVersion: v1 -kind: Secret -metadata: - name: deno-demo-secret - namespace: default -type: Opaque -data: - SECURE_DATA: YmFyCg== # base64 encoded string, e.g. 'bar' -``` +{% include "tasks.md_4.yaml" %} Then, you can make use of that secret as follows: -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnTaskDefinition -metadata: - name: deployment-hello - namespace: "default" -spec: - function: - secureParameters: - secret: deno-demo-secret - inline: - code: | - console.log("Deployment Hello Task has been executed"); - - let foo = Deno.env.get('SECURE_DATA'); - console.log(foo); - Deno.exit(0); -``` +{% include "tasks.md_5.yaml" %} diff --git a/docs-new/docs/installation/assets/index.md_1.yaml b/docs-new/docs/installation/assets/index.md_1.yaml new file mode 100644 index 00000000000..edd860abf89 --- /dev/null +++ b/docs-new/docs/installation/assets/index.md_1.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: testy-test + annotations: + keptn.sh/lifecycle-toolkit: "enabled" # this tells Keptn to watch the namespace diff --git a/docs-new/docs/installation/assets/index.md_2.yaml b/docs-new/docs/installation/assets/index.md_2.yaml new file mode 100644 index 00000000000..2d9d6ed4cc5 --- /dev/null +++ b/docs-new/docs/installation/assets/index.md_2.yaml @@ -0,0 +1 @@ +{% include "./assets/values-advance-changes.yaml" %} diff --git a/docs-new/docs/installation/assets/tips-tricks.md_1.yaml b/docs-new/docs/installation/assets/tips-tricks.md_1.yaml new file mode 100644 index 00000000000..daaf5122de4 --- /dev/null +++ b/docs-new/docs/installation/assets/tips-tricks.md_1.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: simplenode-dev + annotations: + keptn.sh/lifecycle-toolkit: "enabled" diff --git a/docs-new/docs/installation/configuration/assets/cert-manager.md_1.yaml b/docs-new/docs/installation/configuration/assets/cert-manager.md_1.yaml new file mode 100644 index 00000000000..f698c4fe885 --- /dev/null +++ b/docs-new/docs/installation/configuration/assets/cert-manager.md_1.yaml @@ -0,0 +1,23 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: keptn-certs + namespace: +spec: + dnsNames: + - lifecycle-webhook-service..svc + - lifecycle-webhook-service..svc.cluster.local + - metrics-webhook-service..svc + - metrics-webhook-service..svc.cluster.local + issuerRef: + kind: Issuer + name: keptn-selfsigned-issuer + secretName: keptn-certs +--- +apiVersion: cert-manager.io/v1 +kind: Issuer +metadata: + name: keptn-selfsigned-issuer + namespace: +spec: + selfSigned: {} diff --git a/docs-new/docs/installation/configuration/cert-manager.md b/docs-new/docs/installation/configuration/cert-manager.md index 485efb7d691..a850f8dac05 100644 --- a/docs-new/docs/installation/configuration/cert-manager.md +++ b/docs-new/docs/installation/configuration/cert-manager.md @@ -28,31 +28,7 @@ The steps are: These are the CRs for `cert-manager.io` to be applied to your cluster: -```yaml -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: keptn-certs - namespace: -spec: - dnsNames: - - lifecycle-webhook-service..svc - - lifecycle-webhook-service..svc.cluster.local - - metrics-webhook-service..svc - - metrics-webhook-service..svc.cluster.local - issuerRef: - kind: Issuer - name: keptn-selfsigned-issuer - secretName: keptn-certs ---- -apiVersion: cert-manager.io/v1 -kind: Issuer -metadata: - name: keptn-selfsigned-issuer - namespace: -spec: - selfSigned: {} -``` +{% include "cert-manager.md_1.yaml" %} Note the following about these fields: diff --git a/docs-new/docs/installation/index.md b/docs-new/docs/installation/index.md index aa91b775620..8026c6e091a 100644 --- a/docs-new/docs/installation/index.md +++ b/docs-new/docs/installation/index.md @@ -73,14 +73,7 @@ you must enable Keptn in your via annotations. For example, for the `testy-test` namespace: -```yaml -apiVersion: v1 -kind: Namespace -metadata: - name: testy-test - annotations: - keptn.sh/lifecycle-toolkit: "enabled" # this tells Keptn to watch the namespace -``` +{% include "index.md_1.yaml" %} Some helpful hints: @@ -152,9 +145,7 @@ Use the subcomponent's parent value as the root for your configuration. Here is an example `values.yaml` altering global and metrics operator values: -```yaml -{% include "./assets/values-advance-changes.yaml" %} -``` +{% include "index.md_2.yaml" %} Note the additional values that are specified in the `metricsOperator` section. diff --git a/docs-new/docs/installation/tips-tricks.md b/docs-new/docs/installation/tips-tricks.md index ae67287c77c..e7317f7e47c 100644 --- a/docs-new/docs/installation/tips-tricks.md +++ b/docs-new/docs/installation/tips-tricks.md @@ -76,14 +76,7 @@ To enable Keptn, annotate the appropriate `Namespace` resource(s). For example, for the `simplenode-dev` namespace, the annotation looks like this: -```yaml -apiVersion: v1 -kind: Namespace -metadata: - name: simplenode-dev - annotations: - keptn.sh/lifecycle-toolkit: "enabled" -``` +{% include "tips-tricks.md_1.yaml" %} You see the annotation line `keptn.sh/lifecycle-toolkit: "enabled"`. diff --git a/docs-new/docs/migrate/assets/metrics-observe.md_1.yaml b/docs-new/docs/migrate/assets/metrics-observe.md_1.yaml new file mode 100644 index 00000000000..a27fe86b5b6 --- /dev/null +++ b/docs-new/docs/migrate/assets/metrics-observe.md_1.yaml @@ -0,0 +1,27 @@ +apiVersion: v1 + items: + - apiVersion: metrics.keptn.sh/v1beta1 + kind: Analysis + metadata: + creationTimestamp: "2023-09-14T11:00:01Z" + generation: 4 + name: analysis-sample-1 + namespace: keptn-lifecycle-poc + resourceVersion: "71327" + uid: 1c5e043d-ed5e-42f8-ba32-b7af54b55c35 + spec: + analysisDefinition: + name: my-project-ad + namespace: keptn-lifecycle-poc + args: + ns: keptn-system + project: my-project + timeframe: + from: "2023-09-14T11:20:19Z" + to: "2023-09-14T11:22:19Z" + status: + pass: true + raw: '{"objectiveResults":[{"result":{"failResult":{"operator":{"greaterThan":{"fixedValue":"50"}}},"warnResult":{"operator":{"greaterThan":{"fixedValue":"50"}}},"pass":true},"value":7,"score":1}],"totalScore":1,"maximumScore":1,"pass":true}' + kind: List + metadata: + resourceVersion: "" diff --git a/docs-new/docs/migrate/assets/metrics-observe.md_2.yaml b/docs-new/docs/migrate/assets/metrics-observe.md_2.yaml new file mode 100644 index 00000000000..f54825841d0 --- /dev/null +++ b/docs-new/docs/migrate/assets/metrics-observe.md_2.yaml @@ -0,0 +1,10 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: AnalysisValueTemplate +metadata: + creationTimestamp: null + name: response-time +spec: + provider: + name: my-prometheus-provider + namespace: keptn-lifecycle-poc + query: response_time{label="{{.service}}"} diff --git a/docs-new/docs/migrate/assets/metrics-observe.md_3.yaml b/docs-new/docs/migrate/assets/metrics-observe.md_3.yaml new file mode 100644 index 00000000000..4eec463fc0d --- /dev/null +++ b/docs-new/docs/migrate/assets/metrics-observe.md_3.yaml @@ -0,0 +1,14 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: Analysis +metadata: + name: analysis-sample-1 + namespace: keptn-lifecycle-poc +spec: + timeframe: + from: 2023-09-14T11:20:19Z + to: 2023-09-14T11:22:19Z + args: + "service": "my-service" + analysisDefinition: + name: my-project-ad + namespace: keptn-lifecycle-poc diff --git a/docs-new/docs/migrate/metrics-observe.md b/docs-new/docs/migrate/metrics-observe.md index e8d9ecce239..899e001a7cc 100644 --- a/docs-new/docs/migrate/metrics-observe.md +++ b/docs-new/docs/migrate/metrics-observe.md @@ -241,35 +241,7 @@ The process is: kubectl get analysis -n keptn-lifecycle-poc -oyaml ``` - ```yaml - apiVersion: v1 - items: - - apiVersion: metrics.keptn.sh/v1beta1 - kind: Analysis - metadata: - creationTimestamp: "2023-09-14T11:00:01Z" - generation: 4 - name: analysis-sample-1 - namespace: keptn-lifecycle-poc - resourceVersion: "71327" - uid: 1c5e043d-ed5e-42f8-ba32-b7af54b55c35 - spec: - analysisDefinition: - name: my-project-ad - namespace: keptn-lifecycle-poc - args: - ns: keptn-system - project: my-project - timeframe: - from: "2023-09-14T11:20:19Z" - to: "2023-09-14T11:22:19Z" - status: - pass: true - raw: '{"objectiveResults":[{"result":{"failResult":{"operator":{"greaterThan":{"fixedValue":"50"}}},"warnResult":{"operator":{"greaterThan":{"fixedValue":"50"}}},"pass":true},"value":7,"score":1}],"totalScore":1,"maximumScore":1,"pass":true}' - kind: List - metadata: - resourceVersion: "" - ``` + {% include "metrics-observe.md_1.yaml" %} As can be seen in the yaml above, the `status.raw` property contains the detailed breakdown @@ -299,39 +271,13 @@ to insert a variable as a placeholder (for example, in this case, `{{.service}}`) for the service identifier in the prometheus query: -```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: AnalysisValueTemplate -metadata: - creationTimestamp: null - name: response-time -spec: - provider: - name: my-prometheus-provider - namespace: keptn-lifecycle-poc - query: response_time{label="{{.service}}"} -``` +{% include "metrics-observe.md_2.yaml" %} Then, if an analysis for that particular service should be performed, the name of the service can be passed to the analysis using the `spec.args` property from the `Analysis` resource: -```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: Analysis -metadata: - name: analysis-sample-1 - namespace: keptn-lifecycle-poc -spec: - timeframe: - from: 2023-09-14T11:20:19Z - to: 2023-09-14T11:22:19Z - args: - "service": "my-service" - analysisDefinition: - name: my-project-ad - namespace: keptn-lifecycle-poc -``` +{% include "metrics-observe.md_3.yaml" %} This way, you can use the same `AnalysisDefinition` and `AnalysisValueTemplates` for multiple services within the same project. diff --git a/docs-new/docs/reference/crd-reference/analysis.md b/docs-new/docs/reference/crd-reference/analysis.md index deeec55ac53..de8c3f1fa8c 100644 --- a/docs-new/docs/reference/crd-reference/analysis.md +++ b/docs-new/docs/reference/crd-reference/analysis.md @@ -9,26 +9,7 @@ that are used in the `AnalysisDefinition` query. ## Synopsis -```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: Analysis -metadata: - name: analysis-sample -spec: - timeframe: from: to: | `recent ` - args: - : - : - ... - analysisDefinition: - name: - state: Completed | Progressing -``` +{% include "analysis.md_1.yaml" %} ## Fields diff --git a/docs-new/docs/reference/crd-reference/analysisdefinition.md b/docs-new/docs/reference/crd-reference/analysisdefinition.md index f2e189a2328..76deabc6d08 100644 --- a/docs-new/docs/reference/crd-reference/analysisdefinition.md +++ b/docs-new/docs/reference/crd-reference/analysisdefinition.md @@ -5,30 +5,7 @@ list of Service Level Objectives (SLOs) for an `Analysis`. ## Synopsis -```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: AnalysisDefinition -metadata: - name: - namespace: -spec: - objectives: - - analysisValueTemplateRef: - name: - namespace: - target: - failure | warning: - : - : | - : - lowbound: - highBound: - weight: - keyObjective: - totalScore: - passPercentage: 90 - warningPercentage: 75 -``` +{% include "analysisdefinition.md_1.yaml" %} ## Fields @@ -114,36 +91,7 @@ Each of these objectives must specify: ## Example -```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: AnalysisDefinition -metadata: - name: ed-my-proj-dev-svc1 - namespace: keptn-system -spec: - objectives: - - analysisValueTemplateRef: - name: response-time-p95 - namespace: keptn-system - target: - failure: - : - fixedValue: integer> | - inRange: | notInRange: - lowBound: - highBound: - warning: - : - fixedValue: integer> | - inRange: | notInRange: - lowBound: - highBound: - weight: - keyObjective: - totalScore: - passPercentage: - warningPercentage: -``` +{% include "analysisdefinition.md_2.yaml" %} For an example of how to implement the Keptn Analysis feature, see the [Analysis](../../guides/slo.md) diff --git a/docs-new/docs/reference/crd-reference/analysisvaluetemplate.md b/docs-new/docs/reference/crd-reference/analysisvaluetemplate.md index 04c70ddcf22..1f7f8bfcf00 100644 --- a/docs-new/docs/reference/crd-reference/analysisvaluetemplate.md +++ b/docs-new/docs/reference/crd-reference/analysisvaluetemplate.md @@ -9,17 +9,7 @@ of multiple types of data provider. ## Synopsis -```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: AnalysisValueTemplate -metadata: - name: response-time-p95 - namespace: -spec: - provider: - name: prometheus | dynatrace | dql | datadog - query: -``` +{% include "analysisvaluetemplate.md_1.yaml" %} ## Fields diff --git a/docs-new/docs/reference/crd-reference/app.md b/docs-new/docs/reference/crd-reference/app.md index 53f5759b65e..ef7748b38a4 100644 --- a/docs-new/docs/reference/crd-reference/app.md +++ b/docs-new/docs/reference/crd-reference/app.md @@ -15,29 +15,7 @@ It contains information about: ## Synopsis -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnApp -metadata: - name: - namespace: -spec: - version: "x.y" - revision: x - workloads: - - name: - version: - - name: - version: - preDeploymentTasks: - - - postDeploymentTasks: - - - preDeploymentEvaluations: - - - postDeploymentEvaluations: - - -``` +{% include "app.md_1.yaml" %} ## Fields @@ -138,24 +116,7 @@ you can code them all into a single `KeptnTaskDefinition`. ## Example -```yaml -apiVersion: lifecycle.keptn.sh/v1alpha3 -kind: KeptnApp -metadata: - name: podtato-head - namespace: podtato-kubectl -spec: - version: "latest" - workloads: - - name: podtato-head-left-arm - version: "my_vers12.5" - - name: podtato-head-left-leg - version: "my_v24" - postDeploymentTasks: - - post-deployment-hello - preDeploymentEvaluations: - - my-prometheus-definition -``` +{% include "app.md_2.yaml" %} ## Files diff --git a/docs-new/docs/reference/crd-reference/assets/analysis.md_1.yaml b/docs-new/docs/reference/crd-reference/assets/analysis.md_1.yaml new file mode 100644 index 00000000000..3f1c5955272 --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/analysis.md_1.yaml @@ -0,0 +1,18 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: Analysis +metadata: + name: analysis-sample +spec: + timeframe: from: to: | `recent ` + args: + : + : + ... + analysisDefinition: + name: + state: Completed | Progressing diff --git a/docs-new/docs/reference/crd-reference/assets/analysisdefinition.md_1.yaml b/docs-new/docs/reference/crd-reference/assets/analysisdefinition.md_1.yaml new file mode 100644 index 00000000000..5962e239aaf --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/analysisdefinition.md_1.yaml @@ -0,0 +1,22 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: AnalysisDefinition +metadata: + name: + namespace: +spec: + objectives: + - analysisValueTemplateRef: + name: + namespace: + target: + failure | warning: + : + : | + : + lowbound: + highBound: + weight: + keyObjective: + totalScore: + passPercentage: 90 + warningPercentage: 75 diff --git a/docs-new/docs/reference/crd-reference/assets/analysisdefinition.md_2.yaml b/docs-new/docs/reference/crd-reference/assets/analysisdefinition.md_2.yaml new file mode 100644 index 00000000000..a4e44bb3288 --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/analysisdefinition.md_2.yaml @@ -0,0 +1,28 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: AnalysisDefinition +metadata: + name: ed-my-proj-dev-svc1 + namespace: keptn-system +spec: + objectives: + - analysisValueTemplateRef: + name: response-time-p95 + namespace: keptn-system + target: + failure: + : + fixedValue: integer> | + inRange: | notInRange: + lowBound: + highBound: + warning: + : + fixedValue: integer> | + inRange: | notInRange: + lowBound: + highBound: + weight: + keyObjective: + totalScore: + passPercentage: + warningPercentage: diff --git a/docs-new/docs/reference/crd-reference/assets/analysisvaluetemplate.md_1.yaml b/docs-new/docs/reference/crd-reference/assets/analysisvaluetemplate.md_1.yaml new file mode 100644 index 00000000000..94a133da8a5 --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/analysisvaluetemplate.md_1.yaml @@ -0,0 +1,9 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: AnalysisValueTemplate +metadata: + name: response-time-p95 + namespace: +spec: + provider: + name: prometheus | dynatrace | dql | datadog + query: diff --git a/docs-new/docs/reference/crd-reference/assets/app.md_1.yaml b/docs-new/docs/reference/crd-reference/assets/app.md_1.yaml new file mode 100644 index 00000000000..d7ca7f3d21f --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/app.md_1.yaml @@ -0,0 +1,21 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnApp +metadata: + name: + namespace: +spec: + version: "x.y" + revision: x + workloads: + - name: + version: + - name: + version: + preDeploymentTasks: + - + postDeploymentTasks: + - + preDeploymentEvaluations: + - + postDeploymentEvaluations: + - diff --git a/docs-new/docs/reference/crd-reference/assets/app.md_2.yaml b/docs-new/docs/reference/crd-reference/assets/app.md_2.yaml new file mode 100644 index 00000000000..4416ee049e1 --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/app.md_2.yaml @@ -0,0 +1,16 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnApp +metadata: + name: podtato-head + namespace: podtato-kubectl +spec: + version: "latest" + workloads: + - name: podtato-head-left-arm + version: "my_vers12.5" + - name: podtato-head-left-leg + version: "my_v24" + postDeploymentTasks: + - post-deployment-hello + preDeploymentEvaluations: + - my-prometheus-definition diff --git a/docs-new/docs/reference/crd-reference/assets/config.md_1.yaml b/docs-new/docs/reference/crd-reference/assets/config.md_1.yaml new file mode 100644 index 00000000000..8d6feb64458 --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/config.md_1.yaml @@ -0,0 +1,8 @@ +apiVersion: options.keptn.sh/v?alpha? +kind: KeptnConfig +metadata: + name: +spec: + OTelCollectorUrl: '' + keptnAppCreationRequestTimeoutSeconds: <#-seconds> + cloudEventsEndpoint: diff --git a/docs-new/docs/reference/crd-reference/assets/config.md_2.yaml b/docs-new/docs/reference/crd-reference/assets/config.md_2.yaml new file mode 100644 index 00000000000..74971da17a9 --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/config.md_2.yaml @@ -0,0 +1,8 @@ +apiVersion: options.keptn.sh/v1alpha2 +kind: KeptnConfig +metadata: + name: keptn-config +spec: + OTelCollectorUrl: 'otel-collector:4317' + keptnAppCreationRequestTimeoutSeconds: 40 + cloudEventsEndpoint: 'http://endpoint.com' diff --git a/docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_1.yaml b/docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_1.yaml new file mode 100644 index 00000000000..c190e4dc301 --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_1.yaml @@ -0,0 +1,10 @@ +apiVersion: lifecycle.keptn.sh/v1alpha3 +kind: KeptnEvaluationDefinition +metadata: + name: +spec: + objectives: + - evaluationTarget: "" + keptnMetricRef: + name: available-cpus + namespace: some-namespace diff --git a/docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_2.yaml b/docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_2.yaml new file mode 100644 index 00000000000..24862c6d1aa --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_2.yaml @@ -0,0 +1,16 @@ +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" diff --git a/docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_3.yaml b/docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_3.yaml new file mode 100644 index 00000000000..dd16b83a9d9 --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/evaluationdefinition.md_3.yaml @@ -0,0 +1,13 @@ +apiVersion: lifecycle.keptn.sh/v1alpha2 +kind: KeptnEvaluationDefinition +metadata: + name: +spec: + source: prometheus | dynatrace | datadog + objectives: + - name: query-1 + query: "xxxx" + evaluationTarget: <20 + - name: query-2 + query: "yyyy" + evaluationTarget: >4 diff --git a/docs-new/docs/reference/crd-reference/assets/metric.md_1.yaml b/docs-new/docs/reference/crd-reference/assets/metric.md_1.yaml new file mode 100644 index 00000000000..bdf0082f1d7 --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/metric.md_1.yaml @@ -0,0 +1,18 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: KeptnMetric +metadata: + name: + namespace: +spec: + provider: + name: "" + query: "" + fetchIntervalSeconds: <#-seconds> + range: + interval: "" + status: + properties: + value: + rawValue: + errMsg: + lastUpdated: