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>
105 lines
5.4 KiB
Smarty
105 lines
5.4 KiB
Smarty
{{/*
|
|
설치 대상이 실제로 존재하는지 확인하고, 없으면 읽을 수 있는 메시지로 멈춘다.
|
|
검사를 하지 않으면 오타가 "nil pointer" 같은 내부 오류로 나타나 원인을 찾기 어렵다.
|
|
값을 반환하지 않으므로 각 template 파일의 첫 줄에서 한 번 부른다.
|
|
|
|
required의 결과는 반드시 변수에 담는다. 그대로 두면 검사한 값이 렌더링 결과에 출력되어
|
|
이름 앞에 host와 CIDR이 붙어 나온다. 검사는 통과 여부만 남기고 아무것도 출력하지 않아야 한다.
|
|
|
|
mode에 따라 검사 대상이 다르다. portal 모드는 route 매핑을 Portal이 소유하므로(ADR-0013)
|
|
deploymentKey가 없고 registryUrl이 필수다. bundles 모드는 그 반대다.
|
|
*/}}
|
|
{{- define "mcp-server.validate" -}}
|
|
{{- if not (has .Values.mode (list "portal" "bundles")) -}}
|
|
{{- fail (printf "mode는 portal 또는 bundles여야 한다: %v" .Values.mode) -}}
|
|
{{- end -}}
|
|
{{- if eq .Values.mode "portal" -}}
|
|
{{- $_ := required "mode=portal이면 portal.deployment.name을 지정해야 한다." .Values.portal.deployment.name -}}
|
|
{{- $_ = required "mode=portal이면 portal.registryUrl에 Portal registry 주소를 지정해야 한다. 환경별 values-{env}.yaml이 소유한다." .Values.portal.registryUrl -}}
|
|
{{- if not (index .Values.tiers .Values.portal.deployment.tier) -}}
|
|
{{- fail (printf "values.yaml의 tiers에 '%s' 등급이 없다." .Values.portal.deployment.tier) -}}
|
|
{{- end -}}
|
|
{{- if .Values.deploymentKey -}}
|
|
{{- fail "mode=portal에서는 deploymentKey를 쓰지 않는다. route는 /mcp/{routeKey} URI에서만 결정된다(ADR-0013)." -}}
|
|
{{- end -}}
|
|
{{- else -}}
|
|
{{- $key := required "deploymentKey를 지정해야 한다. 예: --set deploymentKey=processing-critical" .Values.deploymentKey -}}
|
|
{{- $deployment := index .Values.deployments $key -}}
|
|
{{- if not $deployment -}}
|
|
{{- fail (printf "values.yaml의 deployments에 '%s'가 없다. 오타이거나 아직 토폴로지에 추가하지 않은 배포다." $key) -}}
|
|
{{- end -}}
|
|
{{- if not (index .Values.tiers $deployment.tier) -}}
|
|
{{- fail (printf "values.yaml의 tiers에 '%s' 등급이 없다. deployments의 tier와 tiers의 key가 어긋났다." $deployment.tier) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- $_ := required "global.mcpHost에 환경별 공개 MCP host를 지정해야 한다." .Values.global.mcpHost -}}
|
|
{{- $_ = required "route.sourceAllowlist에 Agent Builder의 고정 egress CIDR을 지정해야 한다." .Values.route.sourceAllowlist -}}
|
|
{{- $publicPath := required "선택된 배포의 publicPath를 지정해야 한다." (include "mcp-server.selectedDeployment" . | fromYaml).publicPath -}}
|
|
{{- if not (regexMatch "^/mcp(/[a-z0-9-]+)?$" $publicPath) -}}
|
|
{{- fail (printf "publicPath는 /mcp 또는 /mcp/<영문 소문자·숫자·하이픈> 형식이어야 한다: %s" $publicPath) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
설치할 배포 하나를 dict로 돌려준다. mode가 그것을 어디서 읽는가의 차이만 여기서 흡수하고,
|
|
나머지 template은 어느 모드인지 모른 채 같은 필드(name·tier·publicPath)를 쓴다.
|
|
호출부는 `include ... | fromYaml`로 받는다. Helm helper는 문자열만 반환하기 때문이다.
|
|
검사를 부르지 않는다. validate가 이 helper를 사용하므로 서로를 부르면 순환한다.
|
|
*/}}
|
|
{{- define "mcp-server.selectedDeployment" -}}
|
|
{{- if eq .Values.mode "portal" -}}
|
|
{{ toYaml .Values.portal.deployment }}
|
|
{{- else -}}
|
|
{{ toYaml (index .Values.deployments .Values.deploymentKey) }}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
리소스 이름. 하나의 namespace에 여러 MCP 배포가 들어갈 수 있으므로 배포마다 다른 이름을 쓴다.
|
|
*/}}
|
|
{{- define "mcp-server.name" -}}
|
|
{{- include "mcp-server.validate" . -}}
|
|
{{- (include "mcp-server.selectedDeployment" . | fromYaml).name -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
선택된 배포의 가용성 등급 이름.
|
|
*/}}
|
|
{{- define "mcp-server.tier" -}}
|
|
{{- (include "mcp-server.selectedDeployment" . | fromYaml).tier -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Redis key namespace가 되는 식별자.
|
|
환경 접미사를 여기서 자동으로 붙인다. 사람이 values에 직접 적으면 dev/test/prod가
|
|
같은 값을 갖는 실수가 나고, 그 순간 서로의 Tool snapshot을 덮어쓴다.
|
|
*/}}
|
|
{{- define "mcp-server.identity" -}}
|
|
{{- printf "%s-%s" (include "mcp-server.name" .) .Values.global.env -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
이 MCP가 보는 Tool Service의 host:port. bundles 모드에서만 쓴다.
|
|
MCP와 Tool Service는 같은 namespace이므로 서비스 이름만으로 FQDN이 완성된다.
|
|
호출 대상 주소는 오직 이 설정에서만 온다(계약 v0.2 §1). 매니페스트 응답은 이 값을 바꿀 수 없다.
|
|
portal 모드에서는 이 주소를 Portal registry가 소유하므로 이 helper를 부르지 않는다.
|
|
*/}}
|
|
{{- define "mcp-server.toolServiceHost" -}}
|
|
{{- $deployment := index .Values.deployments .Values.deploymentKey -}}
|
|
{{- printf "%s.%s.svc.cluster.local:%v" $deployment.service .Release.Namespace .Values.toolService.port -}}
|
|
{{- end -}}
|
|
|
|
{{- define "mcp-server.labels" -}}
|
|
app: {{ include "mcp-server.name" . }}
|
|
app.kubernetes.io/name: {{ include "mcp-server.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
app.kubernetes.io/component: mcp-server
|
|
app.kubernetes.io/part-of: ax-hub
|
|
ax-hub/mode: {{ .Values.mode }}
|
|
ax-hub/tier: {{ include "mcp-server.tier" . }}
|
|
{{- end -}}
|
|
|
|
{{- define "mcp-server.selectorLabels" -}}
|
|
app: {{ include "mcp-server.name" . }}
|
|
{{- end -}}
|