Set cluster name to loki

This commit is contained in:
Seth Call 2025-12-13 08:49:51 -06:00
parent 914d679861
commit 8850530861
4 changed files with 27 additions and 3 deletions

View File

@ -17,6 +17,28 @@ This README would normally document whatever steps are necessary to get your app
``` ```
This ensures that `k8s/crds/all-crds.yaml` is automatically updated whenever you modify the monitoring Helm chart. This ensures that `k8s/crds/all-crds.yaml` is automatically updated whenever you modify the monitoring Helm chart.
### Monitoring Chart Patch (Critical)
The included chart `k8s/monitoring/charts/kube-prometheus-stack-75.12.0.tgz` is **MANUALLY PATCHED**.
**Why?**
The upstream chart (v65.x+) introduced a field `trackTimestampsStaleness` in the `ServiceMonitor` CRD. Our cluster is running an older version of the Prometheus Operator/CRDs that does not support this field. The upstream chart renders this field unconditionally in some templates (specifically `kubelet`), causing ArgoCD sync to fail with a schema validation error ("field not declared in schema").
**How was it patched?**
1. Unpacked the official `kube-prometheus-stack-75.12.0.tgz`.
2. Modified `templates/exporters/kubelet/servicemonitor.yaml`.
3. Wrapped `trackTimestampsStaleness` in a conditional block:
```yaml
{{- if .Values.kubelet.serviceMonitor.trackTimestampsStaleness }}
trackTimestampsStaleness: {{ .Values.kubelet.serviceMonitor.trackTimestampsStaleness }}
{{- end }}
```
4. Repackaged the chart using `tar -czf`.
5. Force added to git (`git add -f`) because `charts/*.tgz` is ignored.
**When to delete?**
You can revert to the official upstream chart once the Prometheus Operator CRDs on the cluster are upgraded to a version that includes `trackTimestampsStaleness` in the `ServiceMonitor` schema (likely Prometheus Operator >= v0.68.0 or similar).
### How do I get set up? ### ### How do I get set up? ###
* Summary of set up * Summary of set up

View File

@ -40,7 +40,7 @@ spec:
- __meta_kubernetes_namespace - __meta_kubernetes_namespace
targetLabel: namespace targetLabel: namespace
- action: replace - action: replace
replacement: loki replacement: {{ .Values.clusterName | default "loki" }}
targetLabel: cluster targetLabel: cluster
pipelineStages: pipelineStages:
- cri: {} - cri: {}

View File

@ -1,4 +1,6 @@
loki: loki:
# Default cluster name if not overridden
clusterName: default
loki: loki:
config: | config: |
auth_enabled: false auth_enabled: false

View File

@ -881,8 +881,8 @@ data:
{ {
"allValue": ".+", "allValue": ".+",
"current": { "current": {
"text": "prod", "text": "default",
"value": "prod" "value": "default"
}, },
"datasource": "$logs", "datasource": "$logs",
"hide": 0, "hide": 0,