fix: Move grafana_folder from labels to annotations
Fixes Kubernetes label validation error when deploying dashboard ConfigMap. Problem: - Kubernetes labels cannot contain spaces (validation regex: [A-Za-z0-9][-A-Za-z0-9_.]*[A-Za-z0-9]) - Previous implementation had grafana_folder: "Nextcloud MCP" as a label - Deployment failed with: "Invalid value: 'Nextcloud MCP'" Solution: - Move grafana_folder from labels to annotations (annotations allow spaces) - Keep grafana_dashboard="1" as label for ConfigMap discovery - Grafana sidecar reads folder name from folderAnnotation parameter Changes: - dashboard-configmap.yaml: Move grafana_folder to annotations section - dashboards/README.md: Fix kubectl commands to use annotations - values.yaml: Update comments to clarify annotation usage This follows the standard kube-prometheus-stack pattern where: - Labels are used for ConfigMap discovery (strict validation) - Annotations are used for metadata like folder names (relaxed validation) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -123,6 +123,10 @@ kubectl create configmap nextcloud-mcp-dashboard \
|
|||||||
# Add sidecar discovery label
|
# Add sidecar discovery label
|
||||||
kubectl label configmap nextcloud-mcp-dashboard \
|
kubectl label configmap nextcloud-mcp-dashboard \
|
||||||
grafana_dashboard=1 \
|
grafana_dashboard=1 \
|
||||||
|
-n monitoring
|
||||||
|
|
||||||
|
# Add folder annotation (annotations support spaces, unlike labels)
|
||||||
|
kubectl annotate configmap nextcloud-mcp-dashboard \
|
||||||
grafana_folder="Nextcloud MCP" \
|
grafana_folder="Nextcloud MCP" \
|
||||||
-n monitoring
|
-n monitoring
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -9,15 +9,16 @@ metadata:
|
|||||||
{{- with .Values.dashboards.labels }}
|
{{- with .Values.dashboards.labels }}
|
||||||
{{- toYaml . | nindent 4 }}
|
{{- toYaml . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
# Grafana sidecar discovery labels
|
# Grafana sidecar discovery label
|
||||||
grafana_dashboard: "1"
|
grafana_dashboard: "1"
|
||||||
{{- if .Values.dashboards.grafanaFolder }}
|
|
||||||
grafana_folder: {{ .Values.dashboards.grafanaFolder | quote }}
|
|
||||||
{{- end }}
|
|
||||||
annotations:
|
annotations:
|
||||||
{{- with .Values.dashboards.annotations }}
|
{{- with .Values.dashboards.annotations }}
|
||||||
{{- toYaml . | nindent 4 }}
|
{{- toYaml . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
# Grafana folder name (annotations support spaces, unlike labels)
|
||||||
|
{{- if .Values.dashboards.grafanaFolder }}
|
||||||
|
grafana_folder: {{ .Values.dashboards.grafanaFolder | quote }}
|
||||||
|
{{- end }}
|
||||||
data:
|
data:
|
||||||
nextcloud-mcp-server.json: |-
|
nextcloud-mcp-server.json: |-
|
||||||
{{ .Files.Get "dashboards/nextcloud-mcp-server.json" | indent 4 }}
|
{{ .Files.Get "dashboards/nextcloud-mcp-server.json" | indent 4 }}
|
||||||
|
|||||||
@@ -210,7 +210,8 @@ dashboards:
|
|||||||
# Enable automatic dashboard provisioning via ConfigMap
|
# Enable automatic dashboard provisioning via ConfigMap
|
||||||
enabled: false
|
enabled: false
|
||||||
# Grafana folder name where dashboards will be imported
|
# Grafana folder name where dashboards will be imported
|
||||||
# The grafana-sidecar looks for ConfigMaps with label "grafana_folder"
|
# The grafana-sidecar looks for ConfigMaps with label "grafana_dashboard: 1"
|
||||||
|
# and reads the folder name from annotation "grafana_folder" (supports spaces)
|
||||||
grafanaFolder: "Nextcloud MCP"
|
grafanaFolder: "Nextcloud MCP"
|
||||||
# Additional labels for dashboard ConfigMap
|
# Additional labels for dashboard ConfigMap
|
||||||
# These will be added alongside the required "grafana_dashboard: 1" label
|
# These will be added alongside the required "grafana_dashboard: 1" label
|
||||||
|
|||||||
Reference in New Issue
Block a user