job-chewy-upgrade.yaml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. {{- with .Values.jobAnnotations }}
  17. annotations:
  18. {{- toYaml . | nindent 8 }}
  19. {{- end }}
  20. spec:
  21. restartPolicy: Never
  22. {{- if (not .Values.mastodon.s3.enabled) }}
  23. # ensure we run on the same node as the other rails components; only
  24. # required when using PVCs that are ReadWriteOnce
  25. {{- if or (eq "ReadWriteOnce" .Values.mastodon.persistence.assets.accessMode) (eq "ReadWriteOnce" .Values.mastodon.persistence.system.accessMode) }}
  26. affinity:
  27. podAffinity:
  28. requiredDuringSchedulingIgnoredDuringExecution:
  29. - labelSelector:
  30. matchExpressions:
  31. - key: app.kubernetes.io/part-of
  32. operator: In
  33. values:
  34. - rails
  35. topologyKey: kubernetes.io/hostname
  36. {{- end }}
  37. volumes:
  38. - name: assets
  39. persistentVolumeClaim:
  40. claimName: {{ template "mastodon.fullname" . }}-assets
  41. - name: system
  42. persistentVolumeClaim:
  43. claimName: {{ template "mastodon.fullname" . }}-system
  44. {{- end }}
  45. containers:
  46. - name: {{ include "mastodon.fullname" . }}-chewy-setup
  47. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  48. imagePullPolicy: {{ .Values.image.pullPolicy }}
  49. command:
  50. - bundle
  51. - exec
  52. - rake
  53. - chewy:upgrade
  54. envFrom:
  55. - configMapRef:
  56. name: {{ include "mastodon.fullname" . }}-env
  57. - secretRef:
  58. name: {{ template "mastodon.secretName" . }}
  59. env:
  60. - name: "DB_PASS"
  61. valueFrom:
  62. secretKeyRef:
  63. name: {{ template "mastodon.postgresql.secretName" . }}
  64. key: password
  65. - name: "REDIS_PASSWORD"
  66. valueFrom:
  67. secretKeyRef:
  68. name: {{ template "mastodon.redis.secretName" . }}
  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 }}