feat: enable persistence in chart

This commit is contained in:
corite 2024-01-14 20:36:37 +01:00
parent 5c405defa0
commit 4d9b8df5c6
5 changed files with 54 additions and 6 deletions

View File

@ -325,3 +325,8 @@ objectStorage:
# Seriously. Do NOT fill out the above settings if you're self-hosting.
# They're much better off being set from the control panel.
{{- end }}
{{- define "iceshrimp.datapvc" -}}
{{- default (printf "%s-data-pvc" (include "iceshrimp.fullname" .) ) .Values.iceshrimp.localStorage.claimName }}
{{- end }}

View File

@ -29,9 +29,16 @@ spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
volumes:
- name: config-volume
secret:
secretName: {{ template "iceshrimp.fullname" . }}-config
- name: config-volume
secret:
secretName: {{ template "iceshrimp.fullname" . }}-config
- name: data-volume
{{- if .Values.iceshrimp.localStorage.enabled }}
persistentVolumeClaim:
claimName: {{ include "iceshrimp.datapvc" . }}
{{- else }}
emptyDir:
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
@ -41,13 +48,15 @@ spec:
command:
- yarn
- run
- migrateandstart
- start
env:
- name: "NODE_ENV"
value: "production"
volumeMounts:
- name: config-volume
mountPath: /iceshrimp/.config
- name: data-volume
mountPath: /iceshrimp/files
ports:
- name: http
containerPort: 3000

View File

@ -38,7 +38,7 @@ spec:
command:
- yarn
- run
- migrateandstart
- migrate
env:
- name: "NODE_ENV"
value: "production"

23
chart/templates/pvc.yaml Normal file
View File

@ -0,0 +1,23 @@
{{- if .Values.iceshrimp.localStorage.enabled }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "iceshrimp.datapvc" . }}
labels:
{{- include "iceshrimp.labels" . | nindent 4 }}
annotations:
{{- .Values.iceshrimp.localStorage.annotations | toYaml | nindent 4}}
spec:
accessModes:
{{- .Values.iceshrimp.localStorage.accessModes | toYaml | nindent 4 }}
volumeMode: Filesystem
{{- if .Values.iceshrimp.localStorage.class }}
storageClassName: {{ .Values.iceshrimp.localStorage.class }}
{{- end }}
{{- with .Values.iceshrimp.localStorage.volumeName }}
volumeName: {{ . }}
{{- end }}
resources:
requests:
storage: {{ .Values.iceshrimp.localStorage.size }}
{{- end }}

View File

@ -42,7 +42,18 @@ iceshrimp:
prefix: files
endpoint: "" # e.g. "nyc3.digitaloceanspaces.com:443"
region: "" # e.g. "nyc3"
localStorage:
enabled: true
claimName: null
accessModes:
- ReadWriteOnce
labels: {}
class:
annotations:
helm.sh/resource-policy: keep
size: 10Gi
# -- If you want to allow iceshrimp to connect to private ips, enter the cidrs here.
allowedPrivateNetworks: []
# - "10.0.0.0/8"