Skip to content

Commit

Permalink
Allow custom nodeSelector for each resource
Browse files Browse the repository at this point in the history
  • Loading branch information
kinoute committed Sep 30, 2023
1 parent 4b6fd9f commit 740ed27
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ dependencies:
- name: redis
repository: https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami
version: 16.13.2
digest: sha256:17ea58a3264aa22faff18215c4269f47dabae956d0df273c684972f356416193
generated: "2022-08-08T21:44:18.0195364+02:00"
digest: sha256:8be2c8069d65f295d0079bdda67c45691370f7bef73393c2e80eedbdd748b9af
generated: "2023-09-29T16:46:40.462499+02:00"
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ version: 4.0.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: v4.0.2
appVersion: v4.2.0

dependencies:
- name: elasticsearch
Expand Down
4 changes: 4 additions & 0 deletions templates/cronjob-media-remove.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,8 @@ spec:
- name: system
mountPath: /opt/mastodon/public/system
{{- end }}
{{- if .Values.mastodon.cron.removeMedia.nodeSelector }}
nodeSelector:
{{ .Values.mastodon.cron.removeMedia.nodeSelector | toYaml | nindent 12 }}
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions templates/deployment-sidekiq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
{{- end }}
# roll the pods to pick up any db migrations or other changes
{{- include "mastodon.rollingPodAnnotations" $context | nindent 8 }}
checksum/config-secrets: {{ include ( print $.Template.BasePath "/secret-smtp.yaml" ) $context | sha256sum | quote }}
checksum/config-secrets-smtp: {{ include ( print $.Template.BasePath "/secret-smtp.yaml" ) $context | sha256sum | quote }}
labels:
{{- include "mastodon.selectorLabels" $context | nindent 8 }}
app.kubernetes.io/component: sidekiq-{{ .name }}
Expand Down Expand Up @@ -127,9 +127,9 @@ spec:
{{- end }}
resources:
{{- toYaml (default (default $context.Values.resources $context.Values.mastodon.sidekiq.resources) .resources) | nindent 12 }}
{{- with $context.Values.nodeSelector }}
{{- if $context.Values.mastodon.sidekiq.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- $context.Values.mastodon.sidekiq.nodeSelector | toYaml | nindent 8 }}
{{- end }}
{{- with $context.Values.tolerations }}
tolerations:
Expand Down
4 changes: 2 additions & 2 deletions templates/deployment-streaming.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ spec:
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
{{- if .Values.mastodon.streaming.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{ .Values.mastodon.streaming.nodeSelector | toYaml | nindent 8 }}
{{- end }}
{{- with (default .Values.affinity .Values.mastodon.streaming.affinity) }}
affinity:
Expand Down
4 changes: 2 additions & 2 deletions templates/deployment-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ spec:
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
{{- if .Values.mastodon.web.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{ .Values.mastodon.web.nodeSelector | toYaml | nindent 8 }}
{{- end }}
{{- with (default .Values.affinity .Values.mastodon.web.affinity) }}
affinity:
Expand Down
4 changes: 4 additions & 0 deletions templates/job-assets-precompile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ spec:
- name: system
mountPath: /opt/mastodon/public/system
{{- end }}
{{- if .Values.mastodon.assetsPrecompile.nodeSelector }}
nodeSelector:
{{ .Values.mastodon.assetsPrecompile.nodeSelector | toYaml | nindent 8 }}
{{- end }}
4 changes: 4 additions & 0 deletions templates/job-chewy-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,8 @@ spec:
- name: system
mountPath: /opt/mastodon/public/system
{{- end }}
{{- if .Values.mastodon.chewyUpgrade.nodeSelector }}
nodeSelector:
{{ .Values.mastodon.chewyUpgrade.nodeSelector | toYaml | nindent 8 }}
{{- end }}
{{- end }}
4 changes: 4 additions & 0 deletions templates/job-create-admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,8 @@ spec:
- name: system
mountPath: /opt/mastodon/public/system
{{- end }}
{{- if .Values.mastodon.createAdmin.nodeSelector }}
nodeSelector:
{{ .Values.mastodon.createAdmin.nodeSelector | toYaml | nindent 8 }}
{{- end }}
{{- end }}
5 changes: 5 additions & 0 deletions templates/job-db-migrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,8 @@ spec:
- name: system
mountPath: /opt/mastodon/public/system
{{- end }}

{{ if .Values.mastodon.dbMigrate.nodeSelector }}
nodeSelector:
{{ .Values.mastodon.dbMigrate.nodeSelector | toYaml | nindent 8 }}
{{- end }}
106 changes: 81 additions & 25 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ mastodon:
username: not_gargron
# @ignored
email: [email protected]

# Node(s) on which we will deploy this resource
nodeSelector: {}
cron:
# -- run `tootctl media remove` every week
removeMedia:
# @ignored
enabled: true
# @ignored
schedule: "0 0 * * 0"
# -- available locales: https://github.com/mastodon/mastodon/blob/main/config/application.rb#L71

# Node(s) on which we will deploy this resource
nodeSelector: {}
# -- available locales: https://github.com/mastodon/mastodon/blob/main/config/application.rb#L71
locale: en
local_domain: mastodon.local
# -- Use of WEB_DOMAIN requires careful consideration: https://docs.joinmastodon.org/admin/config/#federation
Expand Down Expand Up @@ -94,25 +100,30 @@ mastodon:
# requests:
# cpu: 250m
# memory: 512Mi
# Node(s) on which we will deploy this resource
nodeSelector: {}
workers:
- name: all-queues
# -- Number of threads / parallel sidekiq jobs that are executed per Pod
concurrency: 25
# -- Number of Pod replicas deployed by the Deployment
replicas: 1
# -- Resources for this specific deployment to allow optimised scaling, overwrites .Values.mastodon.sidekiq.resources
resources: {}
# -- Affinity for this specific deployment, overwrites .Values.affinity and .Values.mastodon.sidekiq.affinity
affinity: {}
# -- Sidekiq queues for Mastodon that are handled by this worker. See https://docs.joinmastodon.org/admin/scaling/#concurrency
# See https://github.com/mperham/sidekiq/wiki/Advanced-Options#queues for how to weight queues as argument
queues:
- default,8
- push,6
- ingress,4
- mailers,2
- pull
- scheduler # Make sure the scheduler queue only exists once and with a worker that has 1 replica.
- name: all-queues
# -- Number of threads / parallel sidekiq jobs that are executed per Pod
concurrency: 25
# -- Number of Pod replicas deployed by the Deployment
replicas: 1
# -- Resources for this specific deployment to allow optimised scaling, overwrites .Values.mastodon.sidekiq.resources
resources: {}
# -- Affinity for this specific deployment, overwrites .Values.affinity and .Values.mastodon.sidekiq.affinity
affinity: {}

# -- Node(s) on which we will deploy this resource
nodeSelector: {}
# -- Sidekiq queues for Mastodon that are handled by this worker. See https://docs.joinmastodon.org/admin/scaling/#concurrency
# See https://github.com/mperham/sidekiq/wiki/Advanced-Options#queues for how to weight queues as argument
queues:
- default,8
- push,6
- ingress,4
- mailers,2
- pull
- scheduler # Make sure the scheduler queue only exists once and with a worker that has 1 replica.
#- name: push-pull
# concurrency: 50
# resources: {}
Expand All @@ -135,7 +146,7 @@ mastodon:
ca_file: /etc/ssl/certs/ca-certificates.crt
delivery_method: smtp
domain:
enable_starttls: 'auto'
enable_starttls: "auto"
from_address: [email protected]
return_path:
openssl_verify_mode: peer
Expand Down Expand Up @@ -173,6 +184,9 @@ mastodon:
# requests:
# cpu: 250m
# memory: 128Mi

# -- Node(s) on which we will deploy this resource
nodeSelector: {}
web:
port: 3000
# -- Number of Web Pods running
Expand All @@ -191,13 +205,30 @@ mastodon:
# requests:
# cpu: 250m
# memory: 768Mi

# -- Node(s) on which we will deploy this resource
nodeSelector: {}

# -- Puma-specific options. Below values are based on default behavior in
# config/puma.rb when no custom values are provided.

minThreads: "5"
maxThreads: "5"
workers: "2"
persistentTimeout: "20"

assetsPrecompile:
# Node(s) on which we will deploy this resource
nodeSelector: {}

chewyUpgrade:
# Node(s) on which we will deploy this resource
nodeSelector: {}

dbMigrate:
# Node(s) on which we will deploy this resource
nodeSelector: {}

metrics:
statsd:
# -- Enable statsd publishing via STATSD_ADDR environment variable
Expand Down Expand Up @@ -226,7 +257,7 @@ ingress:
hosts:
- host: mastodon.local
paths:
- path: '/'
- path: "/"
tls:
- secretName: mastodon-tls
hosts:
Expand All @@ -245,6 +276,18 @@ elasticsearch:
image:
tag: 7

# -- Node(s) on which we will deploy this resource
master:
nodeSelector: {}
data:
nodeSelector: {}
coordinating:
nodeSelector: {}
ingest:
nodeSelector: {}
metrics:
nodeSelector: {}

# https://github.com/bitnami/charts/tree/master/bitnami/postgresql#parameters
postgresql:
# -- disable if you want to use an existing db; in which case the values below
Expand All @@ -267,6 +310,15 @@ postgresql:
# with a key of password set to the password you want
existingSecret: ""

# -- Node(s) on which we will deploy this resource
primary:
nodeSelector: {}
readReplicas:
nodeSelector: {}
backup:
cronjob:
nodeSelector: {}

# https://github.com/bitnami/charts/tree/master/bitnami/redis#parameters
redis:
# disable if you want to use an existing redis instance; in which case the
Expand All @@ -282,6 +334,12 @@ redis:
# with a key of redis-password set to the password you want
# existingSecret: ""

# -- Node(s) on which we will deploy this resource
master:
nodeSelector: {}
replica:
nodeSelector: {}

# @ignored
service:
type: ClusterIP
Expand Down Expand Up @@ -425,7 +483,8 @@ revisionPodAnnotation: true
jobAnnotations: {}

# -- Default resources for all Deployments and jobs unless overwritten
resources: {}
resources:
{}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
Expand All @@ -437,9 +496,6 @@ resources: {}
# cpu: 100m
# memory: 128Mi

# @ignored
nodeSelector: {}

# @ignored
tolerations: []

Expand Down

0 comments on commit 740ed27

Please sign in to comment.