This commit is contained in:
Yvan
2026-09-04 17:59:32 +08:00
parent 63a7978d50
commit ce4ed32dfc
5 changed files with 84 additions and 39 deletions
+2 -1
View File
@@ -5,7 +5,8 @@
# 说明:
# - data.database 保持为空:应用启动后首页会出现"前往初始化",
# 在初始化页面填写数据库连接后,框架会自动把连接配置写回本文件。
# - data.redis.addr 指向集群内 Redis Service(<APP_NAME>-redis:6379)。
# - data.redis.addr 默认指向集群内 Redis Service(<APP_NAME>-redis:6379);
# 关闭内置 Redis 时,Jenkins 会同时关闭 admin.system.use_redis。
# - admin.app.env / admin.app.app_id / admin.jwt.issuer 由 Jenkins 按项目和分支渲染。
server:
http:
+27 -17
View File
@@ -3,6 +3,11 @@
# KRA_NAMESPACE target namespace
# KRA_ENV development | production
# KRA_REPLICAS replicas per deployment
# KRA_DEPLOY_MYSQL true/false; whether the bundled MySQL runs
# KRA_DEPLOY_REDIS true/false; whether the bundled Redis runs
# KRA_MYSQL_REPLICAS rendered MySQL replica count (0 or 1)
# KRA_REDIS_REPLICAS rendered Redis replica count (0 or 1)
# KRA_MYSQL_WAIT_IMAGE image used by the optional MySQL readiness wait
# KRA_FRONTEND_NODEPORT node port for the frontend service
# KRA_BACKEND_NODEPORT node port for the backend debug service
# KRA_MYSQL_IMAGE mysql server image
@@ -28,7 +33,7 @@ metadata:
app.kubernetes.io/part-of: ${KRA_APP}
spec:
serviceName: ${KRA_APP}-mysql
replicas: 1
replicas: ${KRA_MYSQL_REPLICAS}
selector:
matchLabels:
app.kubernetes.io/name: ${KRA_APP}-mysql
@@ -119,7 +124,7 @@ metadata:
app.kubernetes.io/name: ${KRA_APP}-redis
app.kubernetes.io/part-of: ${KRA_APP}
spec:
replicas: 1
replicas: ${KRA_REDIS_REPLICAS}
selector:
matchLabels:
app.kubernetes.io/name: ${KRA_APP}-redis
@@ -145,11 +150,13 @@ spec:
mountPath: /data
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app.kubernetes.io/name: ${KRA_APP}-mysql
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app.kubernetes.io/name: ${KRA_APP}-mysql
containers:
- name: redis
image: ${KRA_REDIS_IMAGE}
@@ -215,14 +222,15 @@ spec:
automountServiceAccountToken: false
initContainers:
- name: wait-for-mysql
image: ${KRA_MYSQL_IMAGE}
image: ${KRA_MYSQL_WAIT_IMAGE}
imagePullPolicy: IfNotPresent
command: ["sh", "-c"]
args:
- >-
until mysqladmin ping -h "${KRA_APP}-mysql" -P 3306
--connect-timeout=2 --silent;
do sleep 2; done
if [ "${KRA_DEPLOY_MYSQL}" = "true" ]; then
until mysqladmin ping -h "${KRA_APP}-mysql" -P 3306
--connect-timeout=2 --silent; do sleep 2; done;
fi
# 这里只等待 MySQL 服务可达,不要求应用数据库已经初始化;首次部署
# 仍需进入 bootstrap 模式完成 /init/initdb 向导。
- name: initialize-shared-storage
@@ -254,11 +262,13 @@ spec:
- name: harbor-registry
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app.kubernetes.io/name: ${KRA_APP}-mysql
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app.kubernetes.io/name: ${KRA_APP}-mysql
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
@@ -282,7 +292,7 @@ spec:
# JWT 签名密钥由 /data/conf/config.yaml 唯一管理,避免环境变量覆盖管理页面的配置变更;
# Redis 地址已在下方 config.yaml 中指定。
- name: KRA_ADMIN_SYSTEM_USE_REDIS
value: "true"
value: "${KRA_DEPLOY_REDIS}"
volumeMounts:
- name: config
mountPath: /data/conf