Files
mixingx.hub.chart/templates/_frontend.tpl
T
ximenchuifeng 8ffc6ee825 feat(chart): instances/standalones 改 range 循环 + 全部镜像加时区
== helm chart 标准化 ==
- instances/standalones: 写死文件 → range 循环(加/删点位只改 values)
- values 加 webName(显式前端名)+ description(Gateway 中文展示名)
- _backend.tpl: Service 加 mixingx.io/description annotation + 补 ultra serviceId
- _frontend.tpl/audit.yaml/mock.yaml: 注入 TZ env
- values 加 timezone 变量(部署地域可覆盖,默认 Asia/Shanghai)
- 修 app-ingress.yaml gatewayService/gatewayPort undefined bug
- 验证: helm diff 资源数一致(61=61),加 agent-beijing 点位 8 资源全部正确生成

== 12 个 Dockerfile 加时区 ==
后端(.NET debian): apt-get tzdata + ln /etc/localtime + ENV TZ
前端(nginx alpine): apk add tzdata
audit(node alpine): apk add tzdata
mock(opcua/s7): 同上
镜像内置 Asia/Shanghai 兜底 + helm TZ env 覆盖 = 双保险

== submodule Dockerfile 重写 ==
agent/edge/ultra: 重写适配 hub 根 context(含 ServiceDefaults 跨仓库引用)
sso/gateway: 加时区

== submodule 指针更新 ==
7 个 submodule 指针全部更新
2026-06-25 10:37:52 +08:00

83 lines
2.3 KiB
Smarty

{{/*
公共模板:前端 Deployment + Service
可选 podAffinity(四胞胎用:前端和后端同节点)
参数:
name - 服务名(agent-web-0 / sso-web ...)
image - 镜像名
port - 端口(默认 80)
basePath - vite base path
affinity - 要亲和的目标服务名(如 "agent-0"),空则不配亲和
root - $ (root context)
*/}}
{{- define "mixingx.frontend" -}}
{{- $root := .root -}}
{{- $port := .port | default 80 -}}
---
# Deployment: {{ .name }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .name }}-deployment
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/instance: {{ $root.Release.Name }}
app.kubernetes.io/component: {{ .name }}
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: {{ .name }}
template:
metadata:
labels:
app.kubernetes.io/component: {{ .name }}
spec:
{{- if .affinity }}
# 四胞胎:前端必须和后端同节点
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app.kubernetes.io/component: {{ .affinity }}
topologyKey: kubernetes.io/hostname
{{- end }}
containers:
- name: {{ .name }}
image: {{ $root.Values.registry }}/{{ .image }}:{{ $root.Values.tag | default "latest" }}
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: {{ $port }}
protocol: TCP
env:
# 时区(部署地域覆盖,优先级 > 镜像内 /etc/localtime)
- name: TZ
value: "{{ $root.Values.timezone | default "Asia/Shanghai" }}"
- name: VITE_BASE_PATH
value: "{{ .basePath }}"
- name: PORT
value: "{{ $port }}"
---
# Service: {{ .name }}
apiVersion: v1
kind: Service
metadata:
name: {{ .name }}-service
labels:
app.kubernetes.io/name: mixingx
app.kubernetes.io/component: {{ .name }}
mixingx.io/role: web
mixingx.io/node-id: {{ .name }}
spec:
selector:
app.kubernetes.io/component: {{ .name }}
ports:
- name: http
port: {{ $port }}
targetPort: http
protocol: TCP
{{- end -}}