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.

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