You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
3.0 KiB

  1. {{ if .Values.mastodon.cron.removeMedia.enabled }}
  2. apiVersion: batch/v1beta1
  3. kind: CronJob
  4. metadata:
  5. name: {{ include "mastodon.fullname" . }}-media-remove
  6. labels:
  7. {{- include "mastodon.labels" . | nindent 4 }}
  8. spec:
  9. schedule: {{ .Values.mastodon.cron.removeMedia.schedule }}
  10. jobTemplate:
  11. spec:
  12. template:
  13. metadata:
  14. name: {{ include "mastodon.fullname" . }}-media-remove
  15. spec:
  16. restartPolicy: OnFailure
  17. {{- if (not .Values.mastodon.s3.enabled) }}
  18. # ensure we run on the same node as the other rails components; only
  19. # required when using PVCs that are ReadWriteOnce
  20. {{- if or (eq "ReadWriteOnce" .Values.mastodon.persistence.assets.accessMode) (eq "ReadWriteOnce" .Values.mastodon.persistence.system.accessMode) }}
  21. affinity:
  22. podAffinity:
  23. requiredDuringSchedulingIgnoredDuringExecution:
  24. - labelSelector:
  25. matchExpressions:
  26. - key: component
  27. operator: In
  28. values:
  29. - rails
  30. topologyKey: kubernetes.io/hostname
  31. {{- end }}
  32. volumes:
  33. - name: assets
  34. persistentVolumeClaim:
  35. claimName: {{ template "mastodon.fullname" . }}-assets
  36. - name: system
  37. persistentVolumeClaim:
  38. claimName: {{ template "mastodon.fullname" . }}-system
  39. {{- end }}
  40. containers:
  41. - name: {{ include "mastodon.fullname" . }}-media-remove
  42. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  43. imagePullPolicy: {{ .Values.image.pullPolicy }}
  44. command:
  45. - bin/tootctl
  46. - media
  47. - remove
  48. envFrom:
  49. - configMapRef:
  50. name: {{ include "mastodon.fullname" . }}-env
  51. - secretRef:
  52. name: {{ template "mastodon.fullname" . }}
  53. env:
  54. - name: "DB_PASS"
  55. valueFrom:
  56. secretKeyRef:
  57. {{- if .Values.postgresql.enabled }}
  58. name: {{ .Release.Name }}-postgresql
  59. {{- else }}
  60. name: {{ template "mastodon.fullname" . }}
  61. {{- end }}
  62. key: postgresql-password
  63. - name: "REDIS_PASSWORD"
  64. valueFrom:
  65. secretKeyRef:
  66. name: {{ .Release.Name }}-redis
  67. key: redis-password
  68. - name: "PORT"
  69. value: {{ .Values.mastodon.web.port | quote }}
  70. {{- if (not .Values.mastodon.s3.enabled) }}
  71. volumeMounts:
  72. - name: assets
  73. mountPath: /opt/mastodon/public/assets
  74. - name: system
  75. mountPath: /opt/mastodon/public/system
  76. {{- end }}
  77. {{- end }}