mirror of
https://github.com/shadoll/helm-charts.git
synced 2026-10-12 21:59:18 +00:00
Add postgres-mcp Helm chart
Wraps FreePeak/db-mcp-server: multi-database Postgres MCP driven by a single JSON connection list, so new databases don't need a new Helm release. Includes per-connection read_only/max_rows/query_timeout/ masking_rules guardrails and a PVC-backed audit log.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
apiVersion: v2
|
||||
name: postgres-mcp
|
||||
description: Multi-database Postgres MCP server Helm chart (FreePeak/db-mcp-server)
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.9.0"
|
||||
annotations:
|
||||
version-source: github-release:FreePeak/db-mcp-server
|
||||
version-pattern: "s|^v||"
|
||||
@@ -0,0 +1,74 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ .Chart.Name }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
app.kubernetes.io/component: mcp
|
||||
app.kubernetes.io/part-of: postgres
|
||||
annotations:
|
||||
version-source: {{ index .Chart.Annotations "version-source" }}
|
||||
version-pattern: {{ index .Chart.Annotations "version-pattern" | quote }}
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
# Not RollingUpdate: two pods would both hold live connections against
|
||||
# the same shared mcp_agent role/config at once, doubling connection
|
||||
# count and audit-log writers for no benefit -- this server has no
|
||||
# per-replica state to preserve, so a brief gap during redeploy is fine.
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ .Release.Name }}
|
||||
spec:
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.port }}
|
||||
name: http
|
||||
protocol: TCP
|
||||
env:
|
||||
{{- range $key, $value := .Values.env }}
|
||||
- name: {{ $key }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.existingSecret }}
|
||||
- name: DB_CONFIG
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.existingSecret }}
|
||||
key: {{ .Values.secretConfigKey }}
|
||||
{{- end }}
|
||||
{{- if .Values.auditLog.enabled }}
|
||||
- name: DB_MCP_AUDIT_LOG
|
||||
value: {{ .Values.auditLog.path | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.auditLog.enabled }}
|
||||
volumeMounts:
|
||||
- name: audit-log
|
||||
mountPath: {{ .Values.auditLog.dir }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- if .Values.auditLog.enabled }}
|
||||
volumes:
|
||||
- name: audit-log
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Release.Name }}-audit-log
|
||||
{{- end }}
|
||||
@@ -0,0 +1,27 @@
|
||||
{{- range $name, $config := .Values.ingresses }}
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $.Release.Name }}-{{ $name }}
|
||||
{{- with $config.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
rules:
|
||||
- host: {{ $config.host }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ $.Release.Name }}
|
||||
port:
|
||||
number: {{ $.Values.port }}
|
||||
{{- with $config.tls }}
|
||||
tls:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,13 @@
|
||||
{{- if .Values.auditLog.enabled }}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-audit-log
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: {{ .Values.auditLog.storageClass }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.auditLog.size }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ .Chart.Name }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: {{ .Release.Name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,51 @@
|
||||
image:
|
||||
repository: freepeak/db-mcp-server
|
||||
tag: ""
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
port: 9092
|
||||
|
||||
# Name of a Secret holding the whole multi-database config as one JSON blob
|
||||
# (see FreePeak/db-mcp-server's DB_CONFIG env var) -- keeps connection
|
||||
# strings/passwords for every database out of a plain ConfigMap.
|
||||
existingSecret: ""
|
||||
secretConfigKey: "DB_CONFIG"
|
||||
|
||||
env:
|
||||
TRANSPORT_MODE: "sse"
|
||||
SERVER_PORT: "9092"
|
||||
LOG_LEVEL: "info"
|
||||
|
||||
# Persistent audit log (DB_MCP_AUDIT_LOG) -- one JSONL record per executed
|
||||
# statement, including rejected writes against read-only databases. Kept on
|
||||
# a small PVC so it survives pod restarts; this is the primary compensating
|
||||
# control for a server with broad read/write reach across many databases.
|
||||
auditLog:
|
||||
enabled: true
|
||||
dir: /var/log/db-mcp
|
||||
path: /var/log/db-mcp/audit.jsonl
|
||||
storageClass: local-path
|
||||
size: 1Gi
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: "50m"
|
||||
memory: "128Mi"
|
||||
limits:
|
||||
cpu: "500m"
|
||||
memory: "512Mi"
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
ingresses: {}
|
||||
# https:
|
||||
# host: pg.mcp.example.com
|
||||
# annotations: {}
|
||||
# tls:
|
||||
# - hosts:
|
||||
# - pg.mcp.example.com
|
||||
# lan:
|
||||
# host: pg.mcp.example.lan
|
||||
# annotations: {}
|
||||
Reference in New Issue
Block a user