From 1d795b4006da7cb65333bdba9810b15131f68172 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Tue, 19 Aug 2025 23:25:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=86=99adapter=E7=9A=84=E6=B8=85?= =?UTF-8?q?=E5=8D=95=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helm-chart/templates/adapter-configmap.yaml | 8 +++ helm-chart/templates/adapter-pvc-yaml | 11 ++++ helm-chart/templates/adapter-service.yaml | 17 +++++++ helm-chart/templates/adapter-statefulset.yaml | 50 +++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 helm-chart/templates/adapter-configmap.yaml create mode 100644 helm-chart/templates/adapter-pvc-yaml create mode 100644 helm-chart/templates/adapter-service.yaml create mode 100644 helm-chart/templates/adapter-statefulset.yaml diff --git a/helm-chart/templates/adapter-configmap.yaml b/helm-chart/templates/adapter-configmap.yaml new file mode 100644 index 00000000..6b4c80cc --- /dev/null +++ b/helm-chart/templates/adapter-configmap.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-maibot-adapter + namespace: {{ .Release.Namespace }} +data: + config.toml: | + {{ .Values.config.adapter_config | indent 4 }} diff --git a/helm-chart/templates/adapter-pvc-yaml b/helm-chart/templates/adapter-pvc-yaml new file mode 100644 index 00000000..288ca9b3 --- /dev/null +++ b/helm-chart/templates/adapter-pvc-yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-maibot-adapter + namespace: {{ .Release.Namespace }} +spec: + accessModes: {{ .Values.adapter.persistence.accessModes }} + resources: + requests: + storage: {{ .Values.adapter.persistence.size }} + storageClassName: {{ .Values.adapter.persistence.storageClass | default nil }} diff --git a/helm-chart/templates/adapter-service.yaml b/helm-chart/templates/adapter-service.yaml new file mode 100644 index 00000000..1b019912 --- /dev/null +++ b/helm-chart/templates/adapter-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-maibot-adapter + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-adapter +spec: + ports: + - name: napcat-ws + port: {{ .Values.adapter.service.port }} + protocol: TCP + targetPort: {{ .Values.adapter.service.port }} + nodePort: {{ .Values.adapter.service.nodePort }} + selector: + app: {{ .Release.Name }}-maibot-adapter + type: {{ .Values.adapter.service.type }} diff --git a/helm-chart/templates/adapter-statefulset.yaml b/helm-chart/templates/adapter-statefulset.yaml new file mode 100644 index 00000000..836c3f5a --- /dev/null +++ b/helm-chart/templates/adapter-statefulset.yaml @@ -0,0 +1,50 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-maibot-adapter + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-adapter +spec: + serviceName: {{ .Release.Name }}-maibot-adapter + replicas: 1 + selector: + matchLabels: + app: {{ .Release.Name }}-maibot-adapter + template: + metadata: + labels: + app: {{ .Release.Name }}-maibot-adapter + spec: + containers: + - name: adapter + env: + - name: TZ + value: Asia/Shanghai + image: {{ .Values.adapter.image.repository }}:{{ .Values.adapter.image.tag }} + imagePullPolicy: {{ .Values.adapter.image.pullPolicy }} + ports: + - containerPort: {{ .Values.adapter.service.port }} + name: napcat-ws + protocol: TCP + resources: {{ .Values.adapter.resources }} + volumeMounts: + - mountPath: /adapters/data + name: data + - mountPath: /adapters/config.toml + name: config + readOnly: true + subPath: config.toml + imagePullSecrets: {{ .Values.adapter.image.pullSecrets }} + nodeSelector: {{ .Values.adapter.nodeSelector }} + tolerations: {{ .Values.adapter.tolerations }} + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-adapter + - configMap: + items: + - key: config.toml + path: config.toml + name: {{ .Release.Name }}-maibot-adapter + name: config