From 7f719fd3b7e6f42166ad7906fa657dbe925b9509 Mon Sep 17 00:00:00 2001 From: zhangxinhui02 Date: Wed, 20 Aug 2025 00:29:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=86=99napcat=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/napcat-ingress.yaml | 23 ++++++++ helm-chart/templates/napcat-pvc.yaml | 13 +++++ helm-chart/templates/napcat-service.yaml | 21 +++++++ helm-chart/templates/napcat-statefulset.yaml | 60 ++++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 helm-chart/templates/napcat-ingress.yaml create mode 100644 helm-chart/templates/napcat-pvc.yaml create mode 100644 helm-chart/templates/napcat-service.yaml create mode 100644 helm-chart/templates/napcat-statefulset.yaml diff --git a/helm-chart/templates/napcat-ingress.yaml b/helm-chart/templates/napcat-ingress.yaml new file mode 100644 index 00000000..bd28cd3c --- /dev/null +++ b/helm-chart/templates/napcat-ingress.yaml @@ -0,0 +1,23 @@ +{{- if .Values.napcat.enabled and .Values.napcat.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-maibot-napcat + namespace: {{ .Release.Namespace }} + annotations: {{ .Values.napcat.ingress.annotations }} + labels: + app: {{ .Release.Name }}-maibot-napcat +spec: + ingressClassName: {{ .Values.napcat.ingress.className }} + rules: + - host: {{ .Values.napcat.ingress.host }} + http: + paths: + - backend: + service: + name: {{ .Release.Name }}-maibot-napcat + port: + number: {{ .Values.napcat.service.port }} + path: {{ .Values.napcat.ingress.path }} + pathType: {{ .Values.napcat.ingress.pathType }} +{{- end }} diff --git a/helm-chart/templates/napcat-pvc.yaml b/helm-chart/templates/napcat-pvc.yaml new file mode 100644 index 00000000..b1a008b3 --- /dev/null +++ b/helm-chart/templates/napcat-pvc.yaml @@ -0,0 +1,13 @@ +{{- if .Values.napcat.enabled }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-maibot-napcat + namespace: {{ .Release.Namespace }} +spec: + accessModes: {{ .Values.napcat.persistence.accessModes }} + resources: + requests: + storage: {{ .Values.napcat.persistence.size }} + storageClassName: {{ .Values.napcat.persistence.storageClass | default nil }} +{{- end }} diff --git a/helm-chart/templates/napcat-service.yaml b/helm-chart/templates/napcat-service.yaml new file mode 100644 index 00000000..a3dc0c8d --- /dev/null +++ b/helm-chart/templates/napcat-service.yaml @@ -0,0 +1,21 @@ +{{- if .Values.napcat.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-maibot-napcat + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-napcat +spec: + ports: + - name: webui + port: {{ .Values.napcat.service.port }} + protocol: TCP + targetPort: 6099 + {{- if eq .Values.napcat.service.type "nodePort" }} + nodePort: {{ .Values.napcat.service.nodePort }} + {{- end }} + selector: + app: {{ .Release.Name }}-maibot-napcat + type: {{ .Values.napcat.service.type }} +{{- end }} diff --git a/helm-chart/templates/napcat-statefulset.yaml b/helm-chart/templates/napcat-statefulset.yaml new file mode 100644 index 00000000..c7f78f63 --- /dev/null +++ b/helm-chart/templates/napcat-statefulset.yaml @@ -0,0 +1,60 @@ +{{- if .Values.napcat.enabled }} +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-maibot-napcat + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Release.Name }}-maibot-napcat +spec: + serviceName: {{ .Release.Name }}-maibot-napcat + replicas: 1 + selector: + matchLabels: + app: {{ .Release.Name }}-maibot-napcat + template: + metadata: + labels: + app: {{ .Release.Name }}-maibot-napcat + spec: + containers: + - name: napcat + env: + - name: NAPCAT_GID + value: {{ .Values.napcat.permission.gid }} + - name: NAPCAT_UID + value: {{ .Values.napcat.permission.uid }} + - name: TZ + value: Asia/Shanghai + image: {{ .Values.napcat.image.repository }}:{{ .Values.napcat.image.tag }} + imagePullPolicy: {{ .Values.napcat.image.pullPolicy }} + livenessProbe: + failureThreshold: 3 + httpGet: + path: / + port: 6099 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 60 + successThreshold: 1 + timeoutSeconds: 10 + ports: + - containerPort: 6099 + name: webui + protocol: TCP + resources: {{ .Values.napcat.resources }} + volumeMounts: + - mountPath: /app/napcat/config + name: napcat + subPath: config + - mountPath: /app/.config/QQ + name: napcat + subPath: data + imagePullSecrets: {{ .Values.napcat.image.pullSecrets }} + nodeSelector: {{ .Values.napcat.nodeSelector }} + tolerations: {{ .Values.napcat.tolerations }} + volumes: + - name: napcat + persistentVolumeClaim: + claimName: {{ .Release.Name }}-maibot-napcat +{{- end }}