Skip to content

Commit c615cb7

Browse files
authored
docs: add PrometheusRule reference and exercise defaults schema in CI (#305)
* docs: add PrometheusRule reference to configuration.md, exercise defaults schema in CI - Add PrometheusRule alerts section to docs/reference/configuration.md documenting all 10 alert rules with their tunable parameters. Previously only documented in the Prometheus setup guide, not the field-by-field configuration reference. - Add cpu, memory, and costPricing sections to the Helm CI defaults-values.yaml so schema validation covers these nested objects during helm lint. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca> * docs: fix phantom staleRecommendations threshold, add defaults section - Remove incorrect threshold parameter from staleRecommendations alert rule documentation (the expr is hardcoded, no threshold param exists). - Add Cluster-wide Defaults (Helm-managed) section to configuration.md documenting the defaults.* Helm values that create an AttuneDefaults CR. - Clarify that AttuneDefaults can be created via Helm or manually. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca> --------- Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent 93d338d commit c615cb7

2 files changed

Lines changed: 74 additions & 3 deletions

File tree

charts/attune/ci/defaults-values.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
---
2-
# CI test: defaults enabled
2+
# CI test: defaults enabled with cpu/memory/costPricing/updateStrategy
33
defaults:
44
enabled: true
5+
cpu:
6+
percentile: 95
7+
overhead: "20"
8+
maxIncreasePercent: 80
9+
maxDecreasePercent: 20
10+
memory:
11+
percentile: 99
12+
overhead: "30"
13+
allowDecrease: false
14+
costPricing:
15+
cpuPerCoreHour: "0.031"
16+
memoryPerGiBHour: "0.004"
517
updateStrategy:
618
type: Recommend
719
cooldown: "1h"

docs/reference/configuration.md

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,44 @@ This page documents every value in the Helm chart's `values.yaml`.
7878
| `metrics.serviceMonitor.additionalLabels` | object | `{}` | Extra labels for the ServiceMonitor |
7979
| `metrics.serviceMonitor.interval` | string | `30s` | Scrape interval |
8080

81+
### PrometheusRule alerts
82+
83+
Create a `PrometheusRule` resource for out-of-the-box alerting. Requires the Prometheus Operator CRDs (`monitoring.coreos.com/v1`).
84+
85+
| Key | Type | Default | Description |
86+
|-----|------|---------|-------------|
87+
| `metrics.prometheusRule.enabled` | bool | `false` | Create a PrometheusRule with all alert rules below |
88+
| `metrics.prometheusRule.additionalLabels` | object | `{}` | Extra labels for the PrometheusRule resource |
89+
90+
Each alert rule supports `enabled`, `for`, and `severity`. Some rules have additional tuning parameters.
91+
92+
| Rule | Default severity | Default `for` | Extra parameters | Description |
93+
|------|-----------------|---------------|------------------|-------------|
94+
| `reconcileErrors` | warning | 10m | `threshold` (default `"0"`) | Fires when reconcile error rate exceeds threshold |
95+
| `prometheusUnreachable` | warning | 10m | | Fires when Prometheus queries fail |
96+
| `degraded` | critical | 5m | | Fires when workloads are in Degraded state |
97+
| `highRevertRate` | critical | 15m | `threshold` (default `"0.5"`) | Fires when revert rate exceeds 50% |
98+
| `reconcileStale` | warning | 5m | `staleDuration` (default `30m`) | Fires when no reconcile completes within the stale duration |
99+
| `budgetExhausted` | warning | 30m | | Fires when a policy's resize budget is exhausted |
100+
| `dataQuality` | warning | 30m | | Fires when NaN/Inf values are detected in Prometheus data |
101+
| `requestsClamped` | info | 1h | | Fires when recommended requests are clamped to limits |
102+
| `staleRecommendations` | warning | 1h | | Fires when recommendations are marked stale due to Prometheus data gaps |
103+
| `revertFailures` | critical | 5m | | Fires when resize revert operations fail |
104+
105+
To disable a specific rule:
106+
107+
```yaml
108+
metrics:
109+
prometheusRule:
110+
enabled: true
111+
rules:
112+
requestsClamped:
113+
enabled: false
114+
```
115+
116+
For detailed PromQL expressions and alert tuning, see the
117+
[Prometheus setup guide](../guides/prometheus-setup.md#built-in-alerts).
118+
81119
## Webhooks
82120
83121
| Key | Type | Default | Description |
@@ -152,10 +190,31 @@ watchNamespaces:
152190
| `logging.level` | string | `info` | Log level: `debug`, `info`, `warn`, `error` |
153191
| `logging.format` | string | `json` | Log format: `json` or `text` |
154192

193+
## Cluster-wide Defaults (Helm-managed)
194+
195+
The Helm chart can create an `AttuneDefaults` CR automatically when
196+
`defaults.enabled: true` is set. This is equivalent to creating the
197+
CR manually but managed through Helm values.
198+
199+
| Key | Type | Default | Description |
200+
|-----|------|---------|-------------|
201+
| `defaults.enabled` | bool | `false` | Create an AttuneDefaults resource with the values below |
202+
| `defaults.cpu.*` | object | | CPU resource defaults (see [Resource Config](#resource-configuration) below) |
203+
| `defaults.memory.*` | object | | Memory resource defaults (see [Resource Config](#resource-configuration) below) |
204+
| `defaults.costPricing.cpuPerCoreHour` | string | `"0.031"` | Cost per vCPU-hour for savings estimates |
205+
| `defaults.costPricing.memoryPerGiBHour` | string | `"0.004"` | Cost per GiB-hour for savings estimates |
206+
| `defaults.metricsSource.*` | object | | Default metrics source (e.g., shared Prometheus address) |
207+
| `defaults.updateStrategy.*` | object | | Default update strategy (type, cooldown, autoRevert, etc.) |
208+
209+
The rendered CR has the same spec as a manually created `AttuneDefaults`
210+
(documented below). All fields from the CRD are available in the Helm
211+
values; see `values.yaml` for the full set.
212+
155213
## CRD Configuration (AttuneDefaults)
156214

157-
These fields are set on the `AttuneDefaults` cluster-scoped CRD, not in
158-
the Helm `values.yaml`. They apply to all `AttunePolicy` resources.
215+
These fields are set on the `AttuneDefaults` cluster-scoped CRD, either
216+
directly or via the Helm `defaults.*` values above. They apply to all
217+
`AttunePolicy` resources.
159218

160219
### Cost Pricing
161220

0 commit comments

Comments
 (0)