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 metrics-operator architecture #1151

Merged
merged 10 commits into from
Apr 17, 2023
33 changes: 0 additions & 33 deletions docs/content/en/docs/concepts/architecture/components/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,3 @@ style Scheduler fill:#d8e6f4,stroke:#fff,stroke-width:px,color:#006bb8
style Lifecycle-Operator fill:#d8e6f4,stroke:#fff,stroke-width:px,color:#006bb8
style Metrics-Operator fill:#d8e6f4,stroke:#fff,stroke-width:px,color:#006bb8
```

**Keptn's Lifecycle Operator** is
a Kubernetes [operator](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/)
that automates the deployment and management
of the Keptn Lifecycle Controller components in a Kubernetes cluster.
The Keptn Lifecycle Operator contains several controllers for **Keptn CRDs**
and a **Mutating Webhook**.

Here's a brief overview:

**Keptn CRDs:** Keptn Lifecycle Operator contains
several controllers that manage and reconcile different types of Keptn CRDs
such as the Project Controller, Service Controller, and Stage Controller.

**Mutating Webhook:** automatically injects Keptn labels
and annotations into Kubernetes resources,
such as deployments and services.
These labels and annotations are used to enable Keptn's automation
and monitoring capabilities.

**Keptn's Lifecycle Metrics Operator**
collects, processes, and analyzes metrics data from a variety of sources.
Once collected, this data, can be used to generate a variety of reports
and dashboards that provide insights into the health and performance of the application and infrastructure.

**Keptn's Lifecycle Scheduler** replaces the
[Kubernetes scheduler](https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/)
to allow users to schedule events and tasks to occur
at specific times during the application lifecycle.
The Lifecycle Scheduler can trigger events such as
deployment, testing, and remediation at specific times or intervals.
The Keptn Scheduler guarantees that Pods are initiated only after
the Pre-Deployment checks are completed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: Keptn Lifecycle Operator
linktitle: Lifecycle Operator
description: Basic understanding of Keptn's Lifecycle Operator
weight: 80
cascade:
---


**Keptn's Lifecycle Operator** is
a Kubernetes [operator](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/)
that automates the deployment and management
of the Keptn Lifecycle Controller components in a Kubernetes cluster.
The Keptn Lifecycle Operator contains several controllers for **Keptn CRDs**
and a **Mutating Webhook**.

Here's a brief overview:

**Keptn CRDs:** Keptn Lifecycle Operator contains
several controllers that manage and reconcile different types of Keptn CRDs
such as the Project Controller, Service Controller, and Stage Controller.

**Mutating Webhook:** automatically injects Keptn labels
and annotations into Kubernetes resources,
such as deployments and services.
These labels and annotations are used to enable Keptn's automation
and monitoring capabilities.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Keptn Metrics Operator
linktitle: Metrics Operator
description: Basic understanding of Keptn's Metrics Operator
weight: 80
cascade:
---


The Keptn Metrics Operator collects, processes, and analyzes metrics data from a variety of sources.
Once collected, this data, can be used to generate a variety of reports and dashboards
that provide insights into the health and performance of the application and infrastructure.

rakshitgondwal marked this conversation as resolved.
Show resolved Hide resolved
While Kubernetes does have two metrics servers, they have limitations.
The custom and external APIs only allow you to use a single observability platform.
The Keptn Metrics Operator solves this problem by providing a single entry point for
all your metrics data, regardless of its source.
Furthermore, due to the integration with the Kubernetes custom metrics API, these metrics are also
compatible with the Kubernetes HorizontalPodAutoscaler (HPA) which enables the horizontal scaling of workloads
based on metrics collected from multiple observability platforms such as Prometheus, Dynatrace or Datadog.

The Metrics Operator consists of the following components:

* Metrics Controller
* Metrics Adapter

```mermaid
graph TD;
Metrics-Operator-->Metrics-Adapter;
Metrics-Operator-->Metrics-Controller
style Metrics-Operator fill:#006bb8,stroke:#fff,stroke-width:px,color:#fff
style Metrics-Adapter fill:#d8e6f4,stroke:#fff,stroke-width:px,color:#006bb8
style Metrics-Controller fill:#d8e6f4,stroke:#fff,stroke-width:px,color:#006bb8
```

**Metrics adapter** is used to expose custom metrics from an application to external monitoring and alerting tools.
The adapter exposes custom metrics on a specific endpoint where external monitoring and alerting tools can scrape them.
It is an important component of the metrics operator as it allows for the collection and exposure of custom metrics,
which can be used to gain insight into the behavior and performance of applications running on a Kubenetes cluster.

**Metrics controller** is used to fetch metrics from a SLI provider.
The controller reconciles a [`KeptnMetric`](../../../../yaml-crd-ref/metric.md) CR and
updates its status with the metric value provided by the selected SLI provider.
The steps in which the controller fetches metrics are given below:

* It first fetches the `KeptnMetric` object to reconcile.
* If the object is not found, it returns and lets Kubernetes handle deleting all associated resources.
* If the object is found, the code checks that if the metric has been updated within the configured
interval which is defined in the `Spec.FetchIntervalSeconds`.
If not, then it skips reconciling and requeues the request for later.
* If the metric should be reconciled, it fetches the provider defined in the `Spec.Provider.Name` field.
* If the provider is not found, it returns and requeues the request for later.
* If the provider is found, it loads the provider and evaluates the query defined in the `Spec.Query` field.
* If the evaluation is succesful, it stores the fetched value in the status of the `KeptnMetric` object.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Keptn Lifecycle Scheduler
linktitle: Scheduler
description: Basic understanding of Keptn's Lifecycle Scheduler
weight: 80
cascade:
---

**Keptn's Lifecycle Scheduler** replaces the
[Kubernetes scheduler](https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/)
to allow users to schedule events and tasks to occur
at specific times during the application lifecycle.
The Lifecycle Scheduler can trigger events such as
deployment, testing, and remediation at specific times or intervals.
The Keptn Scheduler guarantees that Pods are initiated only after
the Pre-Deployment checks are completed.