deployment-web.yaml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: {{ include "mastodon.fullname" . }}-web
  5. labels:
  6. {{- include "mastodon.labels" . | nindent 4 }}
  7. spec:
  8. {{- if not .Values.autoscaling.enabled }}
  9. replicas: {{ .Values.replicaCount }}
  10. {{- end }}
  11. selector:
  12. matchLabels:
  13. {{- include "mastodon.selectorLabels" . | nindent 6 }}
  14. component: rails
  15. template:
  16. metadata:
  17. {{- with .Values.podAnnotations }}
  18. annotations:
  19. {{- toYaml . | nindent 8 }}
  20. # roll the pods to pick up any db migrations
  21. rollme: {{ randAlphaNum 5 | quote }}
  22. {{- end }}
  23. labels:
  24. {{- include "mastodon.selectorLabels" . | nindent 8 }}
  25. component: rails
  26. spec:
  27. {{- with .Values.imagePullSecrets }}
  28. imagePullSecrets:
  29. {{- toYaml . | nindent 8 }}
  30. {{- end }}
  31. serviceAccountName: {{ include "mastodon.serviceAccountName" . }}
  32. securityContext:
  33. {{- toYaml .Values.podSecurityContext | nindent 8 }}
  34. {{- if (not .Values.mastodon.s3.enabled) }}
  35. volumes:
  36. - name: assets
  37. persistentVolumeClaim:
  38. claimName: {{ template "mastodon.fullname" . }}-assets
  39. - name: system
  40. persistentVolumeClaim:
  41. claimName: {{ template "mastodon.fullname" . }}-system
  42. {{- end }}
  43. containers:
  44. - name: {{ .Chart.Name }}
  45. securityContext:
  46. {{- toYaml .Values.securityContext | nindent 12 }}
  47. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  48. imagePullPolicy: {{ .Values.image.pullPolicy }}
  49. command:
  50. - bundle
  51. - exec
  52. - puma
  53. - -C
  54. - config/puma.rb
  55. envFrom:
  56. - configMapRef:
  57. name: {{ include "mastodon.fullname" . }}-env
  58. - secretRef:
  59. name: {{ template "mastodon.fullname" . }}
  60. env:
  61. - name: "DB_PASS"
  62. valueFrom:
  63. secretKeyRef:
  64. {{- if .Values.postgresql.enabled }}
  65. name: {{ .Release.Name }}-postgresql
  66. {{- else }}
  67. name: {{ template "mastodon.fullname" . }}
  68. {{- end }}
  69. key: postgresql-password
  70. - name: "REDIS_PASSWORD"
  71. valueFrom:
  72. secretKeyRef:
  73. name: {{ .Release.Name }}-redis
  74. key: redis-password
  75. - name: "PORT"
  76. value: {{ .Values.mastodon.web.port | quote }}
  77. {{- if (not .Values.mastodon.s3.enabled) }}
  78. volumeMounts:
  79. - name: assets
  80. mountPath: /opt/mastodon/public/assets
  81. - name: system
  82. mountPath: /opt/mastodon/public/system
  83. {{- end }}
  84. ports:
  85. - name: http
  86. containerPort: {{ .Values.mastodon.web.port }}
  87. protocol: TCP
  88. livenessProbe:
  89. httpGet:
  90. path: /health
  91. port: http
  92. readinessProbe:
  93. httpGet:
  94. path: /health
  95. port: http
  96. resources:
  97. {{- toYaml .Values.resources | nindent 12 }}
  98. {{- with .Values.nodeSelector }}
  99. nodeSelector:
  100. {{- toYaml . | nindent 8 }}
  101. {{- end }}
  102. {{- with .Values.affinity }}
  103. affinity:
  104. {{- toYaml . | nindent 8 }}
  105. {{- end }}
  106. {{- with .Values.tolerations }}
  107. tolerations:
  108. {{- toYaml . | nindent 8 }}
  109. {{- end }}