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.

75 lines
2.7 KiB

  1. {{- if .Values.elasticsearch.enabled }}
  2. apiVersion: batch/v1
  3. kind: Job
  4. metadata:
  5. name: {{ include "mastodon.fullname" . }}-chewy-upgrade
  6. labels:
  7. {{- include "mastodon.labels" . | nindent 4 }}
  8. annotations:
  9. "helm.sh/hook": post-install
  10. "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
  11. "helm.sh/hook-weight": "-1"
  12. spec:
  13. template:
  14. metadata:
  15. name: {{ include "mastodon.fullname" . }}-chewy-upgrade
  16. spec:
  17. restartPolicy: Never
  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. containers:
  40. - name: {{ include "mastodon.fullname" . }}-chewy-setup
  41. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  42. imagePullPolicy: {{ .Values.image.pullPolicy }}
  43. command:
  44. - bundle
  45. - exec
  46. - rake
  47. - chewy:upgrade
  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. volumeMounts:
  71. - name: assets
  72. mountPath: /opt/mastodon/public/assets
  73. - name: system
  74. mountPath: /opt/mastodon/public/system
  75. {{- end }}