From ff098fdeb8eb35b6e71d593b7de6f295f49689dd Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Fri, 9 Feb 2024 16:10:49 +0530 Subject: [PATCH 01/22] add-extensions-config Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- mkdocs.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mkdocs.yml b/mkdocs.yml index 4532f7d7e3..48a1280d1d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -84,6 +84,11 @@ markdown_extensions: - name: mermaid class: mermaid format: !!python/name:pymdownx.superfences.fence_code_format + - pymdownx.tabbed: + alternate_style: true + slugify: !!python/object/apply:pymdownx.slugs.slugify + kwds: + case: lower nav: - Home: From 70b8f9875f94c52b68cc7074d545639ff4fd4c1c Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Fri, 9 Feb 2024 16:12:33 +0530 Subject: [PATCH 02/22] feat: add tabs in KeptnMetricsProvider page Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- .../crd-reference/metricsprovider.md | 84 +++++++++---------- 1 file changed, 41 insertions(+), 43 deletions(-) diff --git a/docs/docs/reference/crd-reference/metricsprovider.md b/docs/docs/reference/crd-reference/metricsprovider.md index 682aced6fd..2f328828da 100644 --- a/docs/docs/reference/crd-reference/metricsprovider.md +++ b/docs/docs/reference/crd-reference/metricsprovider.md @@ -102,49 +102,47 @@ For detailed information please look at the [Examples section](#examples). ## Examples -### Prometheus - -An example of Prometheus as a metrics provider with a Secret holding -the authentication data looks like the following: - -```yaml -{% include "./assets/keptnmetricsprovider-prometheus.yaml" %} -``` - -> **Note** -Setting the `.spec.secretKeyRef.key` field in `KeptnMetricsProvider` is not necessary, -as `user` and `password` key names are required to be present in the linked Secret. -Setting this field won't have any effect. - -### Datadog - -An example of Datadog as a metrics provider with a Secret holding -the authentication data looks like the following: - -```yaml -{% include "./assets/keptnmetricsprovider-datadog.yaml" %} -``` - -> **Note** -Setting the `.spec.secretKeyRef.key` field in `KeptnMetricsProvider` is not necessary, -as `DD_CLIENT_API_KEY` and `DD_CLIENT_API_KEY` key names must be -present in the linked Secret. -Setting this field has no effect. - -### Dynatrace and DQL - -An example of Dynatrace as a metrics provider with a Secret holding -the authentication data looks like the following: - -```yaml -{% include "./assets/keptnmetricsprovider-dynatrace.yaml" %} -``` - -> **Note** -When using Dynatrace as metrics provider you can -define the key name of your DT token stored in a secret, -which is not possible for Datadog or Prometheus. -For this example `myCustomTokenKey` was used. +=== "Prometheus" + + An example of Prometheus as a metrics provider with a Secret holding + the authentication data looks like the following: + + ```yaml + {% include "./assets/keptnmetricsprovider-prometheus.yaml" %} + ``` + > **Note** + Setting the `.spec.secretKeyRef.key` field in `KeptnMetricsProvider` is not necessary, + as `user` and `password` key names are required to be present in the linked Secret. + Setting this field won't have any effect. + +=== "Datadog" + + An example of Datadog as a metrics provider with a Secret holding + the authentication data looks like the following: + + ```yaml + {% include "./assets/keptnmetricsprovider-datadog.yaml" %} + ``` + > **Note** + Setting the `.spec.secretKeyRef.key` field in `KeptnMetricsProvider` is not necessary, + as `DD_CLIENT_API_KEY` and `DD_CLIENT_API_KEY` key names must be + present in the linked Secret. + Setting this field has no effect. + +=== "Dynatrace and DQL" + + An example of Dynatrace as a metrics provider with a Secret holding + the authentication data looks like the following: + + ```yaml + {% include "./assets/keptnmetricsprovider-dynatrace.yaml" %} + ``` + + > **Note** + When using Dynatrace as metrics provider you can + define the key name of your DT token stored in a secret, + which is not possible for Datadog or Prometheus. + For this example `myCustomTokenKey` was used. ## Files From d65db3a91ccbe45249b4446ee01a91925864a476 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Fri, 9 Feb 2024 16:13:12 +0530 Subject: [PATCH 03/22] feat: add tabs in KeptnTaskDefinition page Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- .../reference/crd-reference/taskdefinition.md | 402 +++++++++--------- 1 file changed, 201 insertions(+), 201 deletions(-) diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index 03309be75d..7a9d9b5cbb 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -171,52 +171,52 @@ You do not need to specify the image, volumes, and so forth. Instead, just provide either a Deno or Python script and Keptn sets up the container and runs the script as part of the task. -### deno-runtime - -When using the `deno-runtime` runner to define a task, -the executables are coded in -[Deno-script](https://deno.com/manual), -(which is mostly the same as JavaScript and TypeScript) -and executed in the -`deno-runtime` runner, -which is a lightweight runtime environment -that executes in your namespace. -Note that Deno has tighter restrictions -for permissions and importing data -so a script that works properly elsewhere -may not function out of the box when run in the `deno-runtime` runner. - -```yaml -apiVersion: lifecycle.keptn.sh/v?alpha? -kind: KeptnTaskDefinition -metadata: - name: -spec: - deno: - inline | httpRef | functionRef | ConfigMapRef - parameters: - map: - textMessage: "This is my configuration" - secureParameters: - secret: -``` - -### python-runtime - -```yaml -apiVersion: lifecycle.keptn.sh/v?alpha? -kind: KeptnTaskDefinition -metadata: - name: -spec: - python: - inline | httpRef | functionRef | ConfigMapRef - parameters: - map: - textMessage: "This is my configuration" - secureParameters: - secret: -``` +=== "deno-runtime" + + When using the `deno-runtime` runner to define a task, + the executables are coded in + [Deno-script](https://deno.com/manual), + (which is mostly the same as JavaScript and TypeScript) + and executed in the + `deno-runtime` runner, + which is a lightweight runtime environment + that executes in your namespace. + Note that Deno has tighter restrictions + for permissions and importing data + so a script that works properly elsewhere + may not function out of the box when run in the `deno-runtime` runner. + + ```yaml + apiVersion: lifecycle.keptn.sh/v?alpha? + kind: KeptnTaskDefinition + metadata: + name: + spec: + deno: + inline | httpRef | functionRef | ConfigMapRef + parameters: + map: + textMessage: "This is my configuration" + secureParameters: + secret: + ``` + +=== "python-runtime" + + ```yaml + apiVersion: lifecycle.keptn.sh/v?alpha? + kind: KeptnTaskDefinition + metadata: + name: + spec: + python: + inline | httpRef | functionRef | ConfigMapRef + parameters: + map: + textMessage: "This is my configuration" + secureParameters: + secret: + ``` ### Fields for predefined containers @@ -396,178 +396,178 @@ file. ## Examples for deno-runtime runner -### Example 1: inline script for a Deno script - -This example defines a full-fledged Deno script -within the `KeptnTaskDefinition` YAML file: - -```yaml -apiVersion: lifecycle.keptn.sh/v1beta1 -kind: KeptnTaskDefinition -metadata: - name: hello-keptn-inline -spec: - deno: - inline: +=== "Example 1: inline script for a Deno script" + + This example defines a full-fledged Deno script + within the `KeptnTaskDefinition` YAML file: + + ```yaml + apiVersion: lifecycle.keptn.sh/v1beta1 + kind: KeptnTaskDefinition + metadata: + name: hello-keptn-inline + spec: + deno: + inline: + code: | + let text = Deno.env.get("DATA"); + let data; + let name; + data = JSON.parse(text); + + name = data.name + console.log("Hello, " + name + " new"); + ``` + +=== "Example 2: httpRef script for a Deno script" + + This example fetches the Deno script from a remote webserver at runtime: + + ```yaml + apiVersion: lifecycle.keptn.sh/v1beta1 + kind: KeptnTaskDefinition + metadata: + name: hello-keptn-http + spec: + deno: + httpRef: + url: "https://www.example.com/yourscript.js" + ``` + + For another example, see the + [sample-app](https://github.com/keptn-sandbox/lifecycle-toolkit-examples/blob/main/sample-app/version-1/app-pre-deploy.yaml). + + See the + [sample-app/version-1](https://github.com/keptn-sandbox/lifecycle-toolkit-examples/blob/main/sample-app/version-1/app-pre-deploy.yaml) + PodtatoHead example for a more complete example. + +=== "Example 3: functionRef for a Deno script" + + This example calls another defined task, + illustrating how one `KeptnTaskDefinition` can build + on top of other `KeptnTaskDefinition`s. + In this case, it calls `slack-notification-dev`, + passing `parameters` and `secureParameters` to that other task: + + ```yaml + apiVersion: lifecycle.keptn.sh/v1beta1 + kind: KeptnTaskDefinition + metadata: + name: slack-notification-dev + spec: + deno: + functionRef: + name: slack-notification + parameters: + map: + textMessage: "This is my configuration" + secureParameters: + secret: slack-token + ``` + +=== "Example 4: ConfigMapRef for a Deno script" + + This example references a `ConfigMap` by the name of `dev-configmap` + that contains the code for the function to be executed. + + ```yaml + apiVersion: lifecycle.keptn.sh/v1beta1 + kind: KeptnTaskDefinition + metadata: + name: keptntaskdefinition-sample + spec: + deno: + configMapRef: + name: dev-configmap + ``` + +=== "Example 5: ConfigMap for a Deno script" + + This example illustrates the use of both a `ConfigMapRef` and a `ConfigMap`: + + ```yaml + apiVersion: lifecycle.keptn.sh/v1beta1 + kind: KeptnTaskDefinition + metadata: + name: scheduled-deployment + spec: + function: + configMapRef: + name: scheduled-deployment-cm-1 + --- + apiVersion: v1 + kind: ConfigMap + metadata: + name: scheduled-deployment-1 + data: code: | let text = Deno.env.get("DATA"); let data; - let name; - data = JSON.parse(text); - - name = data.name - console.log("Hello, " + name + " new"); -``` - -### Example 2: httpRef script for a Deno script - -This example fetches the Deno script from a remote webserver at runtime: - -```yaml -apiVersion: lifecycle.keptn.sh/v1beta1 -kind: KeptnTaskDefinition -metadata: - name: hello-keptn-http -spec: - deno: - httpRef: - url: "https://www.example.com/yourscript.js" -``` - -For another example, see the -[sample-app](https://github.com/keptn-sandbox/lifecycle-toolkit-examples/blob/main/sample-app/version-1/app-pre-deploy.yaml). - -See the -[sample-app/version-1](https://github.com/keptn-sandbox/lifecycle-toolkit-examples/blob/main/sample-app/version-1/app-pre-deploy.yaml) -PodtatoHead example for a more complete example. - -### Example 3: functionRef for a Deno script - -This example calls another defined task, -illustrating how one `KeptnTaskDefinition` can build -on top of other `KeptnTaskDefinition`s. -In this case, it calls `slack-notification-dev`, -passing `parameters` and `secureParameters` to that other task: - -```yaml -apiVersion: lifecycle.keptn.sh/v1beta1 -kind: KeptnTaskDefinition -metadata: - name: slack-notification-dev -spec: - deno: - functionRef: - name: slack-notification - parameters: - map: - textMessage: "This is my configuration" - secureParameters: - secret: slack-token -``` - -### Example 4: ConfigMapRef for a Deno script - -This example references a `ConfigMap` by the name of `dev-configmap` -that contains the code for the function to be executed. - -```yaml -apiVersion: lifecycle.keptn.sh/v1beta1 -kind: KeptnTaskDefinition -metadata: - name: keptntaskdefinition-sample -spec: - deno: - configMapRef: - name: dev-configmap -``` - -### Example 5: ConfigMap for a Deno script - -This example illustrates the use of both a `ConfigMapRef` and a `ConfigMap`: - -```yaml -apiVersion: lifecycle.keptn.sh/v1beta1 -kind: KeptnTaskDefinition -metadata: - name: scheduled-deployment -spec: - function: - configMapRef: - name: scheduled-deployment-cm-1 ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: scheduled-deployment-1 -data: - code: | - let text = Deno.env.get("DATA"); - let data; - if (text != "") { - data = JSON.parse(text); - } - let targetDate = new Date(data.targetDate) - let dateTime = new Date(); - if(targetDate < dateTime) { - console.log("Date has passed - ok"); - Deno.exit(0); - } else { - console.log("It's too early - failing"); - Deno.exit(1); - } - console.log(targetDate); -``` - -### Example 6: Accessing KEPTN_CONTEXT environment variable in a Deno task - -For Tasks triggered as pre- and post- deployment of applications -on Kubernetes, Keptn populates an environment variable called `KEPTN_CONTEXT`. -As all environment variables, this can be accessed using language specific methods. -An example in Deno would be the following: - -```javascript -let context = Deno.env.get("KEPTN_CONTEXT"); -``` + if (text != "") { + data = JSON.parse(text); + } + let targetDate = new Date(data.targetDate) + let dateTime = new Date(); + if(targetDate < dateTime) { + console.log("Date has passed - ok"); + Deno.exit(0); + } else { + console.log("It's too early - failing"); + Deno.exit(1); + } + console.log(targetDate); + ``` + +=== "Example 6: Accessing KEPTN_CONTEXT environment variable in a Deno task" + + For Tasks triggered as pre- and post- deployment of applications + on Kubernetes, Keptn populates an environment variable called `KEPTN_CONTEXT`. + As all environment variables, this can be accessed using language specific methods. + An example in Deno would be the following: + + ```javascript + let context = Deno.env.get("KEPTN_CONTEXT"); + ``` ## Examples for a python-runtime runner -### Example 1: inline code for a python-runtime runner +=== "Example 1: inline code for a python-runtime runner" -You can embed python code directly in the task definition. -This example prints data stored in the parameters map: + You can embed python code directly in the task definition. + This example prints data stored in the parameters map: -```yaml -{% include "../../assets/crd/python-inline.yaml" %} -``` + ```yaml + {% include "../../assets/crd/python-inline.yaml" %} + ``` -### Example 2: httpRef for a python-runtime runner +=== "Example 2: httpRef for a python-runtime runner" -You can refer to code stored online. -For example, we have a few examples available in the -[python-runtime samples](https://github.com/keptn/lifecycle-toolkit/tree/main/runtimes/python-runtime/samples) -tree. + You can refer to code stored online. + For example, we have a few examples available in the + [python-runtime samples](https://github.com/keptn/lifecycle-toolkit/tree/main/runtimes/python-runtime/samples) + tree. -Consider the following: + Consider the following: -```yaml -{% include "../../assets/crd/python-configmap.yaml" %} -``` + ```yaml + {% include "../../assets/crd/python-configmap.yaml" %} + ``` -### Example 3: functionRef for a python-runtime runner +=== "Example 3: functionRef for a python-runtime runner" -You can refer to an existing `KeptnTaskDefinition`. -This example calls the inline example -but overrides the data printed with what is specified in the task: + You can refer to an existing `KeptnTaskDefinition`. + this example calls the inline example + but overrides the data printed with what is specified in the task: -```yaml -{% include "../../assets/crd/python-recursive.yaml" %} -``` + ```yaml + {% include "../../assets/crd/python-recursive.yaml" %} + ``` -### Example 4: ConfigMapRef for a python-runtime runner +=== "Example 4: ConfigMapRef for a python-runtime runner" -```yaml -{% include "../../assets/crd/python-configmap.yaml" %} -``` + ```yaml + {% include "../../assets/crd/python-configmap.yaml" %} + ``` ### Allowed libraries for the python-runtime runner From 5980591fd66fcbbc75002f6c832060e04c7ccab7 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Fri, 9 Feb 2024 17:12:20 +0530 Subject: [PATCH 04/22] chore: add kwds in expected words list Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- .github/actions/spelling/expect.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 6b0a5bc334..ed80b39b2c 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -366,6 +366,7 @@ kustomize kustomizeconfig kwi kwv +kwds kyverno lastword Lato From bddaad65c2d5f6751313914bebf444bdd24e0ade Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Fri, 9 Feb 2024 17:39:48 +0530 Subject: [PATCH 05/22] chore: fix failing YAML checks Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index 48a1280d1d..bc3f52f259 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -88,7 +88,7 @@ markdown_extensions: alternate_style: true slugify: !!python/object/apply:pymdownx.slugs.slugify kwds: - case: lower + case: lower nav: - Home: From 2525588a5c466dccdecd308ac9c8d9aa08294997 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Fri, 9 Feb 2024 21:50:12 +0530 Subject: [PATCH 06/22] chore: disable MD046 and MD051 for content tabs on the two reference pages Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- docs/docs/reference/crd-reference/metricsprovider.md | 4 ++++ docs/docs/reference/crd-reference/taskdefinition.md | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/docs/reference/crd-reference/metricsprovider.md b/docs/docs/reference/crd-reference/metricsprovider.md index 2f328828da..721041d595 100644 --- a/docs/docs/reference/crd-reference/metricsprovider.md +++ b/docs/docs/reference/crd-reference/metricsprovider.md @@ -102,6 +102,8 @@ For detailed information please look at the [Examples section](#examples). ## Examples + + === "Prometheus" An example of Prometheus as a metrics provider with a Secret holding @@ -144,6 +146,8 @@ For detailed information please look at the [Examples section](#examples). which is not possible for Datadog or Prometheus. For this example `myCustomTokenKey` was used. + + ## Files API Reference: diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index 7a9d9b5cbb..ad45cfef29 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -32,6 +32,8 @@ differentiated by the `spec` section: [Synopsis for container-runtime](#synopsis-for-container-runtime) and [Examples for a container-runtime runner](#examples-for-a-container-runtime-runner). + + * Pre-defined containers * Use the pre-defined `deno-runtime` runner @@ -568,7 +570,8 @@ file. ```yaml {% include "../../assets/crd/python-configmap.yaml" %} ``` - + + ### Allowed libraries for the python-runtime runner The following example shows how to use some of the allowed packages, namely: From 5efb09b8f58847e2f08dd19d2ca51c19b9584cf9 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Sun, 11 Feb 2024 01:05:57 +0530 Subject: [PATCH 07/22] chore: move code examples to seperate files to be referenced via include Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- .../examples/configmap-for-deno-script.yaml | 30 +++++ .../configmapref-for-deno-script.yaml | 8 ++ .../examples/functionref-for-deno-script.yaml | 13 +++ .../httpref-script-for-deno-script.yaml | 8 ++ .../inline-script-for-deno-script.yaml | 15 +++ .../synopsis-for-deno-runtime-container.yaml | 12 ++ .../synopsis-for-python-runtime-runner.yaml | 12 ++ .../reference/crd-reference/taskdefinition.md | 105 ++---------------- 8 files changed, 105 insertions(+), 98 deletions(-) create mode 100644 docs/docs/assets/crd/examples/configmap-for-deno-script.yaml create mode 100644 docs/docs/assets/crd/examples/configmapref-for-deno-script.yaml create mode 100644 docs/docs/assets/crd/examples/functionref-for-deno-script.yaml create mode 100644 docs/docs/assets/crd/examples/httpref-script-for-deno-script.yaml create mode 100644 docs/docs/assets/crd/examples/inline-script-for-deno-script.yaml create mode 100644 docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml create mode 100644 docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml diff --git a/docs/docs/assets/crd/examples/configmap-for-deno-script.yaml b/docs/docs/assets/crd/examples/configmap-for-deno-script.yaml new file mode 100644 index 0000000000..ec9f3695bb --- /dev/null +++ b/docs/docs/assets/crd/examples/configmap-for-deno-script.yaml @@ -0,0 +1,30 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTaskDefinition +metadata: + name: scheduled-deployment +spec: + function: + configMapRef: + name: scheduled-deployment-cm-1 +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: scheduled-deployment-1 +data: + code: | + let text = Deno.env.get("DATA"); + let data; + if (text != "") { + data = JSON.parse(text); + } + let targetDate = new Date(data.targetDate) + let dateTime = new Date(); + if(targetDate < dateTime) { + console.log("Date has passed - ok"); + Deno.exit(0); + } else { + console.log("It's too early - failing"); + Deno.exit(1); + } + console.log(targetDate); \ No newline at end of file diff --git a/docs/docs/assets/crd/examples/configmapref-for-deno-script.yaml b/docs/docs/assets/crd/examples/configmapref-for-deno-script.yaml new file mode 100644 index 0000000000..9d18d3395f --- /dev/null +++ b/docs/docs/assets/crd/examples/configmapref-for-deno-script.yaml @@ -0,0 +1,8 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTaskDefinition +metadata: + name: keptntaskdefinition-sample +spec: + deno: + configMapRef: + name: dev-configmap \ No newline at end of file diff --git a/docs/docs/assets/crd/examples/functionref-for-deno-script.yaml b/docs/docs/assets/crd/examples/functionref-for-deno-script.yaml new file mode 100644 index 0000000000..dd61f5afd6 --- /dev/null +++ b/docs/docs/assets/crd/examples/functionref-for-deno-script.yaml @@ -0,0 +1,13 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTaskDefinition +metadata: + name: slack-notification-dev +spec: + deno: + functionRef: + name: slack-notification + parameters: + map: + textMessage: "This is my configuration" + secureParameters: + secret: slack-token \ No newline at end of file diff --git a/docs/docs/assets/crd/examples/httpref-script-for-deno-script.yaml b/docs/docs/assets/crd/examples/httpref-script-for-deno-script.yaml new file mode 100644 index 0000000000..825889cb68 --- /dev/null +++ b/docs/docs/assets/crd/examples/httpref-script-for-deno-script.yaml @@ -0,0 +1,8 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTaskDefinition +metadata: + name: hello-keptn-http +spec: + deno: + httpRef: + url: "https://www.example.com/yourscript.js" \ No newline at end of file diff --git a/docs/docs/assets/crd/examples/inline-script-for-deno-script.yaml b/docs/docs/assets/crd/examples/inline-script-for-deno-script.yaml new file mode 100644 index 0000000000..3ae42f3a0b --- /dev/null +++ b/docs/docs/assets/crd/examples/inline-script-for-deno-script.yaml @@ -0,0 +1,15 @@ +apiVersion: lifecycle.keptn.sh/v1beta1 +kind: KeptnTaskDefinition +metadata: + name: hello-keptn-inline +spec: + deno: + inline: + code: | + let text = Deno.env.get("DATA"); + let data; + let name; + data = JSON.parse(text); + + name = data.name + console.log("Hello, " + name + " new"); \ No newline at end of file diff --git a/docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml b/docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml new file mode 100644 index 0000000000..0ecf8251cc --- /dev/null +++ b/docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml @@ -0,0 +1,12 @@ +apiVersion: lifecycle.keptn.sh/v?alpha? +kind: KeptnTaskDefinition +metadata: + name: +spec: + deno: + inline | httpRef | functionRef | ConfigMapRef + parameters: + map: + textMessage: "This is my configuration" + secureParameters: + secret: \ No newline at end of file diff --git a/docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml b/docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml new file mode 100644 index 0000000000..fa32b5b7a4 --- /dev/null +++ b/docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml @@ -0,0 +1,12 @@ +apiVersion: lifecycle.keptn.sh/v?alpha? +kind: KeptnTaskDefinition +metadata: + name: +spec: + python: + inline | httpRef | functionRef | ConfigMapRef + parameters: + map: + textMessage: "This is my configuration" + secureParameters: + secret: \ No newline at end of file diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index ad45cfef29..34d7574dd1 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -189,35 +189,13 @@ and Keptn sets up the container and runs the script as part of the task. may not function out of the box when run in the `deno-runtime` runner. ```yaml - apiVersion: lifecycle.keptn.sh/v?alpha? - kind: KeptnTaskDefinition - metadata: - name: - spec: - deno: - inline | httpRef | functionRef | ConfigMapRef - parameters: - map: - textMessage: "This is my configuration" - secureParameters: - secret: + {% include "../../assets/crd/examples/synopsis-for-deno-runtime-container.yaml" %} ``` === "python-runtime" ```yaml - apiVersion: lifecycle.keptn.sh/v?alpha? - kind: KeptnTaskDefinition - metadata: - name: - spec: - python: - inline | httpRef | functionRef | ConfigMapRef - parameters: - map: - textMessage: "This is my configuration" - secureParameters: - secret: + {% include "../../assets/crd/examples/synopsis-for-python-runtime-runner.yaml" %} ``` ### Fields for predefined containers @@ -404,21 +382,7 @@ file. within the `KeptnTaskDefinition` YAML file: ```yaml - apiVersion: lifecycle.keptn.sh/v1beta1 - kind: KeptnTaskDefinition - metadata: - name: hello-keptn-inline - spec: - deno: - inline: - code: | - let text = Deno.env.get("DATA"); - let data; - let name; - data = JSON.parse(text); - - name = data.name - console.log("Hello, " + name + " new"); + {% include "../../assets/crd/examples/inline-script-for-deno-script.yaml" %} ``` === "Example 2: httpRef script for a Deno script" @@ -426,14 +390,7 @@ file. This example fetches the Deno script from a remote webserver at runtime: ```yaml - apiVersion: lifecycle.keptn.sh/v1beta1 - kind: KeptnTaskDefinition - metadata: - name: hello-keptn-http - spec: - deno: - httpRef: - url: "https://www.example.com/yourscript.js" + {% include "../../assets/crd/examples/httpref-script-for-deno-script.yaml" %} ``` For another example, see the @@ -452,19 +409,7 @@ file. passing `parameters` and `secureParameters` to that other task: ```yaml - apiVersion: lifecycle.keptn.sh/v1beta1 - kind: KeptnTaskDefinition - metadata: - name: slack-notification-dev - spec: - deno: - functionRef: - name: slack-notification - parameters: - map: - textMessage: "This is my configuration" - secureParameters: - secret: slack-token + {% include "../../assets/crd/examples/functionref-for-deno-script.yaml" %} ``` === "Example 4: ConfigMapRef for a Deno script" @@ -473,14 +418,7 @@ file. that contains the code for the function to be executed. ```yaml - apiVersion: lifecycle.keptn.sh/v1beta1 - kind: KeptnTaskDefinition - metadata: - name: keptntaskdefinition-sample - spec: - deno: - configMapRef: - name: dev-configmap + {% include "../../assets/crd/examples/configmapref-for-deno-script.yaml" %} ``` === "Example 5: ConfigMap for a Deno script" @@ -488,36 +426,7 @@ file. This example illustrates the use of both a `ConfigMapRef` and a `ConfigMap`: ```yaml - apiVersion: lifecycle.keptn.sh/v1beta1 - kind: KeptnTaskDefinition - metadata: - name: scheduled-deployment - spec: - function: - configMapRef: - name: scheduled-deployment-cm-1 - --- - apiVersion: v1 - kind: ConfigMap - metadata: - name: scheduled-deployment-1 - data: - code: | - let text = Deno.env.get("DATA"); - let data; - if (text != "") { - data = JSON.parse(text); - } - let targetDate = new Date(data.targetDate) - let dateTime = new Date(); - if(targetDate < dateTime) { - console.log("Date has passed - ok"); - Deno.exit(0); - } else { - console.log("It's too early - failing"); - Deno.exit(1); - } - console.log(targetDate); + {% include "../../assets/crd/examples/configmap-for-deno-script.yaml" %} ``` === "Example 6: Accessing KEPTN_CONTEXT environment variable in a Deno task" From 381be2ddeb89fda3a72125a59e88caf5d05a7c4b Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:17:57 +0530 Subject: [PATCH 08/22] chore: add newline at the end of yaml files to fix the yaml check Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- docs/docs/assets/crd/examples/configmap-for-deno-script.yaml | 2 +- docs/docs/assets/crd/examples/configmapref-for-deno-script.yaml | 2 +- docs/docs/assets/crd/examples/functionref-for-deno-script.yaml | 2 +- .../assets/crd/examples/httpref-script-for-deno-script.yaml | 2 +- .../docs/assets/crd/examples/inline-script-for-deno-script.yaml | 2 +- .../crd/examples/synopsis-for-deno-runtime-container.yaml | 2 +- .../assets/crd/examples/synopsis-for-python-runtime-runner.yaml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/docs/assets/crd/examples/configmap-for-deno-script.yaml b/docs/docs/assets/crd/examples/configmap-for-deno-script.yaml index ec9f3695bb..07516b4a9a 100644 --- a/docs/docs/assets/crd/examples/configmap-for-deno-script.yaml +++ b/docs/docs/assets/crd/examples/configmap-for-deno-script.yaml @@ -27,4 +27,4 @@ data: console.log("It's too early - failing"); Deno.exit(1); } - console.log(targetDate); \ No newline at end of file + console.log(targetDate); diff --git a/docs/docs/assets/crd/examples/configmapref-for-deno-script.yaml b/docs/docs/assets/crd/examples/configmapref-for-deno-script.yaml index 9d18d3395f..45447b0c08 100644 --- a/docs/docs/assets/crd/examples/configmapref-for-deno-script.yaml +++ b/docs/docs/assets/crd/examples/configmapref-for-deno-script.yaml @@ -5,4 +5,4 @@ metadata: spec: deno: configMapRef: - name: dev-configmap \ No newline at end of file + name: dev-configmap diff --git a/docs/docs/assets/crd/examples/functionref-for-deno-script.yaml b/docs/docs/assets/crd/examples/functionref-for-deno-script.yaml index dd61f5afd6..d15a1cd29a 100644 --- a/docs/docs/assets/crd/examples/functionref-for-deno-script.yaml +++ b/docs/docs/assets/crd/examples/functionref-for-deno-script.yaml @@ -10,4 +10,4 @@ spec: map: textMessage: "This is my configuration" secureParameters: - secret: slack-token \ No newline at end of file + secret: slack-token diff --git a/docs/docs/assets/crd/examples/httpref-script-for-deno-script.yaml b/docs/docs/assets/crd/examples/httpref-script-for-deno-script.yaml index 825889cb68..659f9c83fd 100644 --- a/docs/docs/assets/crd/examples/httpref-script-for-deno-script.yaml +++ b/docs/docs/assets/crd/examples/httpref-script-for-deno-script.yaml @@ -5,4 +5,4 @@ metadata: spec: deno: httpRef: - url: "https://www.example.com/yourscript.js" \ No newline at end of file + url: "https://www.example.com/yourscript.js" diff --git a/docs/docs/assets/crd/examples/inline-script-for-deno-script.yaml b/docs/docs/assets/crd/examples/inline-script-for-deno-script.yaml index 3ae42f3a0b..2d88d90062 100644 --- a/docs/docs/assets/crd/examples/inline-script-for-deno-script.yaml +++ b/docs/docs/assets/crd/examples/inline-script-for-deno-script.yaml @@ -12,4 +12,4 @@ spec: data = JSON.parse(text); name = data.name - console.log("Hello, " + name + " new"); \ No newline at end of file + console.log("Hello, " + name + " new"); diff --git a/docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml b/docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml index 0ecf8251cc..9f8e34651b 100644 --- a/docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml +++ b/docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml @@ -9,4 +9,4 @@ spec: map: textMessage: "This is my configuration" secureParameters: - secret: \ No newline at end of file + secret: diff --git a/docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml b/docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml index fa32b5b7a4..194b7a8f3a 100644 --- a/docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml +++ b/docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml @@ -9,4 +9,4 @@ spec: map: textMessage: "This is my configuration" secureParameters: - secret: \ No newline at end of file + secret: From 2c743fbde2b941f537cdbf6a9dc4207c5375acbe Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Wed, 14 Feb 2024 19:48:11 +0530 Subject: [PATCH 09/22] chore: remove the MD051 ignorer from metricsprovider page Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- docs/docs/reference/crd-reference/metricsprovider.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/reference/crd-reference/metricsprovider.md b/docs/docs/reference/crd-reference/metricsprovider.md index d8fd8ed88b..a5ff1d6d87 100644 --- a/docs/docs/reference/crd-reference/metricsprovider.md +++ b/docs/docs/reference/crd-reference/metricsprovider.md @@ -101,7 +101,7 @@ For detailed information please look at the [Examples section](#examples). - + === "Prometheus" An example of Prometheus as a metrics provider with a Secret holding @@ -144,7 +144,7 @@ For detailed information please look at the [Examples section](#examples). which is not possible for Datadog or Prometheus. For this example `myCustomTokenKey` was used. - + ## Files From 70838bfdd7c19968e1d334386dacf3d02b99595d Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Sat, 17 Feb 2024 21:59:05 +0530 Subject: [PATCH 10/22] chore: fix MD102 remove-consecutive-blank-lines Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- docs/docs/reference/crd-reference/metricsprovider.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/docs/reference/crd-reference/metricsprovider.md b/docs/docs/reference/crd-reference/metricsprovider.md index a5ff1d6d87..87362258cd 100644 --- a/docs/docs/reference/crd-reference/metricsprovider.md +++ b/docs/docs/reference/crd-reference/metricsprovider.md @@ -99,7 +99,6 @@ For detailed information please look at the [Examples section](#examples). ## Examples - === "Prometheus" @@ -144,7 +143,6 @@ For detailed information please look at the [Examples section](#examples). which is not possible for Datadog or Prometheus. For this example `myCustomTokenKey` was used. - ## Files From ca4888e3ebbeefd8ee451f47896481491811363e Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Sat, 17 Feb 2024 22:00:03 +0530 Subject: [PATCH 11/22] chore: remove MD051 ignorer Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- .../reference/crd-reference/taskdefinition.md | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index 9e2c4805cc..f25bf77895 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -34,10 +34,9 @@ differentiated by the `spec` section: [Examples for a container-runtime runner](#examples-for-a-container-runtime-runner). - -* Pre-defined containers +- Pre-defined containers - * Use the pre-defined `deno-runtime` runner + - Use the pre-defined `deno-runtime` runner to define tasks using [Deno](https://deno.com/) scripts, @@ -46,14 +45,14 @@ differentiated by the `spec` section: You can use this to specify simple actions without having to define a full container. See - [Synopsis for Deno-runtime container](#deno-runtime) + Synopsis for Deno-runtime container and [Deno-runtime examples](#examples-for-deno-runtime-runner). - * Use the pre-defined `python-runtime` runner + - Use the pre-defined `python-runtime` runner to define your task using [Python 3](https://www.python.org/). See - [Synopsis for python-runtime runner](#python-runtime) + Synopsis for python-runtime runner and [Examples for a python-runtime runner](#examples-for-a-python-runtime-runner). @@ -99,11 +98,11 @@ spec: and code the functionality in Deno script, which is similar to JavaScript and Typescript. See - [Synopsis for deno-runtime container](#deno-runtime) + Synopsis for deno-runtime container - **python** -- Use a `python-runtime` function and code the functionality in Python 3. See - [Synopsis for python-runtime runner](#python-runtime) + Synopsis for python-runtime runner - **container** -- Use the runner defined for the `container-runtime` container. This is a standard Kubernetes container @@ -222,10 +221,10 @@ and Keptn sets up the container and runs the script as part of the task. such as Jenkins, Argo Workflows, Flux, and Tekton. - **deno example:** - [Example 1: inline script for a Deno script](#example-1-inline-script-for-a-deno-script) + Example 1: inline script for a Deno script - **python example:** - [Example 1: inline code for a python-runtime runner](#example-1-inline-code-for-a-python-runtime-runner) + Example 1: inline code for a python-runtime runner - **httpRef** - Specify a script to be executed at runtime from the remote webserver that is specified. @@ -241,10 +240,9 @@ and Keptn sets up the container and runs the script as part of the task. Any other scripts listed here are silently ignored. - **deno example:** - [Example 2: httpRef script for a Deno script](#example-2-httpref-script-for-a-deno-script) + Example 2: httpRef script for a Deno script - **python example:** - [Example 2: httpRef for a python-runtime runner](#example-2-httpref-for-a-python-runtime-runner) - + Example 2: httpRef for a python-runtime runner - **functionRef** -- Execute another `KeptnTaskDefinition` resources. Populate this field with the value(s) of the `metadata.name` field for each `KeptnDefinitionTask` to be called. @@ -271,18 +269,17 @@ and Keptn sets up the container and runs the script as part of the task. are silently ignored. - **deno example:** - [Example 3: functionRef for a Deno script](#example-3-functionref-for-a-deno-script) + Example 3: functionRef for a Deno script - **python example:** - [Example 3: functionRef for a python-runtime runner](#example-3-functionref-for-a-python-runtime-runner) - + Example 3: functionRef for a python-runtime runner - **ConfigMapRef** - Specify the name of a [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) resource that contains the function to be executed. - **deno example:** - [Example 5: ConfigMap for a Deno script](#example-5-configmap-for-a-deno-script) + Example 5: ConfigMap for a Deno script - **python example:** - [Example 4: ConfigMapRef for a python-runtime runner](#example-4-configmapref-for-a-python-runtime-runner) + Example 4: ConfigMapRef for a python-runtime runner - **parameters** - An optional field to supply input parameters to a function. @@ -295,9 +292,9 @@ and Keptn sets up the container and runs the script as part of the task. for more information. - **deno example:** - [Example 3: functionRef for a Deno script](#example-3-functionref-for-a-deno-script) + Example 3: functionRef for a Deno script - **python example:** - [Example 3: functionRef for a python-runner runner](#example-3-functionref-for-a-python-runtime-runner) + Example 3: functionRef for a python-runner runner - **secureParameters** -- An optional field used to pass a Kubernetes secret. @@ -312,9 +309,9 @@ and Keptn sets up the container and runs the script as part of the task. for details. - **deno example:** - [Example 3: functionRef for a Deno script](#example-3-functionref-for-a-deno-script) + Example 3: functionRef for a Deno script - **python example:** - [Example 3: functionRef for a python-runner runner](#example-3-functionref-for-a-python-runtime-runner) + Example 3: functionRef for a python-runner runner ## Usage @@ -482,7 +479,6 @@ file. ```yaml {% include "../../assets/crd/python-configmap.yaml" %} ``` - ### Allowed libraries for the python-runtime runner From 06e53b7dde22b3897a26c6237fa4cfdd5cc75868 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Sat, 17 Feb 2024 22:13:07 +0530 Subject: [PATCH 12/22] chore: fix yaml checks actions/runs/7902583116/job/21570231006?pr=3005 Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- .../crd/examples/synopsis-for-deno-runtime-container.yaml | 4 ++-- .../crd/examples/synopsis-for-python-runtime-runner.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml b/docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml index 9f8e34651b..db63e41ee8 100644 --- a/docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml +++ b/docs/docs/assets/crd/examples/synopsis-for-deno-runtime-container.yaml @@ -3,9 +3,9 @@ kind: KeptnTaskDefinition metadata: name: spec: - deno: + deno: | inline | httpRef | functionRef | ConfigMapRef - parameters: + parameters: | map: textMessage: "This is my configuration" secureParameters: diff --git a/docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml b/docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml index 194b7a8f3a..e52c591480 100644 --- a/docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml +++ b/docs/docs/assets/crd/examples/synopsis-for-python-runtime-runner.yaml @@ -3,9 +3,9 @@ kind: KeptnTaskDefinition metadata: name: spec: - python: + python: | inline | httpRef | functionRef | ConfigMapRef - parameters: + parameters: | map: textMessage: "This is my configuration" secureParameters: From c38fa58b0000bf294d702142bb8d73916d039698 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Sat, 17 Feb 2024 22:35:18 +0530 Subject: [PATCH 13/22] chore: move code snippets to seperate files to be referenced via include Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- .../examples/synopsis-for-all-runners.yaml | 9 +++++++++ .../synopsis-for-container-runtime.yaml | 9 +++++++++ .../reference/crd-reference/taskdefinition.md | 20 ++----------------- 3 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 docs/docs/assets/crd/examples/synopsis-for-all-runners.yaml create mode 100644 docs/docs/assets/crd/examples/synopsis-for-container-runtime.yaml diff --git a/docs/docs/assets/crd/examples/synopsis-for-all-runners.yaml b/docs/docs/assets/crd/examples/synopsis-for-all-runners.yaml new file mode 100644 index 0000000000..5093d63d84 --- /dev/null +++ b/docs/docs/assets/crd/examples/synopsis-for-all-runners.yaml @@ -0,0 +1,9 @@ +apiVersion: lifecycle.keptn.sh/v?alpha? +kind: KeptnTaskDefinition +metadata: + name: +spec: | + deno | python | container + ... + retries: + timeout: \ No newline at end of file diff --git a/docs/docs/assets/crd/examples/synopsis-for-container-runtime.yaml b/docs/docs/assets/crd/examples/synopsis-for-container-runtime.yaml new file mode 100644 index 0000000000..54eee30a82 --- /dev/null +++ b/docs/docs/assets/crd/examples/synopsis-for-container-runtime.yaml @@ -0,0 +1,9 @@ +apiVersion: lifecycle.keptn.sh/v?alpha? +kind: KeptnTaskDefinition +metadata: + name: +spec: + container: | + name: + image: + \ No newline at end of file diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index f25bf77895..d3c7609c45 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -63,15 +63,7 @@ include the same lines at the top. These are described here. ```yaml -apiVersion: lifecycle.keptn.sh/v?alpha? -kind: KeptnTaskDefinition -metadata: - name: -spec: - deno | python | container - ... - retries: - timeout: +{% include "../../assets/crd/examples/synopsis-for-all-runners.yaml" %} ``` ### Fields used for all containers @@ -136,15 +128,7 @@ you can use a `container-runtime` to execute almost anything that you implemented with JES for Keptn v1. ```yaml -apiVersion: lifecycle.keptn.sh/v?alpha? -kind: KeptnTaskDefinition -metadata: - name: -spec: - container: - name: - image: - +{% include "../../assets/crd/examples/synopsis-for-container-runtime.yaml" %} ``` ### Fields used only for container-runtime From 7ae837c1b73aa6d078c120d3c55161fa70074625 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Sat, 17 Feb 2024 22:44:47 +0530 Subject: [PATCH 14/22] chore: use MD046 ignorer in required sections of the page only Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- docs/docs/reference/crd-reference/taskdefinition.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index d3c7609c45..d82a2838ba 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -33,7 +33,6 @@ differentiated by the `spec` section: and [Examples for a container-runtime runner](#examples-for-a-container-runtime-runner). - - Pre-defined containers - Use the pre-defined `deno-runtime` runner @@ -149,6 +148,7 @@ almost anything that you implemented with JES for Keptn v1. [Container](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#Container) spec documentation. + ## Synopsis for predefined containers The predefined containers allow you to easily define a task @@ -181,6 +181,7 @@ and Keptn sets up the container and runs the script as part of the task. ```yaml {% include "../../assets/crd/examples/synopsis-for-python-runtime-runner.yaml" %} ``` + ### Fields for predefined containers @@ -358,6 +359,7 @@ This task is then referenced in the [appcontext.yaml](https://github.com/keptn/lifecycle-toolkit/blob/main/examples/sample-app/version-2/appcontext.yaml) file. + ## Examples for deno-runtime runner === "Example 1: inline script for a Deno script" From 3b01f4a8276661c72a6d5e793b072a97debec7f3 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:45:05 +0530 Subject: [PATCH 15/22] chore: add newline and required indentation Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- .../examples/synopsis-for-all-runners.yaml | 2 +- .../synopsis-for-container-runtime.yaml | 2 +- .../reference/crd-reference/taskdefinition.md | 38 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/docs/assets/crd/examples/synopsis-for-all-runners.yaml b/docs/docs/assets/crd/examples/synopsis-for-all-runners.yaml index 5093d63d84..4aee3d1db4 100644 --- a/docs/docs/assets/crd/examples/synopsis-for-all-runners.yaml +++ b/docs/docs/assets/crd/examples/synopsis-for-all-runners.yaml @@ -6,4 +6,4 @@ spec: | deno | python | container ... retries: - timeout: \ No newline at end of file + timeout: diff --git a/docs/docs/assets/crd/examples/synopsis-for-container-runtime.yaml b/docs/docs/assets/crd/examples/synopsis-for-container-runtime.yaml index 54eee30a82..22bb64ae08 100644 --- a/docs/docs/assets/crd/examples/synopsis-for-container-runtime.yaml +++ b/docs/docs/assets/crd/examples/synopsis-for-container-runtime.yaml @@ -6,4 +6,4 @@ spec: container: | name: image: - \ No newline at end of file + diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index d82a2838ba..74f8121ba9 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -35,25 +35,25 @@ differentiated by the `spec` section: - Pre-defined containers - - Use the pre-defined `deno-runtime` runner - to define tasks using - [Deno](https://deno.com/) - scripts, - which use a syntax similar to JavaScript and Typescript, - with a few limitations. - You can use this to specify simple actions - without having to define a full container. - See - Synopsis for Deno-runtime container - and - [Deno-runtime examples](#examples-for-deno-runtime-runner). - - Use the pre-defined `python-runtime` runner - to define your task using - [Python 3](https://www.python.org/). - See - Synopsis for python-runtime runner - and - [Examples for a python-runtime runner](#examples-for-a-python-runtime-runner). + - Use the pre-defined `deno-runtime` runner + to define tasks using + [Deno](https://deno.com/) + scripts, + which use a syntax similar to JavaScript and Typescript, + with a few limitations. + You can use this to specify simple actions + without having to define a full container. + See + Synopsis for Deno-runtime container + and + [Deno-runtime examples](#examples-for-deno-runtime-runner). + - Use the pre-defined `python-runtime` runner + to define your task using + [Python 3](https://www.python.org/). + See + Synopsis for python-runtime runner + and + [Examples for a python-runtime runner](#examples-for-a-python-runtime-runner). ## Synopsis for all runners From 71defdab92b45ad9db56239b568cbc2007101ef8 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:58:24 +0530 Subject: [PATCH 16/22] chore: move remaining snippets to seperate files and reference them using include Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- .../crd/examples/old-version-synopsis.yaml | 10 ++++++++ .../assets/crd/examples/yaml-synopsis.yaml | 12 ++++++++++ .../crd-reference/metricsprovider.md | 24 ++----------------- 3 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 docs/docs/assets/crd/examples/old-version-synopsis.yaml create mode 100644 docs/docs/assets/crd/examples/yaml-synopsis.yaml diff --git a/docs/docs/assets/crd/examples/old-version-synopsis.yaml b/docs/docs/assets/crd/examples/old-version-synopsis.yaml new file mode 100644 index 0000000000..cb66606d82 --- /dev/null +++ b/docs/docs/assets/crd/examples/old-version-synopsis.yaml @@ -0,0 +1,10 @@ +apiVersion: metrics.keptn.sh/v1alpha2 +kind: KeptnMetricsProvider +metadata: + name: prometheus | dynatrace |dql + namespace: +spec: + targetServer: "" + secretKeyRef: + name: dt-api-token + key: DT_TOKEN diff --git a/docs/docs/assets/crd/examples/yaml-synopsis.yaml b/docs/docs/assets/crd/examples/yaml-synopsis.yaml new file mode 100644 index 0000000000..64cbacbde9 --- /dev/null +++ b/docs/docs/assets/crd/examples/yaml-synopsis.yaml @@ -0,0 +1,12 @@ +apiVersion: metrics.keptn.sh/v1beta1 +kind: KeptnMetricsProvider +metadata: + name: + namespace: +spec: + type: prometheus | dynatrace | dql | datadog + targetServer: "" + secretKeyRef: + name: + key: + optional: true | false diff --git a/docs/docs/reference/crd-reference/metricsprovider.md b/docs/docs/reference/crd-reference/metricsprovider.md index 87362258cd..c0fda766f5 100644 --- a/docs/docs/reference/crd-reference/metricsprovider.md +++ b/docs/docs/reference/crd-reference/metricsprovider.md @@ -21,18 +21,7 @@ for each metric definition by its name. ## Yaml Synopsis ```yaml -apiVersion: metrics.keptn.sh/v1beta1 -kind: KeptnMetricsProvider -metadata: - name: - namespace: -spec: - type: prometheus | dynatrace | dql | datadog - targetServer: "" - secretKeyRef: - name: - key: - optional: true | false +{% include "../../assets/crd/examples/yaml-synopsis.yaml" %} ``` ## Fields @@ -166,16 +155,7 @@ only specified the `metadata.name` field that identified the data provider (`prometheus`, `dynatrace`, or `dql`): ```yaml -apiVersion: metrics.keptn.sh/v1alpha2 -kind: KeptnMetricsProvider -metadata: - name: prometheus | dynatrace |dql - namespace: -spec: - targetServer: "" - secretKeyRef: - name: dt-api-token - key: DT_TOKEN +{% include "../../assets/crd/examples/old-version-synopsis.yaml" %} ``` Also note that, for the v1alpha1 and v1alpha2 API versions, From 77df8cd8e1267a7da0b0dd3b66b33a15072904f4 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Mon, 19 Feb 2024 15:14:10 +0530 Subject: [PATCH 17/22] chore: add a to allowed inline elments Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- .markdownlint-cli2.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml index 2df44b47f5..37834b7eaa 100644 --- a/.markdownlint-cli2.yaml +++ b/.markdownlint-cli2.yaml @@ -9,6 +9,7 @@ config: allowed_elements: - details - summary + - a github-admonition: true max-one-sentence-per-line: true From 114323cd440884891b88d65c2048924c1be3ce7f Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Mon, 19 Feb 2024 15:15:02 +0530 Subject: [PATCH 18/22] chore: disable MD013 linter for only required anchor tags Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- docs/docs/reference/crd-reference/taskdefinition.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index 74f8121ba9..e2e9a7ca59 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -209,8 +209,10 @@ and Keptn sets up the container and runs the script as part of the task. Example 1: inline script for a Deno script - **python example:** + Example 1: inline code for a python-runtime runner + - **httpRef** - Specify a script to be executed at runtime from the remote webserver that is specified. @@ -256,7 +258,9 @@ and Keptn sets up the container and runs the script as part of the task. - **deno example:** Example 3: functionRef for a Deno script - **python example:** + Example 3: functionRef for a python-runtime runner + - **ConfigMapRef** - Specify the name of a [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) resource that contains the function to be executed. @@ -264,7 +268,9 @@ and Keptn sets up the container and runs the script as part of the task. - **deno example:** Example 5: ConfigMap for a Deno script - **python example:** + Example 4: ConfigMapRef for a python-runtime runner + - **parameters** - An optional field to supply input parameters to a function. @@ -279,7 +285,9 @@ and Keptn sets up the container and runs the script as part of the task. - **deno example:** Example 3: functionRef for a Deno script - **python example:** + Example 3: functionRef for a python-runner runner + - **secureParameters** -- An optional field used to pass a Kubernetes secret. @@ -296,7 +304,9 @@ and Keptn sets up the container and runs the script as part of the task. - **deno example:** Example 3: functionRef for a Deno script - **python example:** + Example 3: functionRef for a python-runner runner + ## Usage From dd6cf450f2e3d29f7dccd59b7918bde6065ecdc7 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Mon, 19 Feb 2024 16:28:25 +0530 Subject: [PATCH 19/22] chore: group tabs by example for both the runtimes together Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- .../reference/crd-reference/taskdefinition.md | 93 ++++++++++--------- 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index e2e9a7ca59..9adec44039 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -46,14 +46,14 @@ differentiated by the `spec` section: See Synopsis for Deno-runtime container and - [Deno-runtime examples](#examples-for-deno-runtime-runner). + [Deno-runtime examples](#examples-for-deno-runtime-and-python-runtime-runners). - Use the pre-defined `python-runtime` runner to define your task using [Python 3](https://www.python.org/). See Synopsis for python-runtime runner and - [Examples for a python-runtime runner](#examples-for-a-python-runtime-runner). + [Examples for a python-runtime runner](#examples-for-deno-runtime-and-python-runtime-runners). ## Synopsis for all runners @@ -370,8 +370,9 @@ This task is then referenced in the file. -## Examples for deno-runtime runner +## Examples for deno-runtime and python-runtime runners +### Examples for inline script === "Example 1: inline script for a Deno script" This example defines a full-fledged Deno script @@ -380,6 +381,16 @@ file. ```yaml {% include "../../assets/crd/examples/inline-script-for-deno-script.yaml" %} ``` +=== "Example 1: inline code for a python-runtime runner" + + You can embed python code directly in the task definition. + This example prints data stored in the parameters map: + + ```yaml + {% include "../../assets/crd/python-inline.yaml" %} + ``` + +### Examples for httpRef script === "Example 2: httpRef script for a Deno script" @@ -396,6 +407,21 @@ file. [sample-app/version-1](https://github.com/keptn-sandbox/lifecycle-toolkit-examples/blob/main/sample-app/version-1/app-pre-deploy.yaml) PodtatoHead example for a more complete example. +=== "Example 2: httpRef for a python-runtime runner" + + You can refer to code stored online. + For example, we have a few examples available in the + [python-runtime samples](https://github.com/keptn/lifecycle-toolkit/tree/main/runtimes/python-runtime/samples) + tree. + + Consider the following: + + ```yaml + {% include "../../assets/crd/python-configmap.yaml" %} + ``` + +### Examples for functionRef + === "Example 3: functionRef for a Deno script" This example calls another defined task, @@ -408,6 +434,18 @@ file. {% include "../../assets/crd/examples/functionref-for-deno-script.yaml" %} ``` +=== "Example 3: functionRef for a python-runtime runner" + + You can refer to an existing `KeptnTaskDefinition`. + this example calls the inline example + but overrides the data printed with what is specified in the task: + + ```yaml + {% include "../../assets/crd/python-recursive.yaml" %} + ``` + +### Examples for ConfigMapRef + === "Example 4: ConfigMapRef for a Deno script" This example references a `ConfigMap` by the name of `dev-configmap` @@ -417,6 +455,14 @@ file. {% include "../../assets/crd/examples/configmapref-for-deno-script.yaml" %} ``` +=== "Example 4: ConfigMapRef for a python-runtime runner" + + ```yaml + {% include "../../assets/crd/python-configmap.yaml" %} + ``` + +### Examples for ConfigMap + === "Example 5: ConfigMap for a Deno script" This example illustrates the use of both a `ConfigMapRef` and a `ConfigMap`: @@ -425,6 +471,8 @@ file. {% include "../../assets/crd/examples/configmap-for-deno-script.yaml" %} ``` +### Example for Accessing KEPTN_CONTEXT environment variable + === "Example 6: Accessing KEPTN_CONTEXT environment variable in a Deno task" For Tasks triggered as pre- and post- deployment of applications @@ -436,45 +484,6 @@ file. let context = Deno.env.get("KEPTN_CONTEXT"); ``` -## Examples for a python-runtime runner - -=== "Example 1: inline code for a python-runtime runner" - - You can embed python code directly in the task definition. - This example prints data stored in the parameters map: - - ```yaml - {% include "../../assets/crd/python-inline.yaml" %} - ``` - -=== "Example 2: httpRef for a python-runtime runner" - - You can refer to code stored online. - For example, we have a few examples available in the - [python-runtime samples](https://github.com/keptn/lifecycle-toolkit/tree/main/runtimes/python-runtime/samples) - tree. - - Consider the following: - - ```yaml - {% include "../../assets/crd/python-configmap.yaml" %} - ``` - -=== "Example 3: functionRef for a python-runtime runner" - - You can refer to an existing `KeptnTaskDefinition`. - this example calls the inline example - but overrides the data printed with what is specified in the task: - - ```yaml - {% include "../../assets/crd/python-recursive.yaml" %} - ``` - -=== "Example 4: ConfigMapRef for a python-runtime runner" - - ```yaml - {% include "../../assets/crd/python-configmap.yaml" %} - ``` ### Allowed libraries for the python-runtime runner From 4940644d687951e15fa6d27cc9dc8e56f4e913ee Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Mon, 19 Feb 2024 16:33:47 +0530 Subject: [PATCH 20/22] chore: fix markdown check actions/runs/7958452671/job/21723348299 Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- docs/docs/reference/crd-reference/taskdefinition.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index 9adec44039..71ad9a1542 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -373,6 +373,7 @@ file. ## Examples for deno-runtime and python-runtime runners ### Examples for inline script + === "Example 1: inline script for a Deno script" This example defines a full-fledged Deno script @@ -390,7 +391,7 @@ file. {% include "../../assets/crd/python-inline.yaml" %} ``` -### Examples for httpRef script +### Examples for httpRef script === "Example 2: httpRef script for a Deno script" From 0d1c48a32d08b94f9e6364cca315fb5ceb776be8 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:20:57 +0530 Subject: [PATCH 21/22] chore: remove-cofigMap-from-httpRef-example-for-python-runtime Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- docs/docs/reference/crd-reference/taskdefinition.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index 71ad9a1542..a10e13176f 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -229,7 +229,7 @@ and Keptn sets up the container and runs the script as part of the task. - **deno example:** Example 2: httpRef script for a Deno script - **python example:** - Example 2: httpRef for a python-runtime runner +
- **functionRef** -- Execute another `KeptnTaskDefinition` resources. Populate this field with the value(s) of the `metadata.name` field for each `KeptnDefinitionTask` to be called. @@ -415,12 +415,6 @@ file. [python-runtime samples](https://github.com/keptn/lifecycle-toolkit/tree/main/runtimes/python-runtime/samples) tree. - Consider the following: - - ```yaml - {% include "../../assets/crd/python-configmap.yaml" %} - ``` - ### Examples for functionRef === "Example 3: functionRef for a Deno script" From c5006e62ae0ad47de1338a728a93b6fac050930a Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:29:51 +0530 Subject: [PATCH 22/22] chore: add MD033 ignorer for adding br element Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- docs/docs/reference/crd-reference/taskdefinition.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/docs/reference/crd-reference/taskdefinition.md b/docs/docs/reference/crd-reference/taskdefinition.md index a10e13176f..2543651910 100644 --- a/docs/docs/reference/crd-reference/taskdefinition.md +++ b/docs/docs/reference/crd-reference/taskdefinition.md @@ -229,7 +229,9 @@ and Keptn sets up the container and runs the script as part of the task. - **deno example:** Example 2: httpRef script for a Deno script - **python example:** +
+ - **functionRef** -- Execute another `KeptnTaskDefinition` resources. Populate this field with the value(s) of the `metadata.name` field for each `KeptnDefinitionTask` to be called.