deployment-web.yaml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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.secretName" . }}
  60. env:
  61. - name: "DB_PASS"
  62. valueFrom:
  63. secretKeyRef:
  64. name: {{ template "mastodon.postgresql.secretName" . }}
  65. key: password
  66. - name: "REDIS_PASSWORD"
  67. valueFrom:
  68. secretKeyRef:
  69. name: {{ template "mastodon.redis.secretName" . }}
  70. key: redis-password
  71. - name: "PORT"
  72. value: {{ .Values.mastodon.web.port | quote }}
  73. {{- if (not .Values.mastodon.s3.enabled) }}
  74. volumeMounts:
  75. - name: assets
  76. mountPath: /opt/mastodon/public/assets
  77. - name: system
  78. mountPath: /opt/mastodon/public/system
  79. {{- end }}
  80. ports:
  81. - name: http
  82. containerPort: {{ .Values.mastodon.web.port }}
  83. protocol: TCP
  84. livenessProbe:
  85. httpGet:
  86. path: /health
  87. port: http
  88. readinessProbe:
  89. httpGet:
  90. path: /health
  91. port: http
  92. resources:
  93. {{- toYaml .Values.resources | nindent 12 }}
  94. {{- with .Values.nodeSelector }}
  95. nodeSelector:
  96. {{- toYaml . | nindent 8 }}
  97. {{- end }}
  98. {{- with .Values.affinity }}
  99. affinity:
  100. {{- toYaml . | nindent 8 }}
  101. {{- end }}
  102. {{- with .Values.tolerations }}
  103. tolerations:
  104. {{- toYaml . | nindent 8 }}
  105. {{- end }}