You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.5 KiB

  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: {{ include "mastodon.fullname" . }}-sidekiq
  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. # ensure we run on the same node as the other rails components; only
  35. # required when using PVCs that are ReadWriteOnce
  36. {{- if or (eq "ReadWriteOnce" .Values.mastodon.persistence.assets.accessMode) (eq "ReadWriteOnce" .Values.mastodon.persistence.system.accessMode) }}
  37. affinity:
  38. podAffinity:
  39. requiredDuringSchedulingIgnoredDuringExecution:
  40. - labelSelector:
  41. matchExpressions:
  42. - key: component
  43. operator: In
  44. values:
  45. - rails
  46. topologyKey: kubernetes.io/hostname
  47. {{- end }}
  48. volumes:
  49. - name: assets
  50. persistentVolumeClaim:
  51. claimName: {{ template "mastodon.fullname" . }}-assets
  52. - name: system
  53. persistentVolumeClaim:
  54. claimName: {{ template "mastodon.fullname" . }}-system
  55. containers:
  56. - name: {{ .Chart.Name }}
  57. securityContext:
  58. {{- toYaml .Values.securityContext | nindent 12 }}
  59. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  60. imagePullPolicy: {{ .Values.image.pullPolicy }}
  61. command:
  62. - bundle
  63. - exec
  64. - sidekiq
  65. - -c
  66. - {{ .Values.mastodon.sidekiq.concurrency | quote }}
  67. envFrom:
  68. - configMapRef:
  69. name: {{ include "mastodon.fullname" . }}-env
  70. - secretRef:
  71. name: {{ template "mastodon.fullname" . }}
  72. env:
  73. - name: "DB_PASS"
  74. valueFrom:
  75. secretKeyRef:
  76. {{- if .Values.postgresql.enabled }}
  77. name: {{ .Release.Name }}-postgresql
  78. {{- else }}
  79. name: {{ template "mastodon.fullname" . }}
  80. {{- end }}
  81. key: postgresql-password
  82. - name: "REDIS_PASSWORD"
  83. valueFrom:
  84. secretKeyRef:
  85. name: {{ .Release.Name }}-redis
  86. key: redis-password
  87. volumeMounts:
  88. - name: assets
  89. mountPath: /opt/mastodon/public/assets
  90. - name: system
  91. mountPath: /opt/mastodon/public/system
  92. resources:
  93. {{- toYaml .Values.resources | nindent 12 }}
  94. {{- with .Values.nodeSelector }}
  95. nodeSelector:
  96. {{- toYaml . | nindent 8 }}
  97. {{- end }}
  98. {{- with .Values.tolerations }}
  99. tolerations:
  100. {{- toYaml . | nindent 8 }}
  101. {{- end }}