Skip to content

Commit 9efeb26

Browse files
committed
[grafana] add support for deploying grafna mcp server in helm chart
Signed-off-by: AvivGuiser <[email protected]>
1 parent f459c80 commit 9efeb26

File tree

6 files changed

+930
-798
lines changed

6 files changed

+930
-798
lines changed

charts/grafana/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: grafana
3-
version: 9.2.3
3+
version: 9.3.0
44
appVersion: 12.0.1
55
kubeVersion: "^1.8.0-0"
66
description: The leading tool for querying and visualizing time series and metrics.

charts/grafana/README.md

Lines changed: 452 additions & 797 deletions
Large diffs are not rendered by default.
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
{{- if .Values.mcpServer.enabled }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ include "grafana.fullname" . }}-mcp
6+
namespace: {{ include "grafana.namespace" . }}
7+
labels:
8+
{{- include "grafana.labels" . | nindent 4 }}
9+
app.kubernetes.io/component: mcp-server
10+
{{- with .Values.mcpServer.labels }}
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
{{- with .Values.mcpServer.annotations }}
14+
annotations:
15+
{{- toYaml . | nindent 4 }}
16+
{{- end }}
17+
spec:
18+
replicas: {{ .Values.mcpServer.replicas }}
19+
revisionHistoryLimit: {{ .Values.mcpServer.revisionHistoryLimit | default 10 }}
20+
selector:
21+
matchLabels:
22+
{{- include "grafana.selectorLabels" . | nindent 6 }}
23+
app.kubernetes.io/component: mcp-server
24+
{{- with .Values.mcpServer.deploymentStrategy }}
25+
strategy:
26+
{{- toYaml . | trim | nindent 4 }}
27+
{{- end }}
28+
template:
29+
metadata:
30+
labels:
31+
{{- include "grafana.labels" . | nindent 8 }}
32+
app.kubernetes.io/component: mcp-server
33+
{{- with .Values.mcpServer.podLabels }}
34+
{{- toYaml . | nindent 8 }}
35+
{{- end }}
36+
annotations:
37+
{{- with .Values.mcpServer.podAnnotations }}
38+
{{- toYaml . | nindent 8 }}
39+
{{- end }}
40+
spec:
41+
{{- with .Values.mcpServer.imagePullSecrets }}
42+
imagePullSecrets:
43+
{{- toYaml . | nindent 8 }}
44+
{{- end }}
45+
serviceAccountName: {{ include "grafana.serviceAccountName" . }}
46+
automountServiceAccountToken: {{ .Values.mcpServer.automountServiceAccountToken }}
47+
{{- with .Values.mcpServer.hostAliases }}
48+
hostAliases:
49+
{{- toYaml . | nindent 8 }}
50+
{{- end }}
51+
{{- with .Values.mcpServer.securityContext }}
52+
securityContext:
53+
{{- toYaml . | nindent 8 }}
54+
{{- end }}
55+
{{- with .Values.mcpServer.priorityClassName }}
56+
priorityClassName: {{ . }}
57+
{{- end }}
58+
{{- with .Values.mcpServer.runtimeClassName }}
59+
runtimeClassName: {{ . }}
60+
{{- end }}
61+
{{- with .Values.mcpServer.schedulerName }}
62+
schedulerName: {{ . }}
63+
{{- end }}
64+
{{- if or .Values.mcpServer.initContainers .Values.mcpServer.extraInitContainers }}
65+
initContainers:
66+
{{- with .Values.mcpServer.initContainers }}
67+
{{- toYaml . | nindent 8 }}
68+
{{- end }}
69+
{{- with .Values.mcpServer.extraInitContainers }}
70+
{{- tpl (toYaml .) $ | nindent 8 }}
71+
{{- end }}
72+
{{- end }}
73+
containers:
74+
- name: mcp-grafana
75+
{{- $registry := .Values.global.imageRegistry | default .Values.mcpServer.image.registry -}}
76+
{{- if $registry }}
77+
image: "{{ $registry }}/{{ .Values.mcpServer.image.repository }}:{{ .Values.mcpServer.image.tag | default .Chart.AppVersion }}"
78+
{{- else }}
79+
image: "{{ .Values.mcpServer.image.repository }}:{{ .Values.mcpServer.image.tag | default .Chart.AppVersion }}"
80+
{{- end }}
81+
imagePullPolicy: {{ .Values.mcpServer.image.pullPolicy }}
82+
{{- with .Values.mcpServer.containerSecurityContext }}
83+
securityContext:
84+
{{- toYaml . | nindent 12 }}
85+
{{- end }}
86+
ports:
87+
- name: mcp-http
88+
containerPort: {{ .Values.mcpServer.service.port }}
89+
protocol: TCP
90+
env:
91+
- name: GRAFANA_URL
92+
value: {{ .Values.mcpServer.grafana.url | quote }}
93+
- name: GRAFANA_API_KEY
94+
valueFrom:
95+
secretKeyRef:
96+
name: {{ .Values.mcpServer.grafana.apiKeySecret.name }}
97+
key: {{ .Values.mcpServer.grafana.apiKeySecret.key }}
98+
{{- range $key, $value := .Values.mcpServer.env }}
99+
- name: {{ $key | quote }}
100+
value: {{ $value | quote }}
101+
{{- end }}
102+
{{- range $key, $value := .Values.mcpServer.envValueFrom }}
103+
- name: {{ $key | quote }}
104+
valueFrom:
105+
{{- toYaml $value | nindent 16 }}
106+
{{- end }}
107+
{{- with .Values.mcpServer.envFrom }}
108+
envFrom:
109+
{{- toYaml . | nindent 12 }}
110+
{{- end }}
111+
args:
112+
{{- if .Values.mcpServer.debug }}
113+
- -debug
114+
{{- end }}
115+
{{- range .Values.mcpServer.disabledCategories }}
116+
- --disable-{{ . }}
117+
{{- end }}
118+
{{- with .Values.mcpServer.extraArgs }}
119+
{{- toYaml . | nindent 12 }}
120+
{{- end }}
121+
{{- with .Values.mcpServer.lifecycle }}
122+
lifecycle:
123+
{{- toYaml . | nindent 12 }}
124+
{{- end }}
125+
{{- with .Values.mcpServer.resources }}
126+
resources:
127+
{{- toYaml . | nindent 12 }}
128+
{{- end }}
129+
{{- with .Values.mcpServer.volumeMounts }}
130+
volumeMounts:
131+
{{- toYaml . | nindent 12 }}
132+
{{- end }}
133+
{{- with .Values.mcpServer.extraContainers }}
134+
{{- tpl (toYaml .) $ | nindent 8 }}
135+
{{- end }}
136+
{{- with .Values.mcpServer.volumes }}
137+
volumes:
138+
{{- toYaml . | nindent 8 }}
139+
{{- end }}
140+
{{- with .Values.mcpServer.nodeSelector }}
141+
nodeSelector:
142+
{{- toYaml . | nindent 8 }}
143+
{{- end }}
144+
{{- with .Values.mcpServer.affinity }}
145+
affinity:
146+
{{- toYaml . | nindent 8 }}
147+
{{- end }}
148+
{{- with .Values.mcpServer.topologySpreadConstraints }}
149+
topologySpreadConstraints:
150+
{{- toYaml . | nindent 8 }}
151+
{{- end }}
152+
{{- with .Values.mcpServer.tolerations }}
153+
tolerations:
154+
{{- toYaml . | nindent 8 }}
155+
{{- end }}
156+
{{- with .Values.mcpServer.dnsPolicy }}
157+
dnsPolicy: {{ . }}
158+
{{- end }}
159+
{{- with .Values.mcpServer.dnsConfig }}
160+
dnsConfig:
161+
{{- toYaml . | nindent 8 }}
162+
{{- end }}
163+
{{- end }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{- if .Values.mcpServer.enabled }}
2+
{{- if .Values.mcpServer.ingress.enabled }}
3+
{{- $fullName := include "grafana.fullname" . }}
4+
{{- $svcPort := .Values.mcpServer.service.port }}
5+
{{- if and .Values.mcpServer.ingress.className (not (hasKey .Values.mcpServer.ingress.annotations "kubernetes.io/ingress.class")) }}
6+
{{- $_ := set .Values.mcpServer.ingress.annotations "kubernetes.io/ingress.class" .Values.mcpServer.ingress.className}}
7+
{{- end }}
8+
apiVersion: networking.k8s.io/v1
9+
kind: Ingress
10+
metadata:
11+
name: {{ $fullName }}-mcp
12+
namespace: {{ include "grafana.namespace" . }}
13+
labels:
14+
{{- include "grafana.labels" . | nindent 4 }}
15+
app.kubernetes.io/component: mcp-server
16+
{{- with .Values.mcpServer.ingress.labels }}
17+
{{- toYaml . | nindent 4 }}
18+
{{- end }}
19+
{{- with .Values.mcpServer.ingress.annotations }}
20+
annotations:
21+
{{- toYaml . | nindent 4 }}
22+
{{- end }}
23+
spec:
24+
ingressClassName: {{ .Values.mcpServer.ingress.className }}
25+
{{- if .Values.mcpServer.ingress.tls }}
26+
tls:
27+
{{- range .Values.mcpServer.ingress.tls }}
28+
- hosts:
29+
{{- range .hosts }}
30+
- {{ . | quote }}
31+
{{- end }}
32+
secretName: {{ .secretName }}
33+
{{- end }}
34+
{{- end }}
35+
rules:
36+
{{- range .Values.mcpServer.ingress.hosts }}
37+
- host: {{ .host | quote }}
38+
http:
39+
paths:
40+
{{- range .paths }}
41+
- path: {{ .path }}
42+
pathType: {{ .pathType }}
43+
backend:
44+
service:
45+
name: {{ $fullName }}-mcp
46+
port:
47+
number: {{ $svcPort }}
48+
{{- end }}
49+
{{- end }}
50+
{{- end }}
51+
{{- end }}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{{- if .Values.mcpServer.enabled }}
2+
{{- if .Values.mcpServer.service.enabled }}
3+
apiVersion: v1
4+
kind: Service
5+
metadata:
6+
name: {{ include "grafana.fullname" . }}-mcp
7+
namespace: {{ include "grafana.namespace" . }}
8+
labels:
9+
{{- include "grafana.labels" . | nindent 4 }}
10+
app.kubernetes.io/component: mcp-server
11+
{{- with .Values.mcpServer.service.labels }}
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
{{- with .Values.mcpServer.service.annotations }}
15+
annotations:
16+
{{- toYaml . | nindent 4 }}
17+
{{- end }}
18+
spec:
19+
type: {{ .Values.mcpServer.service.type }}
20+
{{- if .Values.mcpServer.service.clusterIP }}
21+
clusterIP: {{ .Values.mcpServer.service.clusterIP }}
22+
{{- end }}
23+
{{- if .Values.mcpServer.service.externalIPs }}
24+
externalIPs:
25+
{{- toYaml .Values.mcpServer.service.externalIPs | nindent 4 }}
26+
{{- end }}
27+
{{- if .Values.mcpServer.service.loadBalancerIP }}
28+
loadBalancerIP: {{ .Values.mcpServer.service.loadBalancerIP }}
29+
{{- end }}
30+
{{- if .Values.mcpServer.service.loadBalancerSourceRanges }}
31+
loadBalancerSourceRanges:
32+
{{- toYaml .Values.mcpServer.service.loadBalancerSourceRanges | nindent 4 }}
33+
{{- end }}
34+
{{- if and (eq .Values.mcpServer.service.type "ExternalName") .Values.mcpServer.service.externalName }}
35+
externalName: {{ .Values.mcpServer.service.externalName }}
36+
{{- end }}
37+
ports:
38+
- port: {{ .Values.mcpServer.service.port }}
39+
targetPort: mcp-http
40+
protocol: TCP
41+
name: mcp-http
42+
{{- if and (or (eq .Values.mcpServer.service.type "NodePort") (eq .Values.mcpServer.service.type "LoadBalancer")) .Values.mcpServer.service.nodePort }}
43+
nodePort: {{ .Values.mcpServer.service.nodePort }}
44+
{{- end }}
45+
{{- with .Values.mcpServer.service.extraPorts }}
46+
{{- toYaml . | nindent 4 }}
47+
{{- end }}
48+
selector:
49+
{{- include "grafana.selectorLabels" . | nindent 4 }}
50+
app.kubernetes.io/component: mcp-server
51+
{{- with .Values.mcpServer.service.sessionAffinity }}
52+
sessionAffinity: {{ . }}
53+
{{- end }}
54+
{{- with .Values.mcpServer.service.sessionAffinityConfig }}
55+
sessionAffinityConfig:
56+
{{- toYaml . | nindent 4 }}
57+
{{- end }}
58+
{{- end }}
59+
{{- end }}

0 commit comments

Comments
 (0)