Skip to content

Commit

Permalink
docs: move to v1 metrics API (#3323)
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT authored Mar 21, 2024
1 parent 535ab8a commit 5daef98
Show file tree
Hide file tree
Showing 35 changed files with 61 additions and 59 deletions.
2 changes: 1 addition & 1 deletion docs/docs/assets/crd/analysis-definition.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: AnalysisDefinition
metadata:
name: ad-my-proj-dev-svc1
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/assets/crd/analysis-template.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: AnalysisValueTemplate
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/assets/crd/analysis.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: Analysis
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/assets/crd/examples/yaml-synopsis.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetricsProvider
metadata:
name: <data-source-instance-name>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/assets/crd/metric.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetric
metadata:
name: available-cpus
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/components/metrics-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ The steps in which the controller fetches metrics are given below:
in the `status` field of the `KeptnMetric` object.
* If the evaluation fails,
the error and reason is written to the
[KeptnMetricStatus](../reference/api-reference/metrics/v1beta1/index.md#keptnmetricstatus)
[KeptnMetricStatus](../reference/api-reference/metrics/v1/index.md#keptnmetricstatus)
resource.
The error is described in both human-readable language
and as raw data to help identify the source of the problem
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/contribute/software/add-new-metric-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ The steps to create your own metrics provider are:

5. **Update the validation webhook and crd config:** To update the validation webhook and crd config of the metrics operator.
Add the provider name next to last providers on this
[line](https://github.com/keptn/lifecycle-toolkit/blob/main/metrics-operator/api/v1beta1/keptnmetricsprovider_types.go#L29)
[line](https://github.com/keptn/lifecycle-toolkit/blob/main/metrics-operator/api/v1/keptnmetricsprovider_types.go#L29)
to look like this

`// +kubebuilder:validation:Pattern:=prometheus|dynatrace|datadog|dql|placeholder`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

"github.com/go-logr/logr"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1beta1"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1"
)

type KeptnPlaceholderProvider struct {
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/getting-started/assets/metric-providers.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetricsProvider
metadata:
name: dev-prometheus
Expand All @@ -18,7 +18,7 @@ data:
user: user
type: Opaque
---
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetricsProvider
metadata:
name: dev-dynatrace
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/getting-started/assets/metric.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetric
metadata:
name: available-cpus
Expand All @@ -9,7 +9,7 @@ spec:
query: "sum(kube_node_status_capacity{resources`cpu`})"
fetchIntervalSeconds: 10
---
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetric
metadata:
name: availability-slo
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/getting-started/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ $ kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta2/namespaces/simplenode-d
"kind": "KeptnMetric",
"namespace": "simplenode-dev",
"name": "available-cpus",
"apiVersion": "metrics.keptn.sh/v1beta1"
"apiVersion": "metrics.keptn.sh/v1"
},
"metric": {
"name": "available-cpus",
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/guides/assets/metric-providers.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetricsProvider
metadata:
name: dev-prometheus
Expand All @@ -18,7 +18,7 @@ data:
user: user
type: Opaque
---
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetricsProvider
metadata:
name: dev-dynatrace
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/guides/assets/metric.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetric
metadata:
name: available-cpus
Expand All @@ -9,7 +9,7 @@ spec:
query: "sum(kube_node_status_capacity{resources`cpu`})"
fetchIntervalSeconds: 10
---
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetric
metadata:
name: availability-slo
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/guides/evaluatemetrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ $ kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta2/namespaces/podtato-kube
"kind": "KeptnMetric",
"namespace": "podtato-kubectl",
"name": "keptnmetric-sample",
"apiVersion": "metrics.keptn.sh/v1beta1"
"apiVersion": "metrics.keptn.sh/v1"
},
"metric": {
"name": "keptnmetric-sample",
Expand Down Expand Up @@ -177,7 +177,7 @@ $ kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta2/namespaces/podtato-kube
"kind": "KeptnMetric",
"namespace": "keptn-system",
"name": "keptnmetric-sample",
"apiVersion": "metrics.keptn.sh/v1beta1"
"apiVersion": "metrics.keptn.sh/v1"
},
"metric": {
"name": "keptnmetric-sample",
Expand Down Expand Up @@ -207,7 +207,7 @@ 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
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetric
metadata:
name: good-metric
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/guides/slo.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ A Keptn Analysis is implemented with three resources:
Consider the following `Analysis` resource:

```yaml
{% include "https://raw.githubusercontent.com/keptn/lifecycle-toolkit/main/metrics-operator/config/samples/metrics_v1beta1_analysis.yaml" %}
{% include "https://raw.githubusercontent.com/keptn/lifecycle-toolkit/main/metrics-operator/config/samples/metrics_v1_analysis.yaml" %}
```

This `Analysis` resource:
Expand All @@ -110,7 +110,7 @@ The `AnalysisDefinition` resource references this `Analysis` resource
by its `name` and `namespace` and can be seen here:

```yaml
{% include "https://raw.githubusercontent.com/keptn/lifecycle-toolkit/main/metrics-operator/config/samples/metrics_v1beta1_analysisdefinition.yaml" %}
{% include "https://raw.githubusercontent.com/keptn/lifecycle-toolkit/main/metrics-operator/config/samples/metrics_v1_analysisdefinition.yaml" %}
```

This simple definition contains a single objective, `response-time-p95`.
Expand All @@ -136,7 +136,7 @@ or fails with 0% (slower response time).
The objective points to the corresponding `AnalysisValueTemplate` resource:

```yaml
{% include "https://raw.githubusercontent.com/keptn/lifecycle-toolkit/main/metrics-operator/config/samples/metrics_v1beta1_analysisvaluetemplate.yaml" %}
{% include "https://raw.githubusercontent.com/keptn/lifecycle-toolkit/main/metrics-operator/config/samples/metrics_v1_analysisvaluetemplate.yaml" %}
```

This template defines a query to a provider called `prometheus`:
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/migrate/keptn/metrics-observe.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ The process is:
```yaml
apiVersion: v1
items:
- apiVersion: metrics.keptn.sh/v1beta1
- apiVersion: metrics.keptn.sh/v1
kind: Analysis
metadata:
creationTimestamp: "2023-09-14T11:00:01Z"
Expand Down Expand Up @@ -295,7 +295,7 @@ to insert a variable as a placeholder
for the service identifier in the prometheus query:

```yaml
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: AnalysisValueTemplate
metadata:
creationTimestamp: null
Expand All @@ -312,7 +312,7 @@ 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
apiVersion: metrics.keptn.sh/v1
kind: Analysis
metadata:
name: analysis-sample-1
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/reference/crd-reference/analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ that are used in the `AnalysisDefinition` query.
## Synopsis

```yaml
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: Analysis
metadata:
name: <name-of-analysis>
Expand Down Expand Up @@ -300,7 +300,7 @@ guide page.

## Files

API reference: [Analysis](../api-reference/metrics/v1beta1/index.md#analysis)
API reference: [Analysis](../api-reference/metrics/v1/index.md#analysis)

## Differences between versions

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/reference/crd-reference/analysisdefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ list of Service Level Objectives (SLOs) for an `Analysis`.
## Synopsis

```yaml
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: AnalysisDefinition
metadata:
name: <name-of-this-resource>
Expand Down Expand Up @@ -134,7 +134,7 @@ Each of these objectives must specify:
## Example

```yaml
{% include "https://raw.githubusercontent.com/keptn/lifecycle-toolkit/main/metrics-operator/config/samples/metrics_v1beta1_analysisdefinition.yaml" %}
{% include "https://raw.githubusercontent.com/keptn/lifecycle-toolkit/main/metrics-operator/config/samples/metrics_v1_analysisdefinition.yaml" %}
```

For a full example of how to implement the Keptn Analysis feature, see the
Expand All @@ -144,7 +144,7 @@ guide page.
## Files

API reference:
[AnalysisDefinition](../api-reference/metrics/v1beta1/index.md#analysisdefinition)
[AnalysisDefinition](../api-reference/metrics/v1/index.md#analysisdefinition)

## Differences between versions

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/reference/crd-reference/analysisvaluetemplate.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ One Analysis can use data from multiple AnalysisValueTemplates.
## Synopsis

```yaml
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: AnalysisValueTemplate
metadata:
name: response-time-p95
Expand Down Expand Up @@ -86,7 +86,7 @@ guide page.
## Files

API reference:
[AnalysisValueTemplate](../api-reference/metrics/v1beta1/index.md#analysisvaluetemplate)
[AnalysisValueTemplate](../api-reference/metrics/v1/index.md#analysisvaluetemplate)

## Differences between versions

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetricsProvider
metadata:
name: datadog-provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetricsProvider
metadata:
name: dynatrace-provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetricsProvider
metadata:
name: prometheus-provider
Expand Down
6 changes: 4 additions & 2 deletions docs/docs/reference/crd-reference/metric.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ for different metrics at the same time.
## Yaml Synopsis

```yaml
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetric
metadata:
name: <metric-name>
Expand Down Expand Up @@ -143,7 +143,7 @@ defined as `my-provider` in the `spec.provider.name` field
of the corresponding `KeptnMetricsProvider` CR.

```yaml
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetric
metadata:
name: keptnmetric-sample
Expand All @@ -163,6 +163,8 @@ API Reference:

## Differences between versions

- Versions `v1beta1` and `v1` are fully compatible.

- Beginning with the `v1beta1` API version,
the metrics controller supports multiple metrics in its `status` field
if the value of the `spec.range.storedResults` field is greater than 1.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/use-cases/assets/hpa/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
metric:
name: cpu-throttling
describedObject:
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetric
name: cpu-throttling
target:
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/use-cases/assets/hpa/keptnmetric.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetricsProvider
metadata:
name: prometheus-provider
Expand All @@ -7,7 +7,7 @@ spec:
type: prometheus
targetServer: <your-metrics-provider-server>
---
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetric
metadata:
name: cpu-throttling
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/use-cases/hpa.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ the HPA to react on the values of these metrics:
```

For more information about the `KeptnMetric` and `KeptnMetricsProvider` custom resources,
please refer to the [CRD documentation](../reference/api-reference/metrics/v1beta1/index.md).
please refer to the [CRD documentation](../reference/api-reference/metrics/v1/index.md).

After a few seconds we should be able to see values for the `cpu-throttling` metric:

```shell
$ kubectl describe keptnmetrics.metrics.keptn.sh cpu-throttling -n podtato-kubectl
Name: cpu-throttling
Namespace: podtato-kubectl
API Version: metrics.keptn.sh/v1beta1
API Version: metrics.keptn.sh/v1
Kind: KeptnMetric
Spec:
Fetch Interval Seconds: 60
Expand Down
2 changes: 1 addition & 1 deletion examples/sample-app/base/metric.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetric
metadata:
name: available-cpus
Expand Down
2 changes: 1 addition & 1 deletion examples/sample-app/base/provider.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: metrics.keptn.sh/v1beta1
apiVersion: metrics.keptn.sh/v1
kind: KeptnMetricsProvider
metadata:
name: my-provider
Expand Down
Loading

0 comments on commit 5daef98

Please sign in to comment.