Files
王野 d7366869ed feat(helm): 统一镜像地址配置规范并更新CI示例
- 添加global.imageRegistry作为统一镜像仓库地址配置项
- 创建通用image模板函数处理镜像地址拼接逻辑
- 更新所有chart使用新的镜像配置结构
- 在README中添加镜像地址约定说明
- 修改CI命令示例以包含必要的镜像配置参数
- 将硬编码的镜像地址改为通过values动态配置
2026-11-03 09:52:35 +08:00

123 lines
4.3 KiB
YAML

{{- $gatewayImage := .Values.images.gateway -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gateway-deployment
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: gateway
mixingx.io/role: gateway
mixingx.io/node-id: gateway
spec:
replicas: {{ .Values.gateway.replicas | default 2 }}
selector:
matchLabels:
app.kubernetes.io/component: gateway
template:
metadata:
labels:
app.kubernetes.io/component: gateway
mixingx.io/role: gateway
mixingx.io/node-id: gateway
spec:
{{- if .Values.gateway.rbac }}
serviceAccountName: gateway-sa
{{- end }}
{{ include "mixingx-gateway.tierAffinity" (dict "role" "gateway" "root" $) | nindent 6 }}
containers:
- name: gateway
image: {{ include "mixingx-gateway.image" (dict "registry" .Values.global.imageRegistry "image" $gatewayImage) | quote }}
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: {{ .Values.gateway.port | default 8080 }}
protocol: TCP
envFrom:
- configMapRef:
name: gateway-config
- secretRef:
name: gateway-secrets
env:
- name: TZ
value: "{{ .Values.timezone | default "Asia/Shanghai" }}"
{{- if .Values.gateway.rbac }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- end }}
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 120
periodSeconds: 30
timeoutSeconds: 15
failureThreshold: 12
readinessProbe:
httpGet:
path: /alive
port: http
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 8
---
apiVersion: v1
kind: Service
metadata:
name: gateway-service
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: gateway
mixingx.io/role: gateway
mixingx.io/node-id: gateway
spec:
selector:
app.kubernetes.io/component: gateway
ports:
- name: http
port: {{ .Values.gateway.port | default 8080 }}
targetPort: http
protocol: TCP
---
apiVersion: v1
kind: ConfigMap
metadata:
name: gateway-config
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: gateway
data:
HTTP_PORTS: "{{ .Values.gateway.port | default 8080 }}"
REDIS_HOST: "{{ .Values.sharedInfra.redis.host }}"
REDIS_PORT: "{{ .Values.sharedInfra.redis.port }}"
MESSAGING_HOST: "{{ .Values.sharedInfra.rabbitmq.host }}"
MESSAGING_PORT: "{{ .Values.sharedInfra.rabbitmq.port }}"
MESSAGING_USERNAME: "{{ .Values.sharedInfra.rabbitmq.username }}"
OTEL_EXPORTER_OTLP_ENDPOINT: "{{ .Values.sharedInfra.otlp.endpoint }}"
OTEL_EXPORTER_OTLP_PROTOCOL: "{{ .Values.sharedInfra.otlp.protocol }}"
OTEL_SERVICE_NAME: "gateway"
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
---
apiVersion: v1
kind: Secret
metadata:
name: gateway-secrets
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: gateway
type: Opaque
stringData:
ConnectionStrings__redis: "{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }},password={{ .Values.sharedInfra.redis.password }}"
REDIS_PASSWORD: "{{ .Values.sharedInfra.redis.password }}"
REDIS_URI: "redis://:{{ .Values.sharedInfra.redis.password }}@{{ .Values.sharedInfra.redis.host }}:{{ .Values.sharedInfra.redis.port }}"
ConnectionStrings__messaging: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"
MESSAGING_PASSWORD: "{{ .Values.sharedInfra.rabbitmq.password }}"
MESSAGING_URI: "amqp://{{ .Values.sharedInfra.rabbitmq.username }}:{{ .Values.sharedInfra.rabbitmq.password }}@{{ .Values.sharedInfra.rabbitmq.host }}:{{ .Values.sharedInfra.rabbitmq.port }}"