Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add content tabs in code examples in reference section #3005

Merged
merged 24 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ff098fd
add-extensions-config
vishalvivekm Feb 9, 2024
70b8f98
feat: add tabs in KeptnMetricsProvider page
vishalvivekm Feb 9, 2024
d65db3a
feat: add tabs in KeptnTaskDefinition page
vishalvivekm Feb 9, 2024
a605fdc
Merge branch 'main' into main
vishalvivekm Feb 9, 2024
5980591
chore: add kwds in expected words list
vishalvivekm Feb 9, 2024
bddaad6
chore: fix failing YAML checks
vishalvivekm Feb 9, 2024
2525588
chore: disable MD046 and MD051 for content tabs on the two reference …
vishalvivekm Feb 9, 2024
5efb09b
chore: move code examples to seperate files to be referenced via include
vishalvivekm Feb 10, 2024
381be2d
chore: add newline at the end of yaml files to fix the yaml check
vishalvivekm Feb 11, 2024
e313294
Merge branch 'main' into main
vishalvivekm Feb 14, 2024
2c743fb
chore: remove the MD051 ignorer from metricsprovider page
vishalvivekm Feb 14, 2024
70838bf
chore: fix MD102 remove-consecutive-blank-lines
vishalvivekm Feb 17, 2024
ca4888e
chore: remove MD051 ignorer
vishalvivekm Feb 17, 2024
06e53b7
chore: fix yaml checks actions/runs/7902583116/job/21570231006?pr=3005
vishalvivekm Feb 17, 2024
c38fa58
chore: move code snippets to seperate files to be referenced via include
vishalvivekm Feb 17, 2024
7ae837c
chore: use MD046 ignorer in required sections of the page only
vishalvivekm Feb 17, 2024
3b01f4a
chore: add newline and required indentation
vishalvivekm Feb 19, 2024
71defda
chore: move remaining snippets to seperate files and reference them u…
vishalvivekm Feb 19, 2024
77df8cd
chore: add a to allowed inline elments
vishalvivekm Feb 19, 2024
114323c
chore: disable MD013 linter for only required anchor tags
vishalvivekm Feb 19, 2024
dd6cf45
chore: group tabs by example for both the runtimes together
vishalvivekm Feb 19, 2024
4940644
chore: fix markdown check actions/runs/7958452671/job/21723348299
vishalvivekm Feb 19, 2024
0d1c48a
chore: remove-cofigMap-from-httpRef-example-for-python-runtime
vishalvivekm Feb 19, 2024
c5006e6
chore: add MD033 ignorer for adding br element
vishalvivekm Feb 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ kustomize
kustomizeconfig
kwi
kwv
kwds
kyverno
lastword
Lato
Expand Down
1 change: 1 addition & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ config:
allowed_elements:
- details
- summary
- a
github-admonition: true
max-one-sentence-per-line: true

Expand Down
30 changes: 30 additions & 0 deletions docs/docs/assets/crd/examples/configmap-for-deno-script.yaml
Original file line number Diff line number Diff line change
@@ -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);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnTaskDefinition
metadata:
name: keptntaskdefinition-sample
spec:
deno:
configMapRef:
name: dev-configmap
13 changes: 13 additions & 0 deletions docs/docs/assets/crd/examples/functionref-for-deno-script.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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");
10 changes: 10 additions & 0 deletions docs/docs/assets/crd/examples/old-version-synopsis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: metrics.keptn.sh/v1alpha2
kind: KeptnMetricsProvider
metadata:
name: prometheus | dynatrace |dql
namespace: <namespace>
spec:
targetServer: "<data-provider-url>"
secretKeyRef:
name: dt-api-token
key: DT_TOKEN
9 changes: 9 additions & 0 deletions docs/docs/assets/crd/examples/synopsis-for-all-runners.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: lifecycle.keptn.sh/v?alpha?
kind: KeptnTaskDefinition
metadata:
name: <task-name>
spec: |
deno | python | container
...
retries: <integer>
timeout: <duration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: lifecycle.keptn.sh/v?alpha?
kind: KeptnTaskDefinition
metadata:
name: <task-name>
spec:
container: |
name: <container-name>
image: <image-name>
<other fields>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: lifecycle.keptn.sh/v?alpha?
kind: KeptnTaskDefinition
metadata:
name: <task-name>
spec:
deno: |
inline | httpRef | functionRef | ConfigMapRef
parameters: |
map:
textMessage: "This is my configuration"
secureParameters:
secret: <secret-name>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: lifecycle.keptn.sh/v?alpha?
kind: KeptnTaskDefinition
metadata:
name: <task-name>
spec:
python: |
inline | httpRef | functionRef | ConfigMapRef
parameters: |
map:
textMessage: "This is my configuration"
secureParameters:
secret: <secret-name>
12 changes: 12 additions & 0 deletions docs/docs/assets/crd/examples/yaml-synopsis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: metrics.keptn.sh/v1beta1
kind: KeptnMetricsProvider
metadata:
name: <data-source-instance-name>
namespace: <namespace>
spec:
type: prometheus | dynatrace | dql | datadog
targetServer: "<data-source-url>"
secretKeyRef:
name: <secret-name>
key: <secret-key-that-holds-token>
optional: true | false
92 changes: 37 additions & 55 deletions docs/docs/reference/crd-reference/metricsprovider.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,7 @@ for each metric definition by its name.
## Yaml Synopsis

```yaml
apiVersion: metrics.keptn.sh/v1beta1
kind: KeptnMetricsProvider
metadata:
name: <data-source-instance-name>
namespace: <namespace>
spec:
type: prometheus | dynatrace | dql | datadog
targetServer: "<data-source-url>"
secretKeyRef:
name: <secret-name>
key: <secret-key-that-holds-token>
optional: true | false
{% include "../../assets/crd/examples/yaml-synopsis.yaml" %}
```

## Fields
Expand Down Expand Up @@ -99,49 +88,51 @@ For detailed information please look at the [Examples section](#examples).

## Examples

### Prometheus
<!-- markdownlint-disable MD046 -->

An example of Prometheus as a metrics provider with a Secret holding
the authentication data looks like the following:
=== "Prometheus"
vishalvivekm marked this conversation as resolved.
Show resolved Hide resolved

```yaml
{% include "./assets/keptnmetricsprovider-prometheus.yaml" %}
```
An example of Prometheus as a metrics provider with a Secret holding
odubajDT marked this conversation as resolved.
Show resolved Hide resolved
the authentication data looks like the following:

> **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.
```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
=== "Datadog"

An example of Datadog as a metrics provider with a Secret holding
the authentication data looks like the following:
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.

```yaml
{% include "./assets/keptnmetricsprovider-datadog.yaml" %}
```
=== "Dynatrace and DQL"

> **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.
An example of Dynatrace as a metrics provider with a Secret holding
the authentication data looks like the following:

### Dynatrace and DQL
```yaml
{% include "./assets/keptnmetricsprovider-dynatrace.yaml" %}
```

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.

> **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.
<!-- markdownlint-enable MD046 -->

## Files

Expand All @@ -164,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: <namespace>
spec:
targetServer: "<data-provider-url>"
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,
Expand Down
Loading
Loading