From c8d6e725a2e942912d5f23e3286cb73db5e099b3 Mon Sep 17 00:00:00 2001 From: bot_dev2 Date: Wed, 5 Aug 2026 02:57:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=20issue=20#56=20?= =?UTF-8?q?=E2=91=A5=20Helm=20chart=20=E5=8F=82=E6=95=B0=E5=8C=96=EF=BC=88?= =?UTF-8?q?=E8=B5=84=E6=BA=90/=E5=89=AF=E6=9C=AC/=E5=9F=9F=E5=90=8D/?= =?UTF-8?q?=E5=AD=98=E5=82=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../k8s/helm/iaop/templates/deployment.yaml | 13 +++++++ deploy/k8s/helm/iaop/templates/hpa.yaml | 22 ++++++++++++ deploy/k8s/helm/iaop/values.dev.yaml | 22 ++++++++++++ deploy/k8s/helm/iaop/values.prod.yaml | 35 +++++++++++++++++++ deploy/k8s/helm/iaop/values.yaml | 14 ++++++++ 5 files changed, 106 insertions(+) create mode 100644 deploy/k8s/helm/iaop/templates/hpa.yaml create mode 100644 deploy/k8s/helm/iaop/values.dev.yaml create mode 100644 deploy/k8s/helm/iaop/values.prod.yaml diff --git a/deploy/k8s/helm/iaop/templates/deployment.yaml b/deploy/k8s/helm/iaop/templates/deployment.yaml index 955c317..c30ba36 100644 --- a/deploy/k8s/helm/iaop/templates/deployment.yaml +++ b/deploy/k8s/helm/iaop/templates/deployment.yaml @@ -29,6 +29,19 @@ spec: nodeSelector: ascend.com/npu: "true" {{- end }} + {{- if .Values.tolerations }} + tolerations: + {{- toYaml .Values.tolerations | nindent 8 }} + {{- end }} + {{- if .Values.image.serviceAccountName }} + serviceAccountName: {{ .Values.image.serviceAccountName }} + {{- end }} + {{- if .Values.image.pullSecrets }} + imagePullSecrets: + {{- range .Values.image.pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} containers: - name: inference image: "{{ include "iaop.image" . }}" diff --git a/deploy/k8s/helm/iaop/templates/hpa.yaml b/deploy/k8s/helm/iaop/templates/hpa.yaml new file mode 100644 index 0000000..d0725b0 --- /dev/null +++ b/deploy/k8s/helm/iaop/templates/hpa.yaml @@ -0,0 +1,22 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "iaop.fullname" . }} + labels: + {{- include "iaop.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "iaop.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} +{{- end }} diff --git a/deploy/k8s/helm/iaop/values.dev.yaml b/deploy/k8s/helm/iaop/values.dev.yaml new file mode 100644 index 0000000..d79a58c --- /dev/null +++ b/deploy/k8s/helm/iaop/values.dev.yaml @@ -0,0 +1,22 @@ +# iAOP Helm Chart —— 开发/联调环境 values 覆盖示例(issue #56 多环境参数化)。 +# 用法:helm install iaop deploy/k8s/helm/iaop -f values.dev.yaml +# 说明:仅覆盖与开发环境差异的键;其余继承 values.yaml 默认值。 + +# 开发环境:低副本、小资源、关 HPA(本地/联调) +replicaCount: 1 +resources: + requests: + cpu: "1" + memory: 4Gi + limits: + cpu: "4" + memory: 16Gi +autoscaling: + enabled: false +storage: + size: 20Gi + +# 域名入口(开发环境使用独立域名) +ingress: + enabled: true + host: dev.iaop.example.com diff --git a/deploy/k8s/helm/iaop/values.prod.yaml b/deploy/k8s/helm/iaop/values.prod.yaml new file mode 100644 index 0000000..82536f7 --- /dev/null +++ b/deploy/k8s/helm/iaop/values.prod.yaml @@ -0,0 +1,35 @@ +# iAOP Helm Chart —— 生产环境 values 覆盖示例(issue #56 多环境参数化)。 +# 用法:helm install iaop deploy/k8s/helm/iaop -f values.prod.yaml +# 说明:生产环境按 PRD 5.6 配置点固化:资源配额、副本/HPA、灰度、域名。 + +# 生产环境:多副本 + HPA、大资源、灰度滚动 +replicaCount: 3 +autoscaling: + enabled: true + minReplicas: 3 + maxReplicas: 10 + targetCPUUtilizationPercentage: 70 +rollingUpdate: + maxUnavailable: 0 + maxSurge: 1 +resources: + requests: + cpu: "2" + memory: 8Gi + limits: + cpu: "8" + memory: 32Gi +storage: + enabled: true + className: "" # 生产建议指定 SSD StorageClass + size: 200Gi + +# 域名入口(生产域名 + 证书) +ingress: + enabled: true + host: iaop.example.com + +# 私有镜像仓库凭据(生产必需) +image: + pullSecrets: + - iaop-registry-secret diff --git a/deploy/k8s/helm/iaop/values.yaml b/deploy/k8s/helm/iaop/values.yaml index 490c4f1..f59fcfa 100644 --- a/deploy/k8s/helm/iaop/values.yaml +++ b/deploy/k8s/helm/iaop/values.yaml @@ -10,6 +10,10 @@ image: repository: iaop/inference tag: v1.0.0 pullPolicy: IfNotPresent + # 私有仓库拉取凭据(imagePullSecrets) + pullSecrets: [] + # 服务账户(缺省 = release 名;自定义请先创建) + serviceAccountName: "" # ---- 推理后端选择(PRD 5.6 配置点:切换后端仅改此处) ---- inference: @@ -28,6 +32,16 @@ rollingUpdate: maxUnavailable: 0 maxSurge: 1 +# ---- 水平自动扩缩(HPA;副本参数化扩展,issue #56) ---- +autoscaling: + enabled: false + minReplicas: 2 + maxReplicas: 8 + targetCPUUtilizationPercentage: 70 + +# ---- 节点调度(可选) ---- +tolerations: [] # 容忍度(如 GPU/NPU 专用节点污点) + # ---- 服务 ---- service: type: ClusterIP