Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes; the format follows [Keep a Changelog](https://keepachangelo

## [Unreleased]

## [0.1.5] - 2026-11-23

### Added
- `components.logging` (opt-in, external only), the same shape as `components.tracing`: `enabled` +
`external.queryUrl` (and `external.endpoint`, the push API your collector uses, for reference) give
platform-monitoring's Grafana a Loki datasource (uid `loki`, provisioning file `loki.yaml`). No Application, no
Loki or collector of its own; without the key the render is exactly as before (tracing included). `check` refuses
`enabled` without `external.queryUrl`. A patch release on top of 0.1.4 (no 0.2.0 changes).

## [0.1.4] - 2026-11-23

### Added
Expand Down
26 changes: 14 additions & 12 deletions bin/slo-platform
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ LABEL_VALUE = r"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$"
# platform components (components.<name>): Helm-sourced ones take values, kustomize-sourced ones do not
HELM_COMPONENTS = ("monitoring", "blackbox", "chaos-mesh", "experiments")
KUSTOMIZE_COMPONENTS = ("pyrra", "cert-manager", "argo-rollouts", "cnpg", "kyverno", "policies", "object-storage")
# components.tracing: an external Tempo (opt-in); only Grafana's datasource, no Application
# components.tracing / components.logging: an external Tempo / Loki (opt-in); only Grafana's datasource, no Application
HTTP_URL = r"^https?://[^\s/]+(/\S*)?$"
TRACING_SCHEMA = {"type": "object", "additionalProperties": False, "properties": {
"enabled": {"type": "boolean"},
Expand Down Expand Up @@ -106,7 +106,7 @@ SCHEMA = {
"properties": {"enabled": {"type": "boolean"}, "values": {"type": "object"}}} for c in HELM_COMPONENTS},
**{c: {"type": "object", "additionalProperties": False,
"properties": {"enabled": {"type": "boolean"}}} for c in KUSTOMIZE_COMPONENTS},
"tracing": TRACING_SCHEMA}},
"tracing": TRACING_SCHEMA, "logging": TRACING_SCHEMA}},
"grafana": {"type": "object", "additionalProperties": False,
"properties": {"adminSecret": {"type": "string", "pattern": NAME}}},
"regression": {"type": "object", "additionalProperties": False, "properties": {
Expand Down Expand Up @@ -289,18 +289,20 @@ def check_platform(p, problems, product=None):
names = [x.get("name") for x in extras or [] if isinstance(x, dict)]
for n in sorted({n for n in names if names.count(n) > 1}):
problems.append(f"platform.yaml: .clusters.{name}.extras: {n} twice (the Application is extras-<name>)")
# components.tracing (top-level, then each cluster's over it): enabled needs an external Tempo's query URL
# components.tracing / logging (top-level, then each cluster's over it): enabled needs the external query URL
comps = p.get("components") if isinstance(p.get("components"), dict) else {}
clusters = p.get("clusters") if isinstance(p.get("clusters"), dict) else {}
for name in clusters or [None]:
cc = (clusters.get(name) or {}) if name else {}
cc = (cc.get("components") or {}) if isinstance(cc, dict) else {}
t = deep_merge(comps.get("tracing") if isinstance(comps.get("tracing"), dict) else {},
cc.get("tracing") if isinstance(cc, dict) and isinstance(cc.get("tracing"), dict) else {})
if t.get("enabled") is True and not (t.get("external") or {}).get("queryUrl"):
where = f" on cluster {name}" if name else ""
problems.append(f"platform.yaml: .components.tracing: enabled{where} needs external.queryUrl (an external "
"Tempo's HTTP API, e.g. http://tempo.example:3200): this release installs no Tempo of its own")
for comp, product, example in (("tracing", "Tempo", "http://tempo.example:3200"),
("logging", "Loki", "http://loki.example:3100")):
for name in clusters or [None]:
cc = (clusters.get(name) or {}) if name else {}
cc = (cc.get("components") or {}) if isinstance(cc, dict) else {}
t = deep_merge(comps.get(comp) if isinstance(comps.get(comp), dict) else {},
cc.get(comp) if isinstance(cc, dict) and isinstance(cc.get(comp), dict) else {})
if t.get("enabled") is True and not (t.get("external") or {}).get("queryUrl"):
where = f" on cluster {name}" if name else ""
problems.append(f"platform.yaml: .components.{comp}: enabled{where} needs external.queryUrl (an external "
f"{product}'s HTTP API, e.g. {example}): this release installs no {product} of its own")
tz = p.get("timezone")
if isinstance(tz, str) and not any(e.startswith(".timezone") for e in errs):
try:
Expand Down
11 changes: 11 additions & 0 deletions bin/test_slo_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,17 @@ def test_tracing(self):
self.edit(self.p, lambda p: p.update(components={"tracing": {"values": {"x": 1}}}))
self.assertProblem(".components.tracing.values: unknown key")

def test_logging(self):
ext = {"queryUrl": "http://loki.example:3100", "endpoint": "http://loki.example:3100/loki/api/v1/push"}
self.edit(self.p, lambda p: p.update(components={"logging": {"enabled": True, "external": ext},
"tracing": {"enabled": True, "external": {"queryUrl": "http://t:3200"}}}))
for real in (False, True):
self.assertEqual(self.problems(real), [])
self.edit(self.p, lambda p: p.update(components={"logging": {"enabled": True}}))
self.assertProblem(".components.logging: enabled on cluster lab needs external.queryUrl (an external Loki's")
self.edit(self.p, lambda p: p.update(components={"logging": {"enabled": True, "external": {"queryUrl": "loki"}}}))
self.assertProblem(".components.logging.external.queryUrl")

def test_namespace_metadata(self):
self.edit(self.p, lambda p: p.update(applications={"namespaceLabels": {"example.com/policies": "enforced"},
"namespaceAnnotations": {"example.com/note": "any text"}}))
Expand Down
21 changes: 21 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ once per cluster with `cluster: <name>` added. An annotated example: [platform.e
| `components.tracing.enabled` | `false` | Opt-in: Grafana gets a Tempo datasource for `components.tracing.external` ([Tracing](#tracing)) |
| `components.tracing.external.queryUrl` | — | An external Tempo's HTTP API as Grafana reaches it (`http://tempo.example:3200`); required when enabled |
| `components.tracing.external.endpoint` | — | Its OTLP/HTTP receiver (`http://tempo.example:4318`): recorded for people and tools, not passed into applications |
| `components.logging.enabled` | `false` | Opt-in: Grafana gets a Loki datasource for `components.logging.external` ([Logs](#logs)) |
| `components.logging.external.queryUrl` | — | An external Loki's HTTP API as Grafana reaches it (`http://loki.example:3100`); required when enabled |
| `components.logging.external.endpoint` | — | Its push API (`http://loki.example:3100/loki/api/v1/push`): recorded for your log collector, the platform installs none |
| `grafana.adminSecret` | `grafana-admin` | Secret in `monitoring` with keys `admin-user`, `admin-password`; bootstrap creates it |
| `regression.schedule` | `0 9 * * *` | Cron schedule of the daily experiment regression on lab clusters, in `timezone` |
| `regression.experiments` | `<instance.apps>/*/experiments` | Experiment directories (a glob or a list of globs, relative to the instance root): the daily regression runs their `*.yaml`, `check` checks them |
Expand Down Expand Up @@ -236,6 +239,7 @@ The platform components the root chart installs, each an Argo CD Application `pl
| `kyverno`, `policies` | kustomize | with `optional.policies: true` |
| `object-storage` | kustomize | clusters with `objectStorage: in-cluster` |
| `tracing` | none: a Grafana datasource for an external Tempo | only with `enabled: true` (opt-in): [Tracing](#tracing) |
| `logging` | none: a Grafana datasource for an external Loki | only with `enabled: true` (opt-in): [Logs](#logs) |

- `enabled: false` drops the component (its Application; Argo CD prunes what it installed). `enabled: true` is the
default and does not override the condition in the last column. What depends on a dropped component is yours to
Expand Down Expand Up @@ -296,6 +300,23 @@ clusters:
- `check` refuses `enabled: true` without `external.queryUrl` (top level or on a cluster), and URLs that are not
`http(s)://`.

### Logs

`logging` works like [Tracing](#tracing), for Grafana Loki: opt-in, external only — the cluster's Grafana gets a Loki
datasource (name `Loki`, uid `loki`, provisioning file `loki.yaml` next to `tempo.yaml`). The platform installs no
Loki and no collector: ship the logs with your own (e.g. Grafana Alloy through [extras](#extras)) to
`external.endpoint`, and give it a bounded queue so that an unreachable Loki costs log lines, never the workloads.

```yaml
components:
logging:
external:
queryUrl: http://loki.example:3100 # the datasource's URL (required when enabled)
endpoint: http://loki.example:3100/loki/api/v1/push # where your collector pushes
clusters:
prod: { role: prod, components: { logging: { enabled: true } } }
```

## An existing repository

A GitOps repository that already holds applications (one directory per application with an `app.yaml`, experiments,
Expand Down
3 changes: 3 additions & 0 deletions platform.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ optional:
# tracing: # opt-in: a Grafana datasource for an external Tempo (docs/configuration.md#tracing)
# enabled: true
# external: { queryUrl: "http://tempo.example:3200", endpoint: "http://tempo.example:4318" }
# logging: # opt-in: a Grafana datasource for an external Loki (docs/configuration.md#logs)
# enabled: true
# external: { queryUrl: "http://loki.example:3100" }

grafana:
adminSecret: grafana-admin # Secret in monitoring with admin-user, admin-password (created by bootstrap)
Expand Down
16 changes: 9 additions & 7 deletions platform/root/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ clusters.<cluster>.components.<name> deep-merged over it (clusters differ: a sma
{{- dict "enabled" (ne (toString (dig "enabled" true $c)) "false") "values" (dig "values" dict $c) | toJson }}
{{- end }}

{{- /* root.tracing: components.tracing with clusters.<cluster>.components.tracing deep-merged over it, as JSON
{enabled, external}: opt-in (enabled defaults to false); enabled needs external.queryUrl, an external Tempo (this
release installs no Tempo of its own). Only platform-monitoring's Grafana uses it (a Tempo datasource). */}}
{{- define "root.tracing" -}}
{{- $top := index (.Values.components | default dict) "tracing" | default dict }}
{{- $cl := index ((index (.Values.clusters | default dict) (.Values.cluster | default "") | default dict).components | default dict) "tracing" | default dict }}
{{- /* root.external: an opt-in component that points Grafana at a service outside the cluster ((list . "<name>"
"<product>" "<example URL>"): tracing → Tempo, logging → Loki): components.<name> with clusters.<cluster>.components.<name>
deep-merged over it, as JSON {enabled, external}. enabled defaults to false and needs external.queryUrl (this release
installs neither of its own). Only platform-monitoring's Grafana uses them (a datasource each). */}}
{{- define "root.external" -}}
{{- $root := index . 0 }}{{ $name := index . 1 }}{{ $product := index . 2 }}{{ $example := index . 3 }}
{{- $top := index ($root.Values.components | default dict) $name | default dict }}
{{- $cl := index ((index ($root.Values.clusters | default dict) ($root.Values.cluster | default "") | default dict).components | default dict) $name | default dict }}
{{- $c := include "root.deepMerge" (dict "base" $top "over" $cl) | fromJson }}
{{- $on := eq (toString (dig "enabled" false $c)) "true" }}
{{- $ext := dig "external" dict $c }}
{{- if and $on (not (dig "queryUrl" "" $ext)) }}{{ fail "components.tracing: enabled needs external.queryUrl (an external Tempo's HTTP API, e.g. http://tempo.example:3200): this release installs no Tempo of its own" }}{{ end }}
{{- if and $on (not (dig "queryUrl" "" $ext)) }}{{ fail (printf "components.%s: enabled needs external.queryUrl (an external %s's HTTP API, e.g. %s): this release installs no %s of its own" $name $product $example $product) }}{{ end }}
{{- dict "enabled" $on "external" $ext | toJson }}
{{- end }}

Expand Down
19 changes: 14 additions & 5 deletions platform/root/templates/platform-monitoring.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,25 @@ grafana:
sidecar:
dashboards: { enabled: true, label: grafana_dashboard, searchNamespace: ALL }
resources: { requests: { cpu: 50m, memory: 192Mi }, limits: { memory: 512Mi } }
{{- $tracing := include "root.tracing" . | fromJson }}
{{- if $tracing.enabled }}
# components.tracing: the external Tempo as a datasource (uid tempo). A provisioning file of its own (a key of the
# datasources map), not an entry of additionalDataSources: your own additionalDataSources (a list: it replaces)
# leave it in place.
{{- $tracing := include "root.external" (list . "tracing" "Tempo" "http://tempo.example:3200") | fromJson }}
{{- $logging := include "root.external" (list . "logging" "Loki" "http://loki.example:3100") | fromJson }}
{{- if or $tracing.enabled $logging.enabled }}
# components.tracing / components.logging: the external Tempo / Loki as datasources (uid tempo / loki). Provisioning
# files of their own (keys of the datasources map), not entries of additionalDataSources: your own
# additionalDataSources (a list: it replaces) leave them in place.
datasources:
{{- if $tracing.enabled }}
tempo.yaml:
apiVersion: 1
datasources:
- { name: Tempo, uid: tempo, type: tempo, access: proxy, url: {{ $tracing.external.queryUrl | quote }} }
{{- end }}
{{- if $logging.enabled }}
loki.yaml:
apiVersion: 1
datasources:
- { name: Loki, uid: loki, type: loki, access: proxy, url: {{ $logging.external.queryUrl | quote }} }
{{- end }}
{{- end }}
# Grafana needs more than the default 60s to start on a small node: the liveness probe killed it in a loop
# (exit 137)
Expand Down
64 changes: 64 additions & 0 deletions platform/root/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,38 @@
}
},
"description": "Distributed tracing with an external Grafana Tempo: opt-in (enabled: false by default); needs external.queryUrl. No Application: only platform-monitoring's Grafana changes."
},
"logging": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean",
"default": false,
"description": "true: Grafana gets a Loki datasource for `external` (off by default)."
},
"external": {
"type": "object",
"additionalProperties": false,
"required": [
"queryUrl"
],
"properties": {
"queryUrl": {
"type": "string",
"pattern": "^https?://[^\\s/]+(/\\S*)?$",
"description": "Loki's HTTP API as Grafana reaches it, e.g. http://loki.example:3100: the Loki datasource's URL."
},
"endpoint": {
"type": "string",
"pattern": "^https?://[^\\s/]+(/\\S*)?$",
"description": "Loki's push API, e.g. http://loki.example:3100/loki/api/v1/push: what log collectors send to. Recorded here for people and tools; the platform installs no collector."
}
},
"description": "A Loki outside the cluster (this release has no in-cluster Loki)."
}
},
"description": "Logs in an external Grafana Loki: opt-in (enabled: false by default); needs external.queryUrl. No Application: only platform-monitoring's Grafana changes."
}
}
}
Expand Down Expand Up @@ -1239,6 +1271,38 @@
}
},
"description": "Distributed tracing with an external Grafana Tempo: opt-in (enabled: false by default); needs external.queryUrl. No Application: only platform-monitoring's Grafana changes."
},
"logging": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean",
"default": false,
"description": "true: Grafana gets a Loki datasource for `external` (off by default)."
},
"external": {
"type": "object",
"additionalProperties": false,
"required": [
"queryUrl"
],
"properties": {
"queryUrl": {
"type": "string",
"pattern": "^https?://[^\\s/]+(/\\S*)?$",
"description": "Loki's HTTP API as Grafana reaches it, e.g. http://loki.example:3100: the Loki datasource's URL."
},
"endpoint": {
"type": "string",
"pattern": "^https?://[^\\s/]+(/\\S*)?$",
"description": "Loki's push API, e.g. http://loki.example:3100/loki/api/v1/push: what log collectors send to. Recorded here for people and tools; the platform installs no collector."
}
},
"description": "A Loki outside the cluster (this release has no in-cluster Loki)."
}
},
"description": "Logs in an external Grafana Loki: opt-in (enabled: false by default); needs external.queryUrl. No Application: only platform-monitoring's Grafana changes."
}
}
},
Expand Down
Loading
Loading