apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "grafana-mcp.fullname" . }} namespace: {{ include "grafana-mcp.namespace" . }} labels: {{- include "grafana-mcp.labels" . | nindent 4 }} app.kubernetes.io/component: mcp-server {{- with .Values.labels }} {{- toYaml . | nindent 4 }} {{- end }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: replicas: {{ .Values.replicas }} revisionHistoryLimit: {{ .Values.revisionHistoryLimit | default 10 }} selector: matchLabels: {{- include "grafana-mcp.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: mcp-server {{- with .Values.deploymentStrategy }} strategy: {{- toYaml . | trim | nindent 4 }} {{- end }} template: metadata: labels: {{- include "grafana-mcp.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: mcp-server {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} annotations: {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "grafana-mcp.serviceAccountName" . }} automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} {{- with .Values.hostAliases }} hostAliases: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.securityContext }} securityContext: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.priorityClassName }} priorityClassName: {{ . }} {{- end }} {{- with .Values.runtimeClassName }} runtimeClassName: {{ . }} {{- end }} {{- with .Values.schedulerName }} schedulerName: {{ . }} {{- end }} {{- if or .Values.initContainers .Values.extraInitContainers }} initContainers: {{- with .Values.initContainers }} {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.extraInitContainers }} {{- tpl (toYaml .) $ | nindent 8 }} {{- end }} {{- end }} containers: - name: mcp-grafana {{- $registry := .Values.image.registry -}} {{- if $registry }} image: "{{ $registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" {{- else }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" {{- end }} imagePullPolicy: {{ .Values.image.pullPolicy }} {{- with .Values.readinessProbe }} readinessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.startupProbe }} startupProbe: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.containerSecurityContext }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} ports: - name: mcp-http containerPort: {{ .Values.service.port }} protocol: TCP env: - name: GRAFANA_URL value: {{ .Values.grafana.url | quote }} {{- if or .Values.grafana.apiKey .Values.grafana.apiKeySecret.name }} - name: GRAFANA_SERVICE_ACCOUNT_TOKEN valueFrom: secretKeyRef: {{- if .Values.grafana.apiKey }} name: {{ include "grafana-mcp.fullname" . }} key: api-key {{- else }} name: {{ .Values.grafana.apiKeySecret.name }} key: {{ .Values.grafana.apiKeySecret.key }} {{- end }} {{- end }} {{- range $key, $value := .Values.env }} - name: {{ $key | quote }} value: {{ $value | quote }} {{- end }} {{- range $key, $value := .Values.envValueFrom }} - name: {{ $key | quote }} valueFrom: {{- toYaml $value | nindent 16 }} {{- end }} {{- with .Values.envFrom }} envFrom: {{- toYaml . | nindent 12 }} {{- end }} {{- if or (.Values.debug) (.Values.metrics.enabled) (.Values.disabledCategories) (.Values.extraArgs) }} args: {{- if .Values.debug }} - -debug {{- end }} {{- if .Values.metrics.enabled }} - --metrics {{- end }} {{- range .Values.disabledCategories }} - --disable-{{ . }} {{- end }} {{- with .Values.extraArgs }} {{- toYaml . | nindent 12 }} {{- end }} {{- else -}} {{- with .Values.extraArgs }} args: {{- toYaml . | nindent 12 }} {{- end }} {{- end }} {{- with .Values.lifecycle }} lifecycle: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.volumeMounts }} volumeMounts: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.extraContainers }} {{- tpl (toYaml .) $ | nindent 8 }} {{- end }} {{- with .Values.volumes }} volumes: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.topologySpreadConstraints }} topologySpreadConstraints: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.dnsPolicy }} dnsPolicy: {{ . }} {{- end }} {{- with .Values.dnsConfig }} dnsConfig: {{- toYaml . | nindent 8 }} {{- end }}