deployment-web.yaml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. app.kubernetes.io/component: web
  15. app.kubernetes.io/part-of: rails
  16. template:
  17. metadata:
  18. annotations:
  19. {{- with .Values.podAnnotations }}
  20. {{- toYaml . | nindent 8 }}
  21. {{- end }}
  22. # roll the pods to pick up any db migrations or other changes
  23. {{- include "mastodon.rollingPodAnnotations" . | nindent 8 }}
  24. labels:
  25. {{- include "mastodon.selectorLabels" . | nindent 8 }}
  26. app.kubernetes.io/component: web
  27. app.kubernetes.io/part-of: rails
  28. spec:
  29. {{- with .Values.imagePullSecrets }}
  30. imagePullSecrets:
  31. {{- toYaml . | nindent 8 }}
  32. {{- end }}
  33. serviceAccountName: {{ include "mastodon.serviceAccountName" . }}
  34. {{- with .Values.podSecurityContext }}
  35. securityContext:
  36. {{- toYaml . | nindent 8 }}
  37. {{- end }}
  38. {{- if (not .Values.mastodon.s3.enabled) }}
  39. volumes:
  40. - name: assets
  41. persistentVolumeClaim:
  42. claimName: {{ template "mastodon.fullname" . }}-assets
  43. - name: system
  44. persistentVolumeClaim:
  45. claimName: {{ template "mastodon.fullname" . }}-system
  46. {{- end }}
  47. containers:
  48. - name: {{ .Chart.Name }}
  49. {{- with .Values.securityContext }}
  50. securityContext:
  51. {{- toYaml . | nindent 12 }}
  52. {{- end }}
  53. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  54. imagePullPolicy: {{ .Values.image.pullPolicy }}
  55. command:
  56. - bundle
  57. - exec
  58. - puma
  59. - -C
  60. - config/puma.rb
  61. envFrom:
  62. - configMapRef:
  63. name: {{ include "mastodon.fullname" . }}-env
  64. - secretRef:
  65. name: {{ template "mastodon.secretName" . }}
  66. env:
  67. - name: "DB_PASS"
  68. valueFrom:
  69. secretKeyRef:
  70. name: {{ template "mastodon.postgresql.secretName" . }}
  71. key: password
  72. - name: "REDIS_PASSWORD"
  73. valueFrom:
  74. secretKeyRef:
  75. name: {{ template "mastodon.redis.secretName" . }}
  76. key: redis-password
  77. - name: "PORT"
  78. value: {{ .Values.mastodon.web.port | quote }}
  79. {{- if (and .Values.mastodon.s3.enabled .Values.mastodon.s3.existingSecret) }}
  80. - name: "AWS_SECRET_ACCESS_KEY"
  81. valueFrom:
  82. secretKeyRef:
  83. name: {{ .Values.mastodon.s3.existingSecret }}
  84. key: AWS_SECRET_ACCESS_KEY
  85. - name: "AWS_ACCESS_KEY_ID"
  86. valueFrom:
  87. secretKeyRef:
  88. name: {{ .Values.mastodon.s3.existingSecret }}
  89. key: AWS_ACCESS_KEY_ID
  90. {{- end }}
  91. {{- if (not .Values.mastodon.s3.enabled) }}
  92. volumeMounts:
  93. - name: assets
  94. mountPath: /opt/mastodon/public/assets
  95. - name: system
  96. mountPath: /opt/mastodon/public/system
  97. {{- end }}
  98. ports:
  99. - name: http
  100. containerPort: {{ .Values.mastodon.web.port }}
  101. protocol: TCP
  102. livenessProbe:
  103. tcpSocket:
  104. port: http
  105. readinessProbe:
  106. httpGet:
  107. path: /health
  108. port: http
  109. startupProbe:
  110. httpGet:
  111. path: /health
  112. port: http
  113. failureThreshold: 30
  114. periodSeconds: 5
  115. {{- with .Values.resources }}
  116. resources:
  117. {{- toYaml . | nindent 12 }}
  118. {{- end }}
  119. {{- with .Values.nodeSelector }}
  120. nodeSelector:
  121. {{- toYaml . | nindent 8 }}
  122. {{- end }}
  123. {{- with .Values.affinity }}
  124. affinity:
  125. {{- toYaml . | nindent 8 }}
  126. {{- end }}
  127. {{- with .Values.tolerations }}
  128. tolerations:
  129. {{- toYaml . | nindent 8 }}
  130. {{- end }}