feat: 完成 issue #8 ⑥ K8s/Helm 部署底座 + 昇腾适配层
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
Thank you for installing {{ .Chart.Name }} {{ .Chart.Version }} (backend: {{ .Values.inference.backend }}).
|
||||
|
||||
iAOP 部署底座(PRD 5.6 / EPIC #8)已就绪,Release 名:{{ .Release.Name }}。
|
||||
|
||||
快速使用:
|
||||
1. 查看部署状态:
|
||||
kubectl get deploy,svc -l app.kubernetes.io/instance={{ .Release.Name }}
|
||||
2. 健康巡检:
|
||||
curl http://{{ include "iaop.fullname" . }}:{{ .Values.service.port }}/health
|
||||
3. 切换推理后端(NVIDIA GPU ↔ 华为昇腾 NPU),仅改 values 后升级:
|
||||
helm upgrade {{ .Release.Name }} . --set inference.backend=npu
|
||||
4. 如需域名入口:
|
||||
helm upgrade {{ .Release.Name }} . --set ingress.enabled=true --set ingress.host=iaop.example.com
|
||||
@@ -0,0 +1,43 @@
|
||||
{{/*
|
||||
iAOP Helm Chart 辅助模板(_helpers.tpl)
|
||||
*/}}
|
||||
|
||||
{{/*
|
||||
展开 Chart 全名(release 名 + chart 名,截断到 63 字符)。
|
||||
*/}}
|
||||
{{- define "iaop.fullname" -}}
|
||||
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Chart 名称标签。
|
||||
*/}}
|
||||
{{- define "iaop.name" -}}
|
||||
{{- .Chart.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
通用标签。
|
||||
*/}}
|
||||
{{- define "iaop.labels" -}}
|
||||
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" }}
|
||||
app.kubernetes.io/name: {{ include "iaop.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
选择器标签。
|
||||
*/}}
|
||||
{{- define "iaop.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "iaop.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
推理后端镜像完整名(repository:tag)。
|
||||
*/}}
|
||||
{{- define "iaop.image" -}}
|
||||
{{- printf "%s:%s" .Values.image.repository .Values.image.tag -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,36 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "iaop.fullname" . }}-backend
|
||||
labels:
|
||||
{{- include "iaop.labels" . | nindent 4 }}
|
||||
data:
|
||||
# 推理后端适配层配置(PRD 5.6:切换后端仅改 values.inference.backend)。
|
||||
# 该配置与 core/inference-backend/config/backends.template.yaml 同构,
|
||||
# 由推理服务容器在启动时读取。
|
||||
backends.yaml: |
|
||||
template: ti-cl4
|
||||
version: 1.0.0
|
||||
backend: {{ .Values.inference.backend }}
|
||||
inference:
|
||||
model: {{ .Values.inference.model | quote }}
|
||||
endpoint: http://{{ include "iaop.fullname" . }}:{{ .Values.service.port }}/v1
|
||||
timeout_seconds: {{ .Values.inference.timeoutSeconds }}
|
||||
runtime: {{ .Values.inference.runtime | quote }}
|
||||
device: {{ .Values.inference.device | quote }}
|
||||
max_tokens: {{ .Values.inference.maxTokens }}
|
||||
temperature: {{ .Values.inference.temperature }}
|
||||
{{- if eq .Values.inference.backend "npu" }}
|
||||
# 昇腾适配层专用字段(CANN 工具链版本;gpu 后端忽略)
|
||||
cann_version: {{ .Values.inference.cannVersion | default "" | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
cpu: {{ .Values.resources.requests.cpu | quote }}
|
||||
memory: {{ .Values.resources.requests.memory | quote }}
|
||||
limits:
|
||||
cpu: {{ .Values.resources.limits.cpu | quote }}
|
||||
memory: {{ .Values.resources.limits.memory | quote }}
|
||||
rollingUpdate:
|
||||
maxUnavailable: {{ .Values.rollingUpdate.maxUnavailable }}
|
||||
maxSurge: {{ .Values.rollingUpdate.maxSurge }}
|
||||
@@ -0,0 +1,72 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "iaop.fullname" . }}
|
||||
labels:
|
||||
{{- include "iaop.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: {{ .Values.rollingUpdate.maxUnavailable }}
|
||||
maxSurge: {{ .Values.rollingUpdate.maxSurge }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "iaop.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "iaop.selectorLabels" . | nindent 8 }}
|
||||
iaop.ai/inference-backend: {{ .Values.inference.backend }}
|
||||
spec:
|
||||
{{- if eq .Values.inference.backend "gpu" }}
|
||||
# NVIDIA GPU(5090)节点选择:推理节点打标 nvidia.com/gpu=true
|
||||
nodeSelector:
|
||||
nvidia.com/gpu: "true"
|
||||
{{- else }}
|
||||
# 华为昇腾 NPU 节点选择:推理节点打标 ascend.com/npu=true
|
||||
nodeSelector:
|
||||
ascend.com/npu: "true"
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: inference
|
||||
image: "{{ include "iaop.image" . }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.port }}
|
||||
env:
|
||||
- name: IAOP_BACKEND_CONFIG
|
||||
value: /etc/iaop/backends.yaml
|
||||
volumeMounts:
|
||||
- name: backend-config
|
||||
mountPath: /etc/iaop
|
||||
readOnly: true
|
||||
{{- if .Values.storage.enabled }}
|
||||
- name: model-store
|
||||
mountPath: /models
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumes:
|
||||
- name: backend-config
|
||||
configMap:
|
||||
name: {{ include "iaop.fullname" . }}-backend
|
||||
{{- if .Values.storage.enabled }}
|
||||
- name: model-store
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "iaop.fullname" . }}-models
|
||||
{{- end }}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{- if .Values.ingress.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "iaop.fullname" . }}
|
||||
labels:
|
||||
{{- include "iaop.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "iaop.fullname" . }}
|
||||
port:
|
||||
name: http
|
||||
{{- end }}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.storage.enabled }}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ include "iaop.fullname" . }}-models
|
||||
labels:
|
||||
{{- include "iaop.labels" . | nindent 4 }}
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
{{- if .Values.storage.className }}
|
||||
storageClassName: {{ .Values.storage.className }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.storage.size }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "iaop.fullname" . }}
|
||||
labels:
|
||||
{{- include "iaop.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "iaop.selectorLabels" . | nindent 4 }}
|
||||
Reference in New Issue
Block a user