Files
2026-08-26 03:39:42 +05:30

113 lines
4.0 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "kubectl-mcp-server.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "kubectl-mcp-server.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
app: {{ include "kubectl-mcp-server.name" . }}
template:
metadata:
labels:
app: {{ include "kubectl-mcp-server.name" . }}
{{- with .Values.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
{{- if eq .Values.mcp.mode "multi" }}
checksum/registry: {{ toYaml .Values.federation.clusters | sha256sum }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ include "kubectl-mcp-server.serviceAccountName" . }}
{{- end }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: kubectl-mcp-server
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
# Image ENTRYPOINT is `k8s-rca-mcp`, configured ENTIRELY via env vars
# (no CLI args). The server registers only an allowlisted read-only
# toolset — writes are blocked at the app layer and again by RBAC.
env:
- name: MCP_MODE
value: {{ .Values.mcp.mode | quote }}
- name: MCP_TRANSPORT
value: {{ .Values.mcp.transport | quote }}
- name: MCP_HOST
value: {{ .Values.mcp.host | quote }}
- name: MCP_PORT
value: {{ .Values.mcp.port | quote }}
{{- if .Values.auth.allowAnonymous }}
- name: MCP_ALLOW_ANONYMOUS
value: "true"
{{- end }}
{{- if eq .Values.mcp.mode "multi" }}
- name: MCP_CLUSTER_REGISTRY
value: /etc/k8s-rca-mcp/clusters.yaml
- name: MCP_FORWARD_TIMEOUT
value: {{ .Values.federation.forwardTimeout | quote }}
{{- end }}
# Bearer tokens come from Vault via the ExternalSecret-synced Secret:
# MCP_AUTH_TOKEN (inbound) + each backend's <TOKENENV> (multi mode).
{{- if or .Values.externalSecrets.enabled .Values.envFrom }}
envFrom:
{{- if .Values.externalSecrets.enabled }}
- secretRef:
name: {{ include "kubectl-mcp-server.credsSecretName" . }}
{{- end }}
{{- with .Values.envFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.mcp.port }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if eq .Values.mcp.mode "multi" }}
volumeMounts:
- name: registry
mountPath: /etc/k8s-rca-mcp
readOnly: true
{{- end }}
{{- if eq .Values.mcp.mode "multi" }}
volumes:
- name: registry
configMap:
name: {{ include "kubectl-mcp-server.name" . }}-registry
{{- end }}