feat: 为helm chart兼容WebUI,当启用WebUI时默认禁止覆盖配置

pull/1370/head
zhangxinhui02 2025-11-21 04:12:29 +08:00
parent 95a4e9d8fe
commit b10bcc3432
No known key found for this signature in database
GPG Key ID: 22C23383864A313F
4 changed files with 21 additions and 19 deletions

View File

@ -14,9 +14,9 @@ build-adapter-cm-generator:
image: reg.mikumikumi.xyz/base/kaniko-builder:latest
variables:
BUILD_NO_CACHE: true
# rules:
# - changes:
# - helm-chart/adapter-cm-generator/**
rules:
- changes:
- helm-chart/adapter-cm-generator/**
script:
- export BUILD_CONTEXT=helm-chart/adapter-cm-generator
- export TMP_DST=reg.mikumikumi.xyz/maibot/adapter-cm-generator
@ -31,9 +31,9 @@ build-core-webui-cm-sync:
image: reg.mikumikumi.xyz/base/kaniko-builder:latest
variables:
BUILD_NO_CACHE: true
# rules:
# - changes:
# - helm-chart/core-webui-cm-sync/**
rules:
- changes:
- helm-chart/core-webui-cm-sync/**
script:
- export BUILD_CONTEXT=helm-chart/core-webui-cm-sync
- export TMP_DST=reg.mikumikumi.xyz/maibot/core-webui-cm-sync
@ -46,15 +46,15 @@ build-core-webui-cm-sync:
package-helm-chart:
stage: package-helm-chart
image: reg.mikumikumi.xyz/mirror/helm:latest
# rules:
# - changes:
# - helm-chart/files/**
# - helm-chart/templates/**
# - helm-chart/.gitignore
# - helm-chart/.helmignore
# - helm-chart/Chart.yaml
# - helm-chart/README.md
# - helm-chart/values.yaml
rules:
- changes:
- helm-chart/files/**
- helm-chart/templates/**
- helm-chart/.gitignore
- helm-chart/.helmignore
- helm-chart/Chart.yaml
- helm-chart/README.md
- helm-chart/values.yaml
script:
- export CHART_VERSION=$(cat helm-chart/Chart.yaml | grep '^version:' | cut -d' ' -f2)
- helm registry login reg.mikumikumi.xyz --username ${CI_REGISTRY_USER} --password ${CI_REGISTRY_PASSWORD}

View File

@ -1,4 +1,4 @@
{{- if or .Release.IsInstall .Values.config.enable_config_override }}
{{- if or .Release.IsInstall (and .Values.core.webui.enabled .Values.config.enable_config_override_with_webui) (and (not .Values.core.webui.enabled) .Values.config.enable_config_override_without_webui) }}
# 渲染规则:
# 初次安装,或配置了覆盖规则
apiVersion: v1

View File

@ -1,4 +1,4 @@
{{- if or .Release.IsInstall .Values.config.enable_config_override }}
{{- if or .Release.IsInstall (and .Values.core.webui.enabled .Values.config.enable_config_override_with_webui) (and (not .Values.core.webui.enabled) .Values.config.enable_config_override_without_webui) }}
# 渲染规则:
# 初次安装,或配置了覆盖规则
apiVersion: v1

View File

@ -212,9 +212,11 @@ sqlite_web:
config:
# 启用WebUI后配置文件的修改即可在WebUI进行。如果通过WebUI修改了配置则实际的配置文件将与values中的配置存在差异。
# 为了避免helm升级麦麦时下面values中的配置覆盖掉已有的配置文件而导致配置丢失可以在这里禁止本次部署时的配置覆盖。
# 如果用户在k8s的ConfigMap中手动修改了配置文件则实际的配置文件也会与values中的配置存在差异。
# 出现上述两种情况时为了避免helm升级麦麦时下面values中的配置覆盖掉已有的配置文件而导致配置丢失可以在这里禁止本次部署时的配置覆盖。
# 注由于adapter的配置无法通过WebUI修改因此下面的adapter_config配置仍然会覆盖已有配置文件。
enable_config_override: true # 要禁止覆盖修改为false
enable_config_override_without_webui: true # 未启用WebUI时默认覆盖
enable_config_override_with_webui: false # 启用WebUI时默认不覆盖
# adapter的config.toml
adapter_config: |