Skip to content

Commit

Permalink
Merge pull request #5 from jessebot/fix-existing-claims
Browse files Browse the repository at this point in the history
Add `mastodon.persistence.assets.existingClaim` and `mastodon.persistence.assets.existingClaim`
  • Loading branch information
jessebot authored Jul 14, 2023
2 parents b41e750 + 832d818 commit e5cef9f
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 18 deletions.
2 changes: 1 addition & 1 deletion charts/mastodon/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 4.0.9
version: 4.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
4 changes: 3 additions & 1 deletion charts/mastodon/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# mastodon

![Version: 4.0.9](https://img.shields.io/badge/Version-4.0.9-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v4.1.4](https://img.shields.io/badge/AppVersion-v4.1.4-informational?style=flat-square)
![Version: 4.1.0](https://img.shields.io/badge/Version-4.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v4.1.4](https://img.shields.io/badge/AppVersion-v4.1.4-informational?style=flat-square)

Mastodon is a free, open-source social network server based on ActivityPub.

Expand Down Expand Up @@ -45,8 +45,10 @@ Mastodon is a free, open-source social network server based on ActivityPub.
| mastodon.locale | string | `"en"` | available locales: https://github.com/mastodon/mastodon/blob/main/config/application.rb#L71 |
| mastodon.metrics.statsd.address | string | `""` | Enable statsd publishing via STATSD_ADDR environment variable |
| mastodon.persistence.assets.accessMode | string | `"ReadWriteOnce"` | ReadWriteOnce is more widely supported than ReadWriteMany, but limits scalability, since it requires the Rails and Sidekiq pods to run on the same node. |
| mastodon.persistence.assets.existingClaim | string | `nil` | name of existing persistent volume claim to use for assets |
| mastodon.persistence.assets.resources.requests.storage | string | `"10Gi"` | |
| mastodon.persistence.system.accessMode | string | `"ReadWriteOnce"` | |
| mastodon.persistence.system.existingClaim | string | `nil` | name of existing persistent volume claim to use for system |
| mastodon.persistence.system.resources.requests.storage | string | `"100Gi"` | |
| mastodon.preparedStatements | bool | `true` | |
| mastodon.s3.access_key | string | `""` | |
Expand Down
22 changes: 22 additions & 0 deletions charts/mastodon/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,28 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{/*
Create the name of the assets persistent volume to use
*/}}
{{- define "mastodon.pvc.assets" -}}
{{- if .Values.mastodon.persistence.assets.existingClaim }}
{{- printf "%s" (tpl .Values.mastodon.persistence.assets.existingClaim $) -}}
{{- else -}}
{{- printf "%s-assets" (include "common.names.fullname" .) -}}
{{- end -}}
{{- end -}}

{{/*
Create the name of the system persistent volume to use
*/}}
{{- define "mastodon.pvc.system" -}}
{{- if .Values.mastodon.persistence.system.existingClaim }}
{{- printf "%s" (tpl .Values.mastodon.persistence.system.existingClaim $) -}}
{{- else -}}
{{- printf "%s-system" (include "common.names.fullname" .) -}}
{{- end -}}
{{- end -}}

{{/*
Create a default fully qualified name for dependent services.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
Expand Down
4 changes: 2 additions & 2 deletions charts/mastodon/templates/cronjob-media-remove.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ spec:
volumes:
- name: assets
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-assets
claimName: {{ template "mastodon.pvc.assets" . }}
- name: system
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-system
claimName: {{ template "mastodon.pvc.system" . }}
{{- end }}
containers:
- name: {{ include "mastodon.fullname" . }}-media-remove
Expand Down
4 changes: 2 additions & 2 deletions charts/mastodon/templates/deployment-sidekiq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ spec:
volumes:
- name: assets
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" $context }}-assets
claimName: {{ template "mastodon.pvc.assets" $context }}
- name: system
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" $context }}-system
claimName: {{ template "mastodon.pvc.system" $context }}
{{- end }}
containers:
- name: {{ $context.Chart.Name }}
Expand Down
4 changes: 2 additions & 2 deletions charts/mastodon/templates/deployment-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ spec:
volumes:
- name: assets
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-assets
claimName: {{ template "mastodon.pvc.assets" . }}
- name: system
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-system
claimName: {{ template "mastodon.pvc.system" . }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-web
Expand Down
4 changes: 2 additions & 2 deletions charts/mastodon/templates/job-assets-precompile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ spec:
volumes:
- name: assets
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-assets
claimName: {{ template "mastodon.pvc.assets" . }}
- name: system
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-system
claimName: {{ template "mastodon.pvc.system" . }}
{{- end }}
containers:
- name: {{ include "mastodon.fullname" . }}-assets-precompile
Expand Down
4 changes: 2 additions & 2 deletions charts/mastodon/templates/job-chewy-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ spec:
volumes:
- name: assets
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-assets
claimName: {{ template "mastodon.pvc.assets" . }}
- name: system
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-system
claimName: {{ template "mastodon.pvc.system" . }}
{{- end }}
containers:
- name: {{ include "mastodon.fullname" . }}-chewy-setup
Expand Down
4 changes: 2 additions & 2 deletions charts/mastodon/templates/job-create-admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ spec:
volumes:
- name: assets
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-assets
claimName: {{ template "mastodon.pvc.assets" . }}
- name: system
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-system
claimName: {{ template "mastodon.pvc.system" . }}
{{- end }}
containers:
- name: {{ include "mastodon.fullname" . }}-create-admin
Expand Down
4 changes: 2 additions & 2 deletions charts/mastodon/templates/job-db-migrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ spec:
volumes:
- name: assets
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-assets
claimName: {{ template "mastodon.pvc.assets" . }}
- name: system
persistentVolumeClaim:
claimName: {{ template "mastodon.fullname" . }}-system
claimName: {{ template "mastodon.pvc.system" . }}
{{- end }}
containers:
- name: {{ include "mastodon.fullname" . }}-db-migrate
Expand Down
2 changes: 1 addition & 1 deletion charts/mastodon/templates/pvc-assets.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if (not .Values.mastodon.s3.enabled) -}}
{{- if and (not .Values.mastodon.s3.enabled) (not .Values.mastodon.persistence.assets.existingClaim) -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand Down
2 changes: 1 addition & 1 deletion charts/mastodon/templates/pvc-system.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if (not .Values.mastodon.s3.enabled) -}}
{{- if and (not .Values.mastodon.s3.enabled) (not .Values.mastodon.persistence.system.existingClaim) -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand Down
4 changes: 4 additions & 0 deletions charts/mastodon/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@ mastodon:
resources:
requests:
storage: 10Gi
# -- name of existing persistent volume claim to use for assets
existingClaim:
system:
accessMode: ReadWriteOnce
resources:
requests:
storage: 100Gi
# -- name of existing persistent volume claim to use for system
existingClaim:
s3:
enabled: false
access_key: ""
Expand Down

0 comments on commit e5cef9f

Please sign in to comment.