构建adapter-cm-generator的镜像,提升部署效率
This commit is contained in:
1
helm-chart/.helmignore
Normal file
1
helm-chart/.helmignore
Normal file
@@ -0,0 +1 @@
|
||||
adapter-cm-generator
|
||||
10
helm-chart/adapter-cm-generator/Dockerfile
Normal file
10
helm-chart/adapter-cm-generator/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
# 此镜像用于在部署helm chart时动态生成adapter的配置文件
|
||||
FROM python:slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip3 install --no-cache-dir -i https://mirrors.ustc.edu.cn/pypi/simple -r requirements.txt
|
||||
|
||||
ENTRYPOINT ["python3", "adapter-cm-generator.py"]
|
||||
2
helm-chart/adapter-cm-generator/requirements.txt
Normal file
2
helm-chart/adapter-cm-generator/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
toml
|
||||
kubernetes
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
# 这个脚本的作用是安装必要的python包,为adapter-cm-generator.py脚本做准备
|
||||
|
||||
pip3 install -i https://mirrors.ustc.edu.cn/pypi/simple kubernetes toml
|
||||
python3 adapter-cm-generator.py
|
||||
@@ -14,13 +14,9 @@ spec:
|
||||
serviceAccountName: {{ .Release.Name }}-maibot-adapter-cm-generator
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: python
|
||||
image: python:slim
|
||||
- name: adapter-cm-generator
|
||||
image: {{ .Values.adapter.cm_generator.image.repository }}:{{ .Values.adapter.cm_generator.image.tag }}
|
||||
workingDir: /app
|
||||
command:
|
||||
- sh
|
||||
args:
|
||||
- adapter-pip-installer.sh
|
||||
env:
|
||||
- name: PYTHONUNBUFFERED
|
||||
value: "1"
|
||||
@@ -32,21 +28,3 @@ spec:
|
||||
value: {{ .Release.Name }}
|
||||
- name: DATA_B64
|
||||
value: {{ .Values.config.adapter_config | b64enc }} # 将配置文件编码为base64,从环境变量注入
|
||||
volumeMounts:
|
||||
- mountPath: /app/adapter-pip-installer.sh
|
||||
name: scripts
|
||||
readOnly: true
|
||||
subPath: adapter-pip-installer.sh
|
||||
- mountPath: /app/adapter-cm-generator.py
|
||||
name: scripts
|
||||
readOnly: true
|
||||
subPath: adapter-cm-generator.py
|
||||
volumes:
|
||||
- name: scripts
|
||||
configMap:
|
||||
name: {{ .Release.Name }}-maibot-scripts
|
||||
items:
|
||||
- key: adapter-pip-installer.sh
|
||||
path: adapter-pip-installer.sh
|
||||
- key: adapter-cm-generator.py
|
||||
path: adapter-cm-generator.py
|
||||
|
||||
@@ -4,12 +4,6 @@ metadata:
|
||||
name: {{ .Release.Name }}-maibot-scripts
|
||||
namespace: {{ .Release.Namespace }}
|
||||
data:
|
||||
# pre-install hook
|
||||
adapter-pip-installer.sh: |
|
||||
{{ .Files.Get "files/adapter-pip-installer.sh" | nindent 4 }}
|
||||
adapter-cm-generator.py: |
|
||||
{{ .Files.Get "files/adapter-cm-generator.py" | nindent 4 }}
|
||||
|
||||
# core
|
||||
volume-linker.sh: |
|
||||
{{ .Files.Get "files/volume-linker.sh" | nindent 4 }}
|
||||
|
||||
@@ -34,6 +34,15 @@ adapter:
|
||||
- ReadWriteOnce
|
||||
size: 1Gi
|
||||
|
||||
# adapter的动态生成configmap的Job的配置
|
||||
cm_generator:
|
||||
image:
|
||||
repository: reg.mikumikumi.xyz/maibot/adapter-cm-generator
|
||||
tag: 0.10.0-alpha.0
|
||||
pullPolicy: IfNotPresent
|
||||
pullSecrets: [ ]
|
||||
|
||||
|
||||
# 麦麦本体的部署配置
|
||||
core:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user