Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
2403353
chore: make manifests
maximiliantech Jun 2, 2025
cb3c6b6
docs(readme): update sample
maximiliantech Jun 2, 2025
fb174bd
chore: remove `ClusterAccess` CRD
maximiliantech Jun 2, 2025
d81924c
fix: remove test
maximiliantech Jun 2, 2025
4797ad7
fix(helm): image location
maximiliantech Jun 2, 2025
5fff4a5
refactor: co-metrics-operator to metrics-operator
maximiliantech Jun 2, 2025
84d833e
refactor: co-dynatrace-credentials to dynatrace-credentials
maximiliantech Jun 2, 2025
5861bca
chore: merge main
maximiliantech Jun 3, 2025
f6dafb9
refactor: main.go
maximiliantech Jun 3, 2025
e7ad057
chore: update rbac
maximiliantech Jun 3, 2025
a787519
chore: cleanup PROJECT file
maximiliantech Jun 3, 2025
bf133f0
fix: remove unused file
maximiliantech Jun 3, 2025
e2eac25
docs: update example
maximiliantech Jun 3, 2025
f386eb2
fix(PROJECT): version of CRD
maximiliantech Jun 3, 2025
f582ae5
refactor: remove `co` occurrences
maximiliantech Jun 3, 2025
defc99a
chore: delete files
maximiliantech Jun 3, 2025
020c1c7
fix: kustomization
maximiliantech Jun 4, 2025
031ff23
fix: sample secret
maximiliantech Jun 4, 2025
45c981b
fix: sample file
maximiliantech Jun 4, 2025
b94153d
chore: simplify Makefile
maximiliantech Jun 4, 2025
038f943
Revert "chore: simplify Makefile"
maximiliantech Jun 4, 2025
4421b50
Merge branch 'main' into docs/improvements
maximiliantech Jun 5, 2025
d498213
chore: simplify Makefile & add comments
maximiliantech Jun 5, 2025
780b534
refactor(make): target name
maximiliantech Jun 5, 2025
6450f1f
chore(makefile): simplify
maximiliantech Jun 5, 2025
476b26d
Merge branch 'docs/improvements' of https://github.com/SAP/metrics-op…
maximiliantech Jun 5, 2025
c740a6d
chore: restructure Makefile
maximiliantech Jun 5, 2025
183028c
chore: update sample secret
maximiliantech Jun 5, 2025
6876c10
fix: `make run` target
maximiliantech Jun 5, 2025
9c563e8
fix: remove folder
maximiliantech Jun 5, 2025
4589443
delete sample secret
maximiliantech Jun 5, 2025
626c48b
chore: clean up Makefile
maximiliantech Jun 5, 2025
5eefb0d
fix(Makefile): golang-ci installation
maximiliantech Jun 6, 2025
d916267
docs(reamde): restructure table of contents
maximiliantech Jun 6, 2025
866d530
chore: update .gitignore
maximiliantech Jun 6, 2025
c807b7e
docs(readme): enrich quickstart
maximiliantech Jun 6, 2025
7e66d14
docs(readme): add CRD links to resource type definitions
maximiliantech Jun 6, 2025
d13b1d8
docs(readme): update table of contents
maximiliantech Jun 6, 2025
b771dd6
docs(readme): update install instructions
maximiliantech Jun 10, 2025
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ examples/sample_secret.yaml
examples/dynatrace_secret.yaml
examples/secret.yaml
/examples/datasink/dynatrace-prod-setup.yaml

# debug file
*debug*
333 changes: 144 additions & 189 deletions Makefile

Large diffs are not rendered by default.

22 changes: 3 additions & 19 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -31,43 +31,27 @@ resources:
kind: RemoteClusterAccess
path: github.com/SAP/metrics-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: metrics.cloud.sap
kind: CompoundMetric
path: github.com/SAP/metrics-operator/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: metrics.cloud.sap
kind: FederatedMetric
path: github.com/SAP/metrics-operator/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: metrics.cloud.sap
kind: ClusterAccess
path: github.com/SAP/metrics-operator/api/v1beta1
path: github.com/SAP/metrics-operator/api/v1alpha1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
domain: metrics.cloud.sap
kind: FederatedClusterAccess
path: github.com/SAP/metrics-operator/api/v1beta1
path: github.com/SAP/metrics-operator/api/v1alpha1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: metrics.cloud.sap
kind: FederatedManagedMetric
path: github.com/SAP/metrics-operator/api/v1beta1
path: github.com/SAP/metrics-operator/api/v1alpha1
version: v1beta1
version: "3"
141 changes: 83 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,45 @@ The Metrics Operator is a powerful tool designed to monitor and provide insights

## Table of Contents

- [Key Features](#key-features)
- [Architecture Overview](#architecture-overview)
- [Installation](#installation)
- [Usage](#usage)
- [RBAC Configuration](#rbac-configuration)
- [Remote Cluster Access](#remote-cluster-access)
- [DataSink Configuration](#datasink-configuration)
- [Data Sink Integration](#data-sink-integration)
- [Metrics Operator](#metrics-operator)
- [Table of Contents](#table-of-contents)
- [Key Features](#key-features)
- [Architecture Overview](#architecture-overview)
- [Metric Resource Flow](#metric-resource-flow)
- [ManagedMetric Resource Flow](#managedmetric-resource-flow)
- [FederatedMetric Resource Flow](#federatedmetric-resource-flow)
- [FederatedManagedMetric Resource Flow](#federatedmanagedmetric-resource-flow)
- [Resource Type Descriptions:](#resource-type-descriptions)
- [Installation](#installation)
- [Prerequisites](#prerequisites)
- [Deployment](#deployment)
- [Getting Started](#getting-started)
- [Quickstart](#quickstart)
- [Common Development Tasks](#common-development-tasks)
- [Usage](#usage)
- [Metric](#metric)
- [Managed Metric](#managed-metric)
- [Federated Metric](#federated-metric)
- [Federated Managed Metric](#federated-managed-metric)
- [Remote Cluster Access](#remote-cluster-access)
- [Remote Cluster Access](#remote-cluster-access-1)
- [Federated Cluster Access](#federated-cluster-access)
- [RBAC Configuration](#rbac-configuration)
- [DataSink Configuration](#datasink-configuration)
- [Creating a DataSink](#creating-a-datasink)
- [DataSink Specification](#datasink-specification)
- [Connection](#connection)
- [Authentication](#authentication)
- [Using DataSink in Metrics](#using-datasink-in-metrics)
- [Default Behavior](#default-behavior)
- [Supported Metric Types](#supported-metric-types)
- [Examples and Detailed Documentation](#examples-and-detailed-documentation)
- [Migration from Legacy Configuration](#migration-from-legacy-configuration)
- [Data Sink Integration](#data-sink-integration)
- [Support, Feedback, Contributing](#support-feedback-contributing)
- [Security / Disclosure](#security--disclosure)
- [Code of Conduct](#code-of-conduct)
- [Licensing](#licensing)

## Key Features

Expand All @@ -37,12 +68,12 @@ graph LR
M -.->|optional| RCA[RemoteClusterAccess]
RCA -->|accesses remote cluster| K8S
M -->|sends data to| DS[Data Sink<br/>Dynatrace, etc.]

classDef metricType fill:#e1f5fe,stroke:#01579b,stroke-width:2px
classDef accessType fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
classDef targetType fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
classDef dataType fill:#fff3e0,stroke:#e65100,stroke-width:2px

class M metricType
class RCA accessType
class K8S targetType
Expand All @@ -57,12 +88,12 @@ graph LR
MM -.->|optional| RCA[RemoteClusterAccess]
RCA -->|accesses remote cluster| MR
MM -->|sends data to| DS[Data Sink<br/>Dynatrace, etc.]

classDef metricType fill:#e1f5fe,stroke:#01579b,stroke-width:2px
classDef accessType fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
classDef targetType fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
classDef dataType fill:#fff3e0,stroke:#e65100,stroke-width:2px

class MM metricType
class RCA accessType
class MR targetType
Expand All @@ -78,12 +109,12 @@ graph LR
FCA -->|provides access to| MC[Multiple Clusters]
FM -->|targets across clusters| K8S[Kubernetes Objects<br/>across federated clusters]
FM -->|aggregates & sends to| DS[Data Sink<br/>Dynatrace, etc.]

classDef metricType fill:#e1f5fe,stroke:#01579b,stroke-width:2px
classDef accessType fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
classDef targetType fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
classDef dataType fill:#fff3e0,stroke:#e65100,stroke-width:2px

class FM metricType
class FCA accessType
class CP,MC,K8S targetType
Expand All @@ -99,26 +130,27 @@ graph LR
FCA -->|provides access to| MC[Multiple Clusters]
FMM -->|targets managed resources<br/>across clusters| MR[Managed Resources<br/>with 'crossplane' & 'managed' categories]
FMM -->|aggregates & sends to| DS[Data Sink<br/>Dynatrace, etc.]

classDef metricType fill:#e1f5fe,stroke:#01579b,stroke-width:2px
classDef accessType fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
classDef targetType fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
classDef dataType fill:#fff3e0,stroke:#e65100,stroke-width:2px

class FMM metricType
class FCA accessType
class CP,MC,MR targetType
class DS dataType
```

### Resource Type Descriptions:
## Resource Type Descriptions:

- **Metric**: Monitors specific Kubernetes resources in the local or remote clusters using GroupVersionKind targeting
- **ManagedMetric**: Specialized for monitoring Crossplane managed resources (resources with "crossplane" and "managed" categories)
- **FederatedMetric**: Monitors resources across multiple clusters, aggregating data from federated sources
- **FederatedManagedMetric**: Monitors Crossplane managed resources across multiple clusters
- **RemoteClusterAccess**: Provides access configuration for monitoring resources in remote clusters
- **FederatedClusterAccess**: Discovers and provides access to multiple clusters for federated monitoring
- [**Metric**](config/crd/bases/metrics.cloud.sap_metrics.yaml): Monitors specific Kubernetes resources in the local or remote clusters using GroupVersionKind targeting
- [**ManagedMetric**](config/crd/bases/metrics.cloud.sap_managedmetrics.yaml): Specialized for monitoring Crossplane managed resources (resources with "crossplane" and "managed" categories)
- [**FederatedMetric**](config/crd/bases/metrics.cloud.sap_federatedmetrics.yaml): Monitors resources across multiple clusters, aggregating data from federated sources
- [**FederatedManagedMetric**](config/crd/bases/metrics.cloud.sap_federatedmanagedmetrics.yaml): Monitors Crossplane managed resources across multiple clusters
- [**RemoteClusterAccess**](config/crd/bases/metrics.cloud.sap_remoteclusteraccesses.yaml): Provides access configuration for monitoring resources in remote clusters
- [**FederatedClusterAccess**](config/crd/bases/metrics.cloud.sap_federatedclusteraccesses.yaml): Discovers and provides access to multiple clusters for federated monitoring
- [**DataSink**](config/crd/bases/metrics.cloud.sap_datasinks.yaml): Defines where and how metrics data should be sent, supporting various destinations like Dynatrace

## Installation

Expand All @@ -132,7 +164,7 @@ graph LR
Deploy the Metrics Operator using the Helm chart:

```bash
helm upgrade --install metrics-operator ghcr.io/sap/github.com/sap/metrics-operator/charts/metrics-operator \
helm upgrade --install metrics-operator oci://ghcr.io/sap/github.com/sap/metrics-operator/charts/metrics-operator \
--namespace <operator-namespace> \
--create-namespace \
--version=<version>
Expand All @@ -142,6 +174,30 @@ Replace `<operator-namespace>` and `<version>` with appropriate values.

After deployment, create your DataSink configuration as described in the [DataSink Configuration](#datasink-configuration) section.

## Getting Started
You’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster.
**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).

### Quickstart

1. Clone the repository and install prerequisites (Go, Docker, kind, kubectl).
2. Configure your data sink by copying the configuration in [`examples/datasink/basic-datasink.yaml`](examples/datasink/basic-datasink.yaml) and modifying it to suit your environment.
- For example, if using Dynatrace, create a Kubernetes Secret with your API token and update the DataSink resource accordingly.
- The file should be placed and named like this: `examples/datasink/dynatrace-prod-setup.yaml`. (automatically excluded in [.gitignore](.gitignore))
3. Run `make dev-local-all` to set up a local development environment.
4. Run `make run` to start the Metrics Operator locally.
5. Check your data sink for incoming metrics.

### Common Development Tasks
This project uses a Makefile to streamline development tasks. Common targets include:

- `make dev-local-all` – Set up a local kind cluster with all CRDs, Crossplane, and sample resources.
- `make run` – Run the operator locally for development.
- `make dev-clean` – Delete the local kind cluster.
- `make test` – Run all Go tests.
- `make lint` – Run golangci-lint on the codebase.
- `make manifests generate` – Regenerate CRDs and deepcopy code after API changes.

## Usage

### Metric
Expand All @@ -154,9 +210,9 @@ The projections are then translated to dimensions in the metric.
apiVersion: metrics.cloud.sap/v1alpha1
kind: Metric
metadata:
name: comp-pod
name: metric-pod-count
spec:
name: comp-metric-pods
name: metric-pod-count
description: Pods
target:
kind: Pod
Expand Down Expand Up @@ -416,7 +472,7 @@ The detailed guide covers:

### Migration from Legacy Configuration

**Important**: The old method of using hardcoded secret names (such as `co-dynatrace-credentials`) has been deprecated and removed. You must now use DataSink resources to configure your metrics destinations.
**Important**: The old method of using hardcoded secret names (such as `dynatrace-credentials`) has been deprecated and removed. You must now use DataSink resources to configure your metrics destinations.

To migrate:
1. Create a DataSink resource pointing to your existing authentication secret
Expand All @@ -437,37 +493,6 @@ To make the most of your metrics:
For specific instructions on using your data sink's features, refer to its documentation. For example, if using Dynatrace, consult the Dynatrace documentation for information on creating custom charts, setting up alerts, and performing advanced analytics on your metric data.


## Getting Started
You’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster.
**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).

### Running on the cluster
1. Install Instances of Custom Resources:

```sh
make dev-local-all
```

2. Run the controller:

```sh
make dev-run
```
Or run it from your IDE.

### Delete Kind Cluster
Delete Kind cluster
```sh
make dev-clean
```

### Modifying the API definitions
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:

```sh
make manifests generate
```

## Support, Feedback, Contributing

This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/SAP/metrics-operator/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md).
Expand Down
4 changes: 2 additions & 2 deletions charts/metrics-operator/values.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Default values for co-metrics-operator.
# Default values for metrics-operator.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: deploy-releases-hyperspace-docker.common.cdn.repositories.cloud.sap/cloud-orchestration/co-metrics-operator
repository: ghcr.io/sap/github.com/sap/metrics-operator/images/metrics-operator
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: v0.5.2-dev
Expand Down
4 changes: 2 additions & 2 deletions charts/metrics-operator/values.yaml.tpl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Default values for co-metrics-operator.
# Default values for metrics-operator.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: deploy-releases-hyperspace-docker.common.cdn.repositories.cloud.sap/cloud-orchestration/co-metrics-operator
repository: ghcr.io/sap/github.com/sap/metrics-operator/images/metrics-operator
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: $OPERATOR_VERSION
Expand Down
Loading
Loading