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.

79 lines
2.8 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. {{- if (not .Values.mastodon.s3.enabled) }}
  19. # ensure we run on the same node as the other rails components; only
  20. # required when using PVCs that are ReadWriteOnce
  21. {{- if or (eq "ReadWriteOnce" .Values.mastodon.persistence.assets.accessMode) (eq "ReadWriteOnce" .Values.mastodon.persistence.system.accessMode) }}
  22. affinity:
  23. podAffinity:
  24. requiredDuringSchedulingIgnoredDuringExecution:
  25. - labelSelector:
  26. matchExpressions:
  27. - key: component
  28. operator: In
  29. values:
  30. - rails
  31. topologyKey: kubernetes.io/hostname
  32. {{- end }}
  33. volumes:
  34. - name: assets
  35. persistentVolumeClaim:
  36. claimName: {{ template "mastodon.fullname" . }}-assets
  37. - name: system
  38. persistentVolumeClaim:
  39. claimName: {{ template "mastodon.fullname" . }}-system
  40. {{- end }}
  41. containers:
  42. - name: {{ include "mastodon.fullname" . }}-chewy-setup
  43. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  44. imagePullPolicy: {{ .Values.image.pullPolicy }}
  45. command:
  46. - bundle
  47. - exec
  48. - rake
  49. - chewy:upgrade
  50. envFrom:
  51. - configMapRef:
  52. name: {{ include "mastodon.fullname" . }}-env
  53. - secretRef:
  54. name: {{ template "mastodon.fullname" . }}
  55. env:
  56. - name: "DB_PASS"
  57. valueFrom:
  58. secretKeyRef:
  59. {{- if .Values.postgresql.enabled }}
  60. name: {{ .Release.Name }}-postgresql
  61. {{- else }}
  62. name: {{ template "mastodon.fullname" . }}
  63. {{- end }}
  64. key: postgresql-password
  65. - name: "REDIS_PASSWORD"
  66. valueFrom:
  67. secretKeyRef:
  68. name: {{ .Release.Name }}-redis
  69. key: redis-password
  70. - name: "PORT"
  71. value: {{ .Values.mastodon.web.port | quote }}
  72. {{- if (not .Values.mastodon.s3.enabled) }}
  73. volumeMounts:
  74. - name: assets
  75. mountPath: /opt/mastodon/public/assets
  76. - name: system
  77. mountPath: /opt/mastodon/public/system
  78. {{- end }}
  79. {{- end }}