job-chewy-upgrade.yaml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.secretName" . }}
  55. env:
  56. - name: "DB_PASS"
  57. valueFrom:
  58. secretKeyRef:
  59. name: {{ template "mastodon.postgresql.secretName" . }}
  60. key: password
  61. - name: "REDIS_PASSWORD"
  62. valueFrom:
  63. secretKeyRef:
  64. name: {{ template "mastodon.redis.secretName" . }}
  65. key: redis-password
  66. - name: "PORT"
  67. value: {{ .Values.mastodon.web.port | quote }}
  68. {{- if (not .Values.mastodon.s3.enabled) }}
  69. volumeMounts:
  70. - name: assets
  71. mountPath: /opt/mastodon/public/assets
  72. - name: system
  73. mountPath: /opt/mastodon/public/system
  74. {{- end }}
  75. {{- end }}