Skip to content

Commit b0f1f7b

Browse files
authored
Update readme (#20)
* update readme * add diagrams
1 parent 3cc44c3 commit b0f1f7b

File tree

1 file changed

+135
-19
lines changed

1 file changed

+135
-19
lines changed

README.md

Lines changed: 135 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The Metrics Operator is a powerful tool designed to monitor and provide insights
77
## Table of Contents
88

99
- [Key Features](#key-features)
10+
- [Architecture Overview](#architecture-overview)
1011
- [Installation](#installation)
1112
- [Usage](#usage)
1213
- [RBAC Configuration](#rbac-configuration)
@@ -23,6 +24,101 @@ The Metrics Operator is a powerful tool designed to monitor and provide insights
2324
- **Strategic Decision Support**: Offers data-backed insights to guide product evolution.
2425
- **Customizable Alerting System**: Allows defining alerts based on specific metric thresholds, enabling proactive response to potential issues or significant changes in system state.
2526

27+
## Architecture Overview
28+
29+
The Metrics Operator provides four main resource types for monitoring Kubernetes objects. Each type serves different use cases:
30+
31+
### Metric Resource Flow
32+
33+
```mermaid
34+
graph LR
35+
M[Metric] -->|targets via GroupVersionKind| K8S[Kubernetes Objects<br/>Pods, Services, etc.]
36+
M -.->|optional| RCA[RemoteClusterAccess]
37+
RCA -->|accesses remote cluster| K8S
38+
M -->|sends data to| DS[Data Sink<br/>Dynatrace, etc.]
39+
40+
classDef metricType fill:#e1f5fe,stroke:#01579b,stroke-width:2px
41+
classDef accessType fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
42+
classDef targetType fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
43+
classDef dataType fill:#fff3e0,stroke:#e65100,stroke-width:2px
44+
45+
class M metricType
46+
class RCA accessType
47+
class K8S targetType
48+
class DS dataType
49+
```
50+
51+
### ManagedMetric Resource Flow
52+
53+
```mermaid
54+
graph LR
55+
MM[ManagedMetric] -->|targets managed resources| MR[Managed Resources<br/>with 'crossplane' & 'managed' categories]
56+
MM -.->|optional| RCA[RemoteClusterAccess]
57+
RCA -->|accesses remote cluster| MR
58+
MM -->|sends data to| DS[Data Sink<br/>Dynatrace, etc.]
59+
60+
classDef metricType fill:#e1f5fe,stroke:#01579b,stroke-width:2px
61+
classDef accessType fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
62+
classDef targetType fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
63+
classDef dataType fill:#fff3e0,stroke:#e65100,stroke-width:2px
64+
65+
class MM metricType
66+
class RCA accessType
67+
class MR targetType
68+
class DS dataType
69+
```
70+
71+
### FederatedMetric Resource Flow
72+
73+
```mermaid
74+
graph LR
75+
FM[FederatedMetric] -->|requires| FCA[FederatedClusterAccess]
76+
FCA -->|discovers clusters via| CP[ControlPlane Resources]
77+
FCA -->|provides access to| MC[Multiple Clusters]
78+
FM -->|targets across clusters| K8S[Kubernetes Objects<br/>across federated clusters]
79+
FM -->|aggregates & sends to| DS[Data Sink<br/>Dynatrace, etc.]
80+
81+
classDef metricType fill:#e1f5fe,stroke:#01579b,stroke-width:2px
82+
classDef accessType fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
83+
classDef targetType fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
84+
classDef dataType fill:#fff3e0,stroke:#e65100,stroke-width:2px
85+
86+
class FM metricType
87+
class FCA accessType
88+
class CP,MC,K8S targetType
89+
class DS dataType
90+
```
91+
92+
### FederatedManagedMetric Resource Flow
93+
94+
```mermaid
95+
graph LR
96+
FMM[FederatedManagedMetric] -->|requires| FCA[FederatedClusterAccess]
97+
FCA -->|discovers clusters via| CP[ControlPlane Resources]
98+
FCA -->|provides access to| MC[Multiple Clusters]
99+
FMM -->|targets managed resources<br/>across clusters| MR[Managed Resources<br/>with 'crossplane' & 'managed' categories]
100+
FMM -->|aggregates & sends to| DS[Data Sink<br/>Dynatrace, etc.]
101+
102+
classDef metricType fill:#e1f5fe,stroke:#01579b,stroke-width:2px
103+
classDef accessType fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
104+
classDef targetType fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
105+
classDef dataType fill:#fff3e0,stroke:#e65100,stroke-width:2px
106+
107+
class FMM metricType
108+
class FCA accessType
109+
class CP,MC,MR targetType
110+
class DS dataType
111+
```
112+
113+
### Resource Type Descriptions:
114+
115+
- **Metric**: Monitors specific Kubernetes resources in the local or remote clusters using GroupVersionKind targeting
116+
- **ManagedMetric**: Specialized for monitoring Crossplane managed resources (resources with "crossplane" and "managed" categories)
117+
- **FederatedMetric**: Monitors resources across multiple clusters, aggregating data from federated sources
118+
- **FederatedManagedMetric**: Monitors Crossplane managed resources across multiple clusters
119+
- **RemoteClusterAccess**: Provides access configuration for monitoring resources in remote clusters
120+
- **FederatedClusterAccess**: Discovers and provides access to multiple clusters for federated monitoring
121+
26122
## Installation
27123

28124
### Prerequisites
@@ -54,44 +150,63 @@ This can be useful for tracking additional dimensions of the resource, such as f
54150
The projections are then translated to dimensions in the metric.
55151

56152
```yaml
57-
apiVersion: metrics.cloud.sap/v1alpha
153+
apiVersion: metrics.cloud.sap/v1alpha1
58154
kind: Metric
59155
metadata:
60156
name: comp-pod
61157
spec:
62158
name: comp-metric-pods
63159
description: Pods
64160
target:
65-
resource: pods
161+
kind: Pod
66162
group: ""
67163
version: v1
68-
frequency: 1 # in minutes
164+
interval: "1m"
69165
projections:
70166
- name: pod-namespace
71167
fieldPath: "metadata.namespace"
72168
---
73169
```
74170

171+
### Managed Metric
172+
173+
Managed metrics are used to monitor crossplane managed resources. They automatically track resources that have the "crossplane" and "managed" categories in their CRDs.
174+
175+
```yaml
176+
apiVersion: metrics.cloud.sap/v1alpha1
177+
kind: ManagedMetric
178+
metadata:
179+
name: managed-metric
180+
spec:
181+
name: managed-metric
182+
description: Status metric created by an Operator
183+
kind: Release
184+
group: helm.crossplane.io
185+
version: v1beta1
186+
interval: "1m"
187+
---
188+
```
189+
75190
### Federated Metric
76191
Federated metrics deal with resources that are spread across multiple clusters. To monitor these resources, you need to define a `FederatedMetric` resource.
77192
They offer capabilities to aggregate data as well as filtering down to a specific cluster or field using projections.
78193
```yaml
79-
apiVersion: metrics.cloud.sap/v1beta1
194+
apiVersion: metrics.cloud.sap/v1alpha1
80195
kind: FederatedMetric
81196
metadata:
82197
name: xfed-prov
83198
spec:
84199
name: xfed-prov
85200
description: crossplane providers
86201
target:
87-
group: pkg.crossplane.io
88-
resource: providers
202+
kind: Provider
203+
group: pkg.crossplane.io
89204
version: v1
90-
frequency: 1 # in minutes
205+
interval: "1m"
91206
projections:
92207
- name: package
93208
fieldPath: "spec.package"
94-
federateCaRef:
209+
federateClusterAccessRef:
95210
name: federate-ca-sample
96211
namespace: default
97212
---
@@ -104,15 +219,15 @@ The pre-condition here is that if a resource comes from a crossplane provider, i
104219

105220

106221
```yaml
107-
apiVersion: metrics.cloud.sap/v1beta1
222+
apiVersion: metrics.cloud.sap/v1alpha1
108223
kind: FederatedManagedMetric
109224
metadata:
110225
name: xfed-managed
111226
spec:
112227
name: xfed-managed
113228
description: crossplane managed resources
114-
frequency: 1 # in minutes
115-
federateCaRef:
229+
interval: "1m"
230+
federateClusterAccessRef:
116231
name: federate-ca-sample
117232
namespace: default
118233
---
@@ -121,14 +236,15 @@ spec:
121236
## Remote Cluster Access
122237

123238

124-
### Cluster Access
125-
The Metrics Operator can monitor both the cluster it's deployed in and remote clusters. To monitor a remote cluster, define a `ClusterAccess` resource:
239+
### Remote Cluster Access
240+
241+
The Metrics Operator can monitor both the cluster it's deployed in and remote clusters. To monitor a remote cluster, define a `RemoteClusterAccess` resource:
126242

127-
This cluster access resource can be used by `CompoundMetric` resources to monitor resources in the remote cluster.
243+
This remote cluster access resource can be used by `Metric` and `ManagedMetric` resources to monitor resources in the remote cluster.
128244

129245
```yaml
130-
apiVersion: metrics.cloud.sap/v1beta1
131-
kind: ClusterAccess
246+
apiVersion: metrics.cloud.sap/v1alpha1
247+
kind: RemoteClusterAccess
132248
metadata:
133249
name: remote-cluster
134250
namespace: <monitoring-namespace>
@@ -147,17 +263,17 @@ spec:
147263
To monitor resources across multiple clusters, define a `FederatedClusterAccess` resource:
148264

149265
```yaml
150-
apiVersion: metrics.cloud.sap/v1beta1
266+
apiVersion: metrics.cloud.sap/v1alpha1
151267
kind: FederatedClusterAccess
152268
metadata:
153269
name: federate-ca-sample
154270
namespace: default
155271
spec:
156272
target:
273+
kind: ControlPlane
157274
group: core.orchestrate.cloud.sap
158-
resource: controlplanes #plural always, lowecase only
159275
version: v1beta1
160-
kubeConfigPath: spec.target.kubeconfig #case sensitive
276+
kubeConfigPath: spec.target.kubeconfig
161277
```
162278

163279

0 commit comments

Comments
 (0)