Files
dap-was-dapms/deploy/helm/mcp-server/templates/deployment.yaml
koseokmin 4f60f4f01b GitOps 이전까지 쓸 배포 파이프라인과 Portal 모드 Chart를 추가한다
GitOps 저장소도 ArgoCD Application도 아직 없어, 그때까지 이 저장소가
push 방식 파이프라인(.gitea/workflows/)을 임시로 소유한다. 무엇을
포기하는지와 넘길 때 할 일은 deploy/README.md에 적었다.

Chart는 portal과 bundles 두 배포 모델을 모두 렌더링한다. ADR-0013이
ADR-0007을 대체했으므로 운영은 portal이 기준이지만, bundles 경로를
언제 삭제할지는 아직 정하지 않았다.

- .gitea/workflows/ci.yaml, deploy-openshift.yaml
- deploy/ci/render-manifests.sh, deploy/examples/
- Chart: mode 분기, selectedDeployment/tier helper, imagePullSecrets,
  toolService.apiKeySecret 참조
- extension-points.md에 미결 항목 9~12 추가

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 11:03:04 +09:00

104 lines
4.3 KiB
YAML

{{- include "mcp-server.validate" . }}
{{- $tier := index .Values.tiers (include "mcp-server.tier" .) }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mcp-server.name" . }}
labels:
{{- include "mcp-server.labels" . | nindent 4 }}
spec:
# replica 수는 배포가 아니라 가용성 등급이 정한다. 환경별 values의 tiers가 정본이다.
replicas: {{ $tier.replicas }}
selector:
matchLabels:
{{- include "mcp-server.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "mcp-server.labels" . | nindent 8 }}
annotations:
# ConfigMap이 바뀌면 Pod을 다시 굴린다. 이게 없으면 설정을 고쳐도
# 기존 Pod이 옛 설정으로 계속 돌아 배포한 줄 알고 넘어가게 된다.
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
# 진행 중인 tools/call이 잘려 부작용만 남는 것을 줄인다.
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- with .Values.image.pullSecrets }}
# 사내 registry가 인증을 요구할 때만 지정한다. 비워 두면 렌더링되지 않는다.
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if $tier.spreadAcrossNodes }}
affinity:
podAntiAffinity:
# replica를 서로 다른 노드에 두려고 시도한다. required가 아니라 preferred인 이유는
# 노드가 부족할 때 Pod이 아예 뜨지 못하는 편이 같은 노드에 뜨는 것보다 나쁘기 때문이다.
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
{{- include "mcp-server.selectorLabels" . | nindent 20 }}
{{- end }}
containers:
- name: mcp-server
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.ports.http }}
- name: management
containerPort: {{ .Values.ports.management }}
env:
- name: SPRING_PROFILES_ACTIVE
value: ocp
# ConfigMap을 jar 안의 설정보다 우선 적용한다.
- name: SPRING_CONFIG_ADDITIONAL_LOCATION
value: file:/opt/app/config/
- name: REDIS_HOST
value: {{ .Values.redis.host | quote }}
- name: REDIS_PORT
value: {{ .Values.redis.port | quote }}
- name: MANAGEMENT_SERVER_PORT
value: {{ .Values.ports.management | quote }}
{{- if .Values.toolService.apiKeySecret.name }}
# Tool Service 호출용 API key. 값은 Secret이 소유하고 Chart는 이름만 안다.
- name: TOOL_SERVER_API_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.toolService.apiKeySecret.name }}
key: {{ .Values.toolService.apiKeySecret.key }}
{{- end }}
volumeMounts:
- name: config
mountPath: /opt/app/config
readOnly: true
# readiness는 첫 Tool 조회가 끝나고 usable snapshot이 있을 때만 UP이다.
# 원천이 늦게 뜨는 환경에서 Pod을 죽이지 않도록 liveness에는 그 조건이 들어가지 않는다.
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: management
initialDelaySeconds: 10
periodSeconds: 10
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: management
initialDelaySeconds: 20
periodSeconds: 20
resources:
{{- toYaml .Values.resources | nindent 12 }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
volumes:
- name: config
configMap:
name: {{ include "mcp-server.name" . }}-config