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 0000000000..7b7a9d8351 --- /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 d68094617c..6c29d9a2f4 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 "./assets/yaml-crd-ref-template.md_1.yaml" %} ## Fields 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 0000000000..6f85d1db9e --- /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 0000000000..59011b62b7 --- /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 0000000000..221c28cf5d --- /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 0000000000..96802057b8 --- /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 0000000000..de11d4f0b2 --- /dev/null +++ b/docs-new/docs/getting-started/assets/metrics.md_1.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_2.yaml b/docs-new/docs/getting-started/assets/metrics.md_2.yaml new file mode 100644 index 0000000000..152b122e62 --- /dev/null +++ b/docs-new/docs/getting-started/assets/metrics.md_2.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_3.yaml b/docs-new/docs/getting-started/assets/metrics.md_3.yaml new file mode 100644 index 0000000000..5b6d2c6f3e --- /dev/null +++ b/docs-new/docs/getting-started/assets/metrics.md_3.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 0000000000..e36ed40f5c --- /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 0000000000..5d855d5804 --- /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 0000000000..db689656a1 --- /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 0000000000..ab6039c6f2 --- /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 0000000000..a0ed412e1d --- /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 0000000000..dadb233f68 --- /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 0000000000..3d365e2949 --- /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 0000000000..4416ee049e --- /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 ef1e0fc660..152bd26c61 100644 --- a/docs-new/docs/getting-started/lifecycle-management.md +++ b/docs-new/docs/getting-started/lifecycle-management.md @@ -72,29 +72,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 "./assets/lifecycle-management.md_1.yaml" %} ### Verify it works @@ -106,23 +84,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 "./assets/lifecycle-management.md_2.yaml" %} If it works, `kubectl -n keptndemo get jobs` should show: @@ -152,48 +114,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 "./assets/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 "./assets/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 0b5f016861..3f45909444 100644 --- a/docs-new/docs/getting-started/metrics.md +++ b/docs-new/docs/getting-started/metrics.md @@ -102,29 +102,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 "./assets/metrics.md_1.yaml" %} Note the following: @@ -182,37 +160,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 "./assets/metrics.md_2.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 "./assets/metrics.md_3.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 dc2ea221a5..e4f6e55f28 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 "./assets/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 "./assets/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 "./assets/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 "./assets/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 "./assets/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 "./assets/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 "./assets/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 "./assets/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 0000000000..87a8747b65 --- /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 0000000000..73e3f66f3a --- /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 0000000000..4853bbbdd8 --- /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 0000000000..de11d4f0b2 --- /dev/null +++ b/docs-new/docs/guides/assets/evaluatemetrics.md_1.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_2.yaml b/docs-new/docs/guides/assets/evaluatemetrics.md_2.yaml new file mode 100644 index 0000000000..b4bc073122 --- /dev/null +++ b/docs-new/docs/guides/assets/evaluatemetrics.md_2.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/evaluations.md_3.yaml b/docs-new/docs/guides/assets/evaluations.md_3.yaml new file mode 100644 index 0000000000..cf5e6c878f --- /dev/null +++ b/docs-new/docs/guides/assets/evaluations.md_3.yaml @@ -0,0 +1,2 @@ +keptn.sh/pre-deployment-evaluations: +keptn.sh/post-deployment-evaluations: 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 0000000000..dcf976876c --- /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 0000000000..d7f31beba5 --- /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/restart-application-deployment.md_1.yaml b/docs-new/docs/guides/assets/restart-application-deployment.md_1.yaml new file mode 100644 index 0000000000..36e0f830c0 --- /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 0000000000..b8c258a9c1 --- /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 0000000000..80dfd9bd24 --- /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 0000000000..9f70c4da4b --- /dev/null +++ b/docs-new/docs/guides/assets/tasks.md_1.yaml @@ -0,0 +1,2 @@ +keptn.sh/pre-deployment-tasks: +keptn.sh/post-deployment-tasks: 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 0000000000..3daacec6a0 --- /dev/null +++ b/docs-new/docs/guides/assets/tasks.md_2.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_3.yaml b/docs-new/docs/guides/assets/tasks.md_3.yaml new file mode 100644 index 0000000000..df1eeeb8ce --- /dev/null +++ b/docs-new/docs/guides/assets/tasks.md_3.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_4.yaml b/docs-new/docs/guides/assets/tasks.md_4.yaml new file mode 100644 index 0000000000..645ac6134a --- /dev/null +++ b/docs-new/docs/guides/assets/tasks.md_4.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_5.yaml b/docs-new/docs/guides/assets/tasks.md_5.yaml new file mode 100644 index 0000000000..4107484417 --- /dev/null +++ b/docs-new/docs/guides/assets/tasks.md_5.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_6.yaml b/docs-new/docs/guides/assets/tasks.md_6.yaml new file mode 100644 index 0000000000..589e3cd9d0 --- /dev/null +++ b/docs-new/docs/guides/assets/tasks.md_6.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 4331fd83a4..9b352f66f7 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 "./assets/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 "./assets/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 "./assets/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 9be7f2c4bd..e41d99ccef 100644 --- a/docs-new/docs/guides/evaluatemetrics.md +++ b/docs-new/docs/guides/evaluatemetrics.md @@ -73,29 +73,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 "./assets/evaluatemetrics.md_1.yaml" %} Note the following: @@ -206,16 +184,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 "./assets/evaluatemetrics.md_2.yaml" %} diff --git a/docs-new/docs/guides/evaluations.md b/docs-new/docs/guides/evaluations.md index 3d2a24a6a8..d7fff2246a 100644 --- a/docs-new/docs/guides/evaluations.md +++ b/docs-new/docs/guides/evaluations.md @@ -65,7 +65,6 @@ file specifies the `app-pre-deploy-eval-2` evaluation as follows: ```yaml {% include "../assets/crd/eval.yaml" %} ``` - The `evaluationTarget` is set to be `>1`, so this evaluation ensures that more than 1 CPU is available before the [workload](https://kubernetes.io/docs/concepts/workloads/) or application is deployed. @@ -80,7 +79,6 @@ file: ```yaml {% include "../assets/crd/metric.yaml" %} ``` - Note the following: * One `KeptnEvaluationDefinition` resource can include @@ -115,10 +113,7 @@ for each `KeptnEvaluationDefinition` resource to be run pre/post-deployment. The annotations for evaluations are: -```yaml -keptn.sh/pre-deployment-evaluations: -keptn.sh/post-deployment-evaluations: -``` +{% include "./assets/evaluations.md_3.yaml" %} > **Caveat:** Be very careful when implementing pre-deployment evaluations since, if one fails, Keptn prevents the Deployment from running. diff --git a/docs-new/docs/guides/integrate.md b/docs-new/docs/guides/integrate.md index 9fe29e87cd..786ed14ed1 100644 --- a/docs-new/docs/guides/integrate.md +++ b/docs-new/docs/guides/integrate.md @@ -71,22 +71,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 "./assets/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 "./assets/integrate.md_2.yaml" %} These keys are defined as: diff --git a/docs-new/docs/guides/restart-application-deployment.md b/docs-new/docs/guides/restart-application-deployment.md index fe9ba38c2c..3dd53218cc 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 "./assets/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 "./assets/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 "./assets/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 30f92c17f7..b3ae0cd0b5 100644 --- a/docs-new/docs/guides/tasks.md +++ b/docs-new/docs/guides/tasks.md @@ -112,10 +112,7 @@ resource. Specify one of the following annotations/labels for each task you want to execute: -```yaml -keptn.sh/pre-deployment-tasks: -keptn.sh/post-deployment-tasks: -``` +{% include "./assets/tasks.md_1.yaml" %} The value of each annotation corresponds to the value of the `name` field of the @@ -235,21 +232,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 "./assets/tasks.md_2.yaml" %} Note the following about using parameters with functions: @@ -277,21 +260,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 "./assets/tasks.md_3.yaml" %} To pass multiple variables you can create a Kubernetes secret using a JSON string: @@ -301,23 +270,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 "./assets/tasks.md_4.yaml" %} ### Pass secrets to a function @@ -334,34 +287,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 "./assets/tasks.md_5.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 "./assets/tasks.md_6.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 0000000000..edd860abf8 --- /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/tips-tricks.md_2.yaml b/docs-new/docs/installation/assets/tips-tricks.md_2.yaml new file mode 100644 index 0000000000..daaf5122de --- /dev/null +++ b/docs-new/docs/installation/assets/tips-tricks.md_2.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 0000000000..f698c4fe88 --- /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 485efb7d69..705e09e384 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 "./assets/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 dac9206655..bf550bf181 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 "./assets/index.md_1.yaml" %} Some helpful hints: diff --git a/docs-new/docs/installation/tips-tricks.md b/docs-new/docs/installation/tips-tricks.md index d2803ecefe..135c3fd307 100644 --- a/docs-new/docs/installation/tips-tricks.md +++ b/docs-new/docs/installation/tips-tricks.md @@ -78,14 +78,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 "./assets/tips-tricks.md_2.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 0000000000..a27fe86b5b --- /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 0000000000..f54825841d --- /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 0000000000..4eec463fc0 --- /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 2ce709dc6f..faafb62844 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 "./assets/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 "./assets/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 "./assets/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 873d7d56e8..56ec81cf2b 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 "./assets/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 6808908516..e18b440f40 100644 --- a/docs-new/docs/reference/crd-reference/analysisdefinition.md +++ b/docs-new/docs/reference/crd-reference/analysisdefinition.md @@ -5,36 +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: - : - fixedValue: | - inRange: | notInRange: - lowBound: | - highBound: | - warning: - : - fixedValue: | - inRange: | notInRange: - lowBound: | - highBound: | - weight: - keyObjective: - totalScore: - passPercentage: - warningPercentage: -``` +{% include "./assets/analysisdefinition.md_1.yaml" %} ## Fields diff --git a/docs-new/docs/reference/crd-reference/analysisvaluetemplate.md b/docs-new/docs/reference/crd-reference/analysisvaluetemplate.md index 7ef5563db9..a6943e27d6 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 "./assets/analysisvaluetemplate.md_1.yaml" %} ## Fields @@ -80,9 +70,7 @@ The template refers to that provider and queries it. ## Example -```yaml -{% include "../../assets/crd/analysis-template.yaml" %} -``` +{% include "./assets/analysisvaluetemplate.md_2.yaml" %} For a full example of how the `AnalysisValueTemplate` is used to implement the Keptn Analysis feature, see the diff --git a/docs-new/docs/reference/crd-reference/app.md b/docs-new/docs/reference/crd-reference/app.md index 5003baefa7..6e2979613e 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 "./assets/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 "./assets/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 0000000000..3f1c595527 --- /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 0000000000..54f88c4755 --- /dev/null +++ b/docs-new/docs/reference/crd-reference/assets/analysisdefinition.md_1.yaml @@ -0,0 +1,28 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: AnalysisDefinition +metadata: + name: + namespace: +spec: + objectives: + - analysisValueTemplateRef: + name: + namespace: + target: + failure: + : + fixedValue: | + inRange: | notInRange: + lowBound: | + highBound: | + warning: + : + fixedValue: | + 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 0000000000..94a133da8a --- /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 0000000000..d7ca7f3d21 --- /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 0000000000..4416ee049e --- /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 0000000000..8d6feb6445 --- /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 0000000000..74971da17a --- /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 0000000000..c190e4dc30 --- /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 0000000000..24862c6d1a --- /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 0000000000..dd16b83a9d --- /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 0000000000..bdf0082f1d --- /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: