feat: 为helm chart编写脚本,用于默认插件更新后或麦麦首次启动时为用户自动安装默认插件到存储卷中

This commit is contained in:
zhangxinhui02
2025-11-01 00:54:59 +08:00
parent ecbf06b8a6
commit 60df8e9a3f
3 changed files with 117 additions and 0 deletions

View File

@@ -62,6 +62,23 @@ spec:
- mountPath: /MaiMBot/statistics
name: statistics
{{- end }}
initContainers: # 用户插件目录存储在存储卷中,会在启动时覆盖掉容器的默认插件目录。此初始化容器用于默认插件更新后或麦麦首次启动时为用户自动安装默认插件到存储卷中
- args:
- setup-plugins.py
command:
- python3
workingDir: /MaiMBot
image: {{ .Values.core.image.repository | default "reg.mikumikumi.xyz/maibot/maibot" }}:{{ .Values.core.image.tag | default "tag-0.11.0-beta" }}
imagePullPolicy: {{ .Values.core.image.pullPolicy }}
name: setup-plugins
resources: { }
volumeMounts:
- mountPath: /MaiMBot/data
name: data
- mountPath: /MaiMBot/setup-plugins.py
name: scripts
readOnly: true
subPath: setup-plugins.py
{{- if .Values.core.image.pullSecrets }}
imagePullSecrets:
{{ toYaml .Values.core.image.pullSecrets | nindent 8 }}
@@ -82,6 +99,8 @@ spec:
items:
- key: volume-linker.sh
path: volume-linker.sh
- key: setup-plugins.py
path: setup-plugins.py
name: {{ .Release.Name }}-maibot-scripts
name: scripts
- configMap:

View File

@@ -7,3 +7,6 @@ data:
# core
volume-linker.sh: |
{{ .Files.Get "files/volume-linker.sh" | nindent 4 }}
# core的初始化容器
setup-plugins.py: |
{{ .Files.Get "files/setup-plugins.py" | nindent 4 }}