Skip to content

Commit be93c39

Browse files
authored
Merge pull request #54 from small-hack/feature/persistence
add optional PVC
2 parents 24c5e7d + f404729 commit be93c39

File tree

6 files changed

+51
-4
lines changed

6 files changed

+51
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ Uses @mattlqx's [docker image](https://ghcr.io/mattlqx/docker-pixelfed) which is
1111

1212
- includes bitnami subcharts for [valkey](https://github.com/bitnami/charts/blob/main/bitnami/valkey/README.md#parameters) (redis) and [postgresql](https://github.com/bitnami/charts/blob/main/bitnami/postgresql/README.md#parameters) (database)
1313
- but you can also bring your own valkey, redis, or postgresql database
14+
- we're also looking for anyone who wants to test the mariadb subchart
1415
- helm parameter (values.yaml) docs autogenerated via [`helm-docs`](https://github.com/norwoodj/helm-docs) in [`README.md`](./charts/pixelfed/README.md)
1516
- use existing Secrets for valkey, postgresql, and mail (smtp)
1617
- RenovateBot keeps the subcharts and docker image up to date
1718
- configurable liveness and readiness probes (or none at all)
1819
- configure tolerations, affinity, nodeselectors
20+
- configure persistence with a PVC we create, or bring your own
1921
- use extra volumes, volumemounts, containers, initContainers
2022

2123
## TLDR

charts/pixelfed/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.18.0
18+
version: 0.19.0
1919

2020
# This is the version number of the application being deployed.
2121
# renovate:image=ghcr.io/mattlqx/docker-pixelfed

charts/pixelfed/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pixelfed
22

3-
![Version: 0.18.0](https://img.shields.io/badge/Version-0.18.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.12.4-nginx](https://img.shields.io/badge/AppVersion-v0.12.4--nginx-informational?style=flat-square)
3+
![Version: 0.19.0](https://img.shields.io/badge/Version-0.19.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.12.4-nginx](https://img.shields.io/badge/AppVersion-v0.12.4--nginx-informational?style=flat-square)
44

55
A Helm chart for deploying Pixelfed on Kubernetes
66

@@ -78,6 +78,11 @@ A Helm chart for deploying Pixelfed on Kubernetes
7878
| mariadb.enabled | bool | `false` | enable mariadb subchart - currently experimental for this chart read more about the values: https://github.com/bitnami/charts/tree/main/bitnami/mariadb |
7979
| nameOverride | string | `""` | This is to override the chart name. |
8080
| nodeSelector | object | `{}` | put the pixelfed pod on a specific node/nodegroup |
81+
| persistence.accessModes | list | `["ReadWriteOnce"]` | accessMode |
82+
| persistence.enabled | bool | `false` | enable persistence for the pixelfed pod |
83+
| persistence.existingClaim | string | `""` | using an existing PVC instead of creating one with this chart |
84+
| persistence.storage | string | `"2Gi"` | size of the persistent volume claim to create. Tgnored if persistence.existingClaim is set |
85+
| persistence.storageClassName | string | `""` | storage class name |
8186
| phpConfigs | object | `{}` | PHP Configuration files Will be injected in /usr/local/etc/php-fpm.d |
8287
| pixelfed.account_deletion | bool | `true` | Enable account deletion (may be a requirement in some jurisdictions) |
8388
| pixelfed.activity_pub.enabled | bool | `false` | enable ActivityPub |

charts/pixelfed/templates/deployment.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ spec:
259259
{{- toYaml . | nindent 12 }}
260260
{{- end }}
261261

262-
{{- if or .Values.extraVolumeMounts .Values.phpConfigs }}
262+
{{- if or .Values.extraVolumeMounts .Values.phpConfigs .Values.persistence.enabled }}
263263
volumeMounts:
264264
{{- with .Values.extraVolumeMounts }}
265265
{{- toYaml . | nindent 12 }}
@@ -269,13 +269,26 @@ spec:
269269
mountPath: {{ print "/usr/local/etc/php-fpm.d/%s" $key | quote }}
270270
subPath: {{ $key }}
271271
{{- end }}
272+
{{- if .Values.persistence.enabled }}
273+
- name: storage
274+
mountPath: /var/www/storage
275+
{{- end }}
272276
{{- end }}{{/* end volumeMounts */}}
273277

274-
{{- if or .Values.phpConfigs .Values.extraVolumes }}
278+
{{- if or .Values.phpConfigs .Values.extraVolumes .Values.persistence.enabled }}
275279
volumes:
276280
{{- with .Values.extraVolumes }}
277281
{{- toYaml . | nindent 8 }}
278282
{{- end }}
283+
{{- if .Values.persistence.enabled }}
284+
- name: storage
285+
persistentVolumeClaim:
286+
{{- if .Values.persistence.existingClaim }}
287+
claimName: {{ .Values.persistence.existingClaim }}
288+
{{- else }}
289+
claimName: {{ include "pixelfed.fullname" . }}
290+
{{- end }}
291+
{{- end }}
279292
{{- if .Values.phpConfigs }}
280293
- name: phpconfig
281294
configMap:

charts/pixelfed/templates/pvc.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim ) }}
2+
---
3+
kind: PersistentVolumeClaim
4+
apiVersion: v1
5+
metadata:
6+
name: {{ include "pixelfed.fullname" . }}
7+
spec:
8+
storageClassName: {{ .Values.persistence.storageClassName }}
9+
accessModes:
10+
{{- toYaml .Values.persistence.accessModes | indent 4 }}
11+
resources:
12+
requests:
13+
storage: {{ .Values.persistence.storage }}
14+
{{- end }}

charts/pixelfed/values.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,19 @@ phpConfigs: {}
306306
# pm.min_spare_servers = 100
307307
# pm.max_spare_servers = 280
308308

309+
persistence:
310+
# -- enable persistence for the pixelfed pod
311+
enabled: false
312+
# -- storage class name
313+
storageClassName: ""
314+
# -- size of the persistent volume claim to create. Tgnored if persistence.existingClaim is set
315+
storage: 2Gi
316+
# -- accessMode
317+
accessModes:
318+
- ReadWriteOnce
319+
# -- using an existing PVC instead of creating one with this chart
320+
existingClaim: ""
321+
309322
pixelfed:
310323
db:
311324
# -- options: sqlite mysql pgsql sqlsrv

0 commit comments

Comments
 (0)