Skip to content

Commit b9515a4

Browse files
scotwellsclaude
andcommitted
refactor(observability): remove duplicated shared files; give each component its own namespace
Problem 1: the composable split had copy-pasted namespace.yaml, helm-repositories.yaml, and datasources/ into each component subdirectory while leaving the originals at the root. That duplicated ~200 lines and caused the root kustomize build to fail on conflicting resources. - Deleted the root-level namespace.yaml, helm-repositories.yaml, and datasources/ directory. - Kept a single copy of the datasources under grafana/datasources/ (where the Grafana instance lives). - Pared each component's helm-repositories.yaml to just the repo that component actually consumes. Gave loki/tempo distinct HelmRepository names (loki-charts, tempo-charts) so the composed root kustomize build does not fail on duplicate source.toolkit.fluxcd.io resources. - Root components/observability/kustomization.yaml now references the six component subdirectories only. - Dropped prometheus-crds/namespace.yaml entirely — the kustomization only installs cluster-scoped CRDs so no namespace is needed. Problem 2: everything still deployed to telemetry-system, which defeats the point of per-component composition. Each component now has its own namespace so kubectl delete ns <x> cleanly uninstalls it: - victoria-metrics-system (was telemetry-system) - grafana-system - loki-system - tempo-system - otel-collector-system Cross-component references are now fully qualified service DNS names: - Grafana datasources point at vmsingle/vmalertmanager in victoria-metrics-system, loki-system-loki in loki-system, and tempo-system-tempo in tempo-system. - The OTel Collector's otlp, loki, and prometheusremotewrite exporters point at the new FQDNs. - VMAlert's datasource, notifier, and remoteWrite URLs use the new victoria-metrics-system service names. - VM defaultDashboards.grafanaOperator.allowCrossNamespaceImport is now true so dashboards created in victoria-metrics-system can target the Grafana CR in grafana-system. Taskfile's per-component waits updated to reference the new namespaces (vmagent/vmsingle in victoria-metrics-system, otel-collector-collector DaemonSet in otel-collector-system). README refreshed to document the subcomponent layout, namespaces, and removal procedure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a3f944a commit b9515a4

32 files changed

Lines changed: 81 additions & 273 deletions

Taskfile.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,8 @@ tasks:
450450
- echo "⏳ Waiting for Victoria Metrics Stack HelmRelease …"
451451
- kubectl -n flux-system wait helmrelease/vm --for=condition=Ready --timeout={{.WAIT_TIMEOUT}}
452452
- echo "⏳ Waiting for vmagent & vmsingle to be Ready …"
453-
- kubectl wait --for=condition=Available deploy -l app.kubernetes.io/name=vmagent -n telemetry-system --timeout={{.WAIT_TIMEOUT}} || true
454-
- kubectl wait --for=condition=Available deploy -l app.kubernetes.io/name=vmsingle -n telemetry-system --timeout={{.WAIT_TIMEOUT}} || true
453+
- kubectl wait --for=condition=Available deploy -l app.kubernetes.io/name=vmagent -n victoria-metrics-system --timeout={{.WAIT_TIMEOUT}} || true
454+
- kubectl wait --for=condition=Available deploy -l app.kubernetes.io/name=vmsingle -n victoria-metrics-system --timeout={{.WAIT_TIMEOUT}} || true
455455
- echo "✅ Victoria Metrics is ready"
456456

457457
install-otel-collector:
@@ -480,7 +480,7 @@ tasks:
480480
sleep 10
481481
done
482482
- echo "⏳ Waiting for OTel Collector DaemonSet …"
483-
- kubectl -n telemetry-system rollout status daemonset/otel-collector-collector --timeout={{.WAIT_TIMEOUT}}
483+
- kubectl -n otel-collector-system rollout status daemonset/otel-collector-collector --timeout={{.WAIT_TIMEOUT}}
484484
- echo "✅ OpenTelemetry Collector is ready"
485485

486486
install-grafana:

components/observability/README.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,61 @@ Optional observability stack for test infrastructure, providing metrics, logs, a
44

55
## Overview
66

7-
This component is an **optional add-on** deployed after core infrastructure. It provides comprehensive telemetry capabilities using Grafana, Victoria Metrics, Loki, and Tempo.
7+
This component is an **optional add-on** deployed after core infrastructure. It provides comprehensive telemetry capabilities using Grafana, Victoria Metrics, Loki, Tempo, and the OpenTelemetry Collector.
88

9-
## Components
9+
The stack is split into composable subcomponents — each deploys into its own namespace so it can be installed, upgraded, or removed independently (`kubectl delete ns <component>-system` cleanly uninstalls).
1010

11-
- **Grafana**: Visualization and dashboards
12-
- **Victoria Metrics**: Metrics collection and storage
13-
- **Loki**: Log aggregation and storage
14-
- **Tempo**: Distributed tracing storage
15-
- **Promtail**: Log collection agent
11+
## Subcomponents
12+
13+
| Component | Namespace | Purpose |
14+
| ----------------- | ------------------------- | ------------------------------------- |
15+
| `prometheus-crds` | (cluster-scoped) | Prometheus Operator CRDs |
16+
| `victoria-metrics`| `victoria-metrics-system` | Metrics collection and storage |
17+
| `otel-collector` | `otel-collector-system` | OpenTelemetry DaemonSet collector |
18+
| `loki` | `loki-system` | Log aggregation and storage |
19+
| `tempo` | `tempo-system` | Distributed tracing storage |
20+
| `grafana` | `grafana-system` | Visualization, dashboards, datasources|
1621

1722
## Access
1823

1924
- **Grafana UI**: Available at NodePort 30000 (admin/datum123)
20-
- **Default Datasources**: Victoria Metrics (metrics), Loki (logs), Tempo (traces)
25+
- **Default Datasources**: Victoria Metrics (metrics), Loki (logs), Tempo (traces), Alertmanager
2126

2227
## Prerequisites
2328

2429
Core test infrastructure must be running before deploying observability components.
2530

2631
## Deployment
2732

28-
Deploy using the `install-observability` task target:
33+
Deploy the whole stack:
2934

3035
```bash
3136
task install-observability
3237
```
3338

34-
This deploys all components and configures datasources automatically.
39+
Or install components individually:
40+
41+
```bash
42+
task install-prometheus-crds
43+
task install-victoria-metrics
44+
task install-otel-collector
45+
task install-loki
46+
task install-tempo
47+
task install-grafana
48+
```
3549

3650
## Removal
3751

38-
To remove the observability stack:
52+
To remove an individual component:
53+
54+
```bash
55+
kubectl delete namespace <component>-system
56+
```
57+
58+
To remove the whole stack:
3959

4060
```bash
41-
kubectl delete namespace observability
61+
for ns in grafana-system tempo-system loki-system otel-collector-system victoria-metrics-system; do
62+
kubectl delete namespace "$ns"
63+
done
4264
```

components/observability/datasources/alertmanager-datasource.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

components/observability/datasources/kustomization.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

components/observability/datasources/loki-datasource.yaml

Lines changed: 0 additions & 26 deletions
This file was deleted.

components/observability/datasources/tempo-datasource.yaml

Lines changed: 0 additions & 54 deletions
This file was deleted.

components/observability/datasources/vm-datasource.yaml

Lines changed: 0 additions & 21 deletions
This file was deleted.

components/observability/grafana/datasources/alertmanager-datasource.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: grafana.integreatly.org/v1beta1
22
kind: GrafanaDatasource
33
metadata:
44
name: alertmanager
5-
namespace: telemetry-system
5+
namespace: grafana-system
66
spec:
77
instanceSelector:
88
matchLabels:
@@ -11,7 +11,7 @@ spec:
1111
name: Alertmanager
1212
type: alertmanager
1313
access: proxy
14-
url: http://vmalertmanager-telemetry-system-vm.telemetry-system.svc.cluster.local:9093
14+
url: http://vmalertmanager-victoria-metrics-system-vm.victoria-metrics-system.svc.cluster.local:9093
1515
isDefault: true
1616
editable: true
1717
jsonData:

components/observability/grafana/datasources/loki-datasource.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: grafana.integreatly.org/v1beta1
22
kind: GrafanaDatasource
33
metadata:
44
name: loki-datasource
5-
namespace: telemetry-system
5+
namespace: grafana-system
66
labels:
77
dashboards: "grafana"
88
spec:
@@ -13,7 +13,7 @@ spec:
1313
name: Loki
1414
type: loki
1515
access: proxy
16-
url: http://telemetry-system-loki.telemetry-system.svc.cluster.local:3100
16+
url: http://loki-system-loki.loki-system.svc.cluster.local:3100
1717
isDefault: false
1818
editable: true
1919
jsonData:

components/observability/grafana/datasources/tempo-datasource.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: grafana.integreatly.org/v1beta1
22
kind: GrafanaDatasource
33
metadata:
44
name: tempo-datasource
5-
namespace: telemetry-system
5+
namespace: grafana-system
66
labels:
77
dashboards: "grafana"
88
spec:
@@ -13,7 +13,7 @@ spec:
1313
name: Tempo
1414
type: tempo
1515
access: proxy
16-
url: http://telemetry-system-tempo.telemetry-system.svc.cluster.local:3100
16+
url: http://tempo-system-tempo.tempo-system.svc.cluster.local:3100
1717
uid: tempo-datasource
1818
isDefault: false
1919
editable: true

0 commit comments

Comments
 (0)