deployment-sidekiq.yaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. app.kubernetes.io/component: sidekiq
  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: sidekiq
  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. # ensure we run on the same node as the other rails components; only
  40. # required when using PVCs that are ReadWriteOnce
  41. {{- if or (eq "ReadWriteOnce" .Values.mastodon.persistence.assets.accessMode) (eq "ReadWriteOnce" .Values.mastodon.persistence.system.accessMode) }}
  42. affinity:
  43. podAffinity:
  44. requiredDuringSchedulingIgnoredDuringExecution:
  45. - labelSelector:
  46. matchExpressions:
  47. - key: app.kubernetes.io/part-of
  48. operator: In
  49. values:
  50. - rails
  51. topologyKey: kubernetes.io/hostname
  52. {{- end }}
  53. volumes:
  54. - name: assets
  55. persistentVolumeClaim:
  56. claimName: {{ template "mastodon.fullname" . }}-assets
  57. - name: system
  58. persistentVolumeClaim:
  59. claimName: {{ template "mastodon.fullname" . }}-system
  60. {{- end }}
  61. containers:
  62. - name: {{ .Chart.Name }}
  63. securityContext:
  64. {{- toYaml .Values.securityContext | nindent 12 }}
  65. image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  66. imagePullPolicy: {{ .Values.image.pullPolicy }}
  67. command:
  68. - bundle
  69. - exec
  70. - sidekiq
  71. - -c
  72. - {{ .Values.mastodon.sidekiq.concurrency | quote }}
  73. envFrom:
  74. - configMapRef:
  75. name: {{ include "mastodon.fullname" . }}-env
  76. - secretRef:
  77. name: {{ template "mastodon.secretName" . }}
  78. env:
  79. - name: "DB_PASS"
  80. valueFrom:
  81. secretKeyRef:
  82. name: {{ template "mastodon.postgresql.secretName" . }}
  83. key: password
  84. - name: "REDIS_PASSWORD"
  85. valueFrom:
  86. secretKeyRef:
  87. name: {{ template "mastodon.redis.secretName" . }}
  88. key: redis-password
  89. {{- if (and .Values.mastodon.s3.enabled .Values.mastodon.s3.existingSecret) }}
  90. - name: "AWS_SECRET_ACCESS_KEY"
  91. valueFrom:
  92. secretKeyRef:
  93. name: {{ .Values.mastodon.s3.existingSecret }}
  94. key: AWS_SECRET_ACCESS_KEY
  95. - name: "AWS_ACCESS_KEY_ID"
  96. valueFrom:
  97. secretKeyRef:
  98. name: {{ .Values.mastodon.s3.existingSecret }}
  99. key: AWS_ACCESS_KEY_ID
  100. {{- end }}
  101. {{- if .Values.mastodon.smtp.existingSecret }}
  102. - name: "SMTP_LOGIN"
  103. valueFrom:
  104. secretKeyRef:
  105. name: {{ .Values.mastodon.smtp.existingSecret }}
  106. key: login
  107. optional: true
  108. - name: "SMTP_PASSWORD"
  109. valueFrom:
  110. secretKeyRef:
  111. name: {{ .Values.mastodon.smtp.existingSecret }}
  112. key: password
  113. {{- end }}
  114. {{- if (not .Values.mastodon.s3.enabled) }}
  115. volumeMounts:
  116. - name: assets
  117. mountPath: /opt/mastodon/public/assets
  118. - name: system
  119. mountPath: /opt/mastodon/public/system
  120. {{- end }}
  121. resources:
  122. {{- toYaml .Values.resources | nindent 12 }}
  123. {{- with .Values.nodeSelector }}
  124. nodeSelector:
  125. {{- toYaml . | nindent 8 }}
  126. {{- end }}
  127. {{- with .Values.tolerations }}
  128. tolerations:
  129. {{- toYaml . | nindent 8 }}
  130. {{- end }}