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

@ -32,6 +32,13 @@ spec:
- 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

@ -43,6 +43,17 @@ iceshrimp:
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"