Files
janghw 87be952fd0
All checks were successful
Deploy Gateway / deploy (push) Successful in 2m36s
Implement project updates and refactor related functionality
2026-09-17 20:36:08 +09:00

97 lines
3.7 KiB
YAML

{{- include "mcp-server.validate" . }}
{{- $tier := index .Values.tiers (index .Values.deployments .Values.deploymentKey).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을 다시 굴린다. 이게 없으면 bundle 설정을 고쳐도
# 기존 Pod이 옛 설정으로 계속 돌아 배포한 줄 알고 넘어가게 된다.
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
# 진행 중인 tools/call이 잘려 부작용만 남는 것을 줄인다.
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- 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: prod
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
# 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 }}
volumeMounts:
- name: config
mountPath: /opt/app/config
readOnly: true
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