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. # Seriously. Do NOT fill out the above settings if you're self-hosting.
# They're much better off being set from the control panel. # They're much better off being set from the control panel.
{{- end }} {{- 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: securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }} {{- toYaml .Values.podSecurityContext | nindent 8 }}
volumes: volumes:
- name: config-volume - name: config-volume
secret: secret:
secretName: {{ template "iceshrimp.fullname" . }}-config secretName: {{ template "iceshrimp.fullname" . }}-config
- name: data-volume
{{- if .Values.iceshrimp.localStorage.enabled }}
persistentVolumeClaim:
claimName: {{ include "iceshrimp.datapvc" . }}
{{- else }}
emptyDir:
{{- end }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
securityContext: securityContext:
@ -41,13 +48,15 @@ spec:
command: command:
- yarn - yarn
- run - run
- migrateandstart - start
env: env:
- name: "NODE_ENV" - name: "NODE_ENV"
value: "production" value: "production"
volumeMounts: volumeMounts:
- name: config-volume - name: config-volume
mountPath: /iceshrimp/.config mountPath: /iceshrimp/.config
- name: data-volume
mountPath: /iceshrimp/files
ports: ports:
- name: http - name: http
containerPort: 3000 containerPort: 3000

View file

@ -38,7 +38,7 @@ spec:
command: command:
- yarn - yarn
- run - run
- migrateandstart - migrate
env: env:
- name: "NODE_ENV" - name: "NODE_ENV"
value: "production" 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 prefix: files
endpoint: "" # e.g. "nyc3.digitaloceanspaces.com:443" endpoint: "" # e.g. "nyc3.digitaloceanspaces.com:443"
region: "" # e.g. "nyc3" 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. # -- If you want to allow iceshrimp to connect to private ips, enter the cidrs here.
allowedPrivateNetworks: [] allowedPrivateNetworks: []
# - "10.0.0.0/8" # - "10.0.0.0/8"