闭社主体 forked from https://github.com/tootsuite/mastodon
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.

69 lines
2.4 KiB

  1. apiVersion: batch/v1
  2. kind: Job
  3. metadata:
  4. name: {{ include "mastodon.fullname" . }}-db-migrate
  5. labels:
  6. {{- include "mastodon.labels" . | nindent 4 }}
  7. annotations:
  8. "helm.sh/hook": post-install,pre-upgrade
  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" . }}-db-migrate
  15. spec:
  16. restartPolicy: Never
  17. # ensure we run on the same node as the other rails components; only
  18. # required when using PVCs that are ReadWriteOnce
  19. {{- if or (eq "ReadWriteOnce" .Values.persistence.assets.accessMode) (eq "ReadWriteOnce" .Values.persistence.system.accessMode) }}
  20. affinity:
  21. podAffinity:
  22. requiredDuringSchedulingIgnoredDuringExecution:
  23. - labelSelector:
  24. matchExpressions:
  25. - key: component
  26. operator: In
  27. values:
  28. - rails
  29. topologyKey: kubernetes.io/hostname
  30. {{- end }}
  31. volumes:
  32. - name: assets
  33. persistentVolumeClaim:
  34. claimName: {{ template "mastodon.fullname" . }}-assets
  35. - name: system
  36. persistentVolumeClaim:
  37. claimName: {{ template "mastodon.fullname" . }}-system
  38. containers:
  39. - name: {{ include "mastodon.fullname" . }}-db-migrate
  40. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  41. imagePullPolicy: {{ .Values.image.pullPolicy }}
  42. command:
  43. - bundle
  44. - exec
  45. - rake
  46. - db:migrate
  47. envFrom:
  48. - configMapRef:
  49. name: {{ include "mastodon.fullname" . }}-env
  50. - secretRef:
  51. name: {{ template "mastodon.fullname" . }}
  52. env:
  53. - name: "DB_PASS"
  54. valueFrom:
  55. secretKeyRef:
  56. name: {{ .Release.Name }}-postgresql
  57. key: postgresql-password
  58. - name: "REDIS_PASSWORD"
  59. valueFrom:
  60. secretKeyRef:
  61. name: {{ .Release.Name }}-redis
  62. key: redis-password
  63. - name: "PORT"
  64. value: {{ .Values.application.web.port | quote }}
  65. volumeMounts:
  66. - name: assets
  67. mountPath: /opt/mastodon/public/assets
  68. - name: system
  69. mountPath: /opt/mastodon/public/system