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 }}