Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(thanos): Added rule instance label support #840

Merged
merged 1 commit into from
Dec 6, 2023
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
1 change: 1 addition & 0 deletions charts/thanos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Added `compact.deduplication.enabled` value to disable compact deduplication.
- Added `compact.deduplication.func` value to set the compact deduplication function.
- Added `rule.instanceLabel` to set the label `thanos-rule` to `<NAMESPACE>/<RULE_FULLNAME>`.

### Changed

Expand Down
7 changes: 5 additions & 2 deletions charts/thanos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ helm upgrade --install --namespace default --values ./my-values.yaml my-release
The following table lists the configurable parameters of the _Thanos_ chart and their default values.

| Parameter | Description | Default |
|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `image.repository` | Image repository. | `quay.io/thanos/thanos` |
| `image.tag` | Image tag; this will default to `.Chart.AppVersion` if not set (tag can be completely omitted by setting it to `-`) . | |
| `image.digest` | Image digest. | |
Expand Down Expand Up @@ -58,7 +58,9 @@ The following table lists the configurable parameters of the _Thanos_ chart and
| `compact.priorityClassName` | Priority class name to use for the compact pod. | `""` |
| `compact.terminationGracePeriodSeconds` | Termination grace period for the compact pod. | `null` |
| `compact.extraEnv` | Extra environment variables for the _thanos-compact_ container in the compact pod. | `[]` |
| `compact.replicaDeduplication` | If `true`, use the `penalty` deduplication function optimised for HA Prometheus replicas. | `false` |
| `compact.deduplication.enabled` | If `true`, deduplication is enabled for compact. | `true` |
| `compact.deduplication.func` | If specified override the default deduplication function. | `false` |
| `compact.replicaDeduplication` | **DEPRECATED** - If `true`, use the `penalty` deduplication function optimised for HA Prometheus replicas. | |
| `compact.extraArgs` | Extra arguments for the _thanos-compact_ container in the compact pod. | `[]` |
| `compact.livenessProbe` | Liveness probe for the compact pod. | See _values.yaml_ |
| `compact.readinessProbe` | Readiness probe for the compact pod. | See _values.yaml_ |
Expand Down Expand Up @@ -245,6 +247,7 @@ The following table lists the configurable parameters of the _Thanos_ chart and
| `rule.priorityClassName` | Priority class name to use for the rule pod. | `""` |
| `rule.terminationGracePeriodSeconds` | Termination grace period for the rule pod. | `null` |
| `rule.extraEnv` | Extra environment variables for the _thanos-rule_ container in the rule pod. | `[]` |
| `rule.instanceLabel` | If `true`, add a label for the rule instance. | `false` |
| `rule.retention` | Block retention period on local disk (`--tsdb.retention`). | `48h` |
| `rule.blockDuration` | Block duration for TSDB block (`--tsdb.block-duration`). | `2h` |
| `rule.evalInterval` | Rule evaluation interval (`--eval-interval`). | `1m` |
Expand Down
2 changes: 2 additions & 0 deletions charts/thanos/ci/kubeconform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ rule:
- key: system
operator: Exists

instanceLabel: true

storeGateway:
podDisruptionBudget:
enabled: true
Expand Down
5 changes: 4 additions & 1 deletion charts/thanos/templates/rule/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ spec:
- --http-address=0.0.0.0:10902
- --data-dir=/var/thanos/rule
- --objstore.config-file=/etc/thanos/objstore.yaml
{{- if .Values.rule.instanceLabel }}
- {{ printf "--label=thanos-rule=\"%s/%s\"" .Release.Namespace (include "thanos.rule.fullname" .) }}
{{- end }}
- --label=rule_replica="$(NAME)"
- --alert.label-drop=rule_replica
{{- if .Values.receive.enabled }}
Expand All @@ -86,7 +89,7 @@ spec:
{{- end }}
- --tsdb.retention={{ .Values.rule.retention }}
- --tsdb.block-duration={{ .Values.rule.blockDuration }}
- {{ printf "--query=dnssrv+_http._tcp.%s.%s.svc.%s" (include "thanos.query.fullname" .) .Release.Namespace .Values.clusterDomain}}
- {{ printf "--query=dnssrv+_http._tcp.%s.%s.svc.%s" (include "thanos.query.fullname" .) .Release.Namespace .Values.clusterDomain }}
- --rule-file=/etc/thanos/rules/*.yaml
- --eval-interval={{ .Values.rule.evalInterval }}
- --alertmanagers.config-file=/etc/thanos/alertmanagers-config.yaml
Expand Down
1 change: 1 addition & 0 deletions charts/thanos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ rule:

extraEnv: []

instanceLabel: false
retention: 48h
blockDuration: 2h
evalInterval: 1m
Expand Down