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
2.8 KiB

  1. apiVersion: batch/v1
  2. kind: Job
  3. metadata:
  4. name: {{ include "mastodon.fullname" . }}-assets-precompile
  5. labels:
  6. {{- include "mastodon.labels" . | nindent 4 }}
  7. annotations:
  8. "helm.sh/hook": post-install
  9. "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
  10. "helm.sh/hook-weight": "-2"
  11. spec:
  12. template:
  13. metadata:
  14. name: {{ include "mastodon.fullname" . }}-assets-precompile
  15. spec:
  16. restartPolicy: Never
  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" . }}-assets-precompile
  42. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  43. imagePullPolicy: {{ .Values.image.pullPolicy }}
  44. command:
  45. - bash
  46. - -c
  47. - |
  48. bundle exec rake assets:precompile && yarn cache clean
  49. envFrom:
  50. - configMapRef:
  51. name: {{ include "mastodon.fullname" . }}-env
  52. - secretRef:
  53. name: {{ template "mastodon.fullname" . }}
  54. env:
  55. - name: "DB_PASS"
  56. valueFrom:
  57. secretKeyRef:
  58. {{- if .Values.postgresql.enabled }}
  59. name: {{ .Release.Name }}-postgresql
  60. {{- else }}
  61. name: {{ template "mastodon.fullname" . }}
  62. {{- end }}
  63. key: postgresql-password
  64. - name: "REDIS_PASSWORD"
  65. valueFrom:
  66. secretKeyRef:
  67. name: {{ .Release.Name }}-redis
  68. key: redis-password
  69. - name: "PORT"
  70. value: {{ .Values.mastodon.web.port | quote }}
  71. {{- if (not .Values.mastodon.s3.enabled) }}
  72. volumeMounts:
  73. - name: assets
  74. mountPath: /opt/mastodon/public/assets
  75. - name: system
  76. mountPath: /opt/mastodon/public/system
  77. {{- end }}