You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added pod affinity if the default ReadWriteOnce is used.
If `accessMode` `ReadWriteOnce` is used, then the volume
can only be accessed in a write mode from a single node.
This means that all pods which require write access to
the volume need to be co-located to the same node.
Failing that typically leads to a difficult to untangle
locked volume mount situation where containers are stuck
in `ContainerCreating`.
This change adds the necessary pod affinities if the related
access modes are set in the `values.yaml`.
Copy file name to clipboardExpand all lines: templates/deployment-sidekiq.yaml
+19-3Lines changed: 19 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -45,10 +45,26 @@ spec:
45
45
securityContext:
46
46
{{- toYaml . | nindent 8 }}
47
47
{{- end }}
48
-
{{- with (default (default $context.Values.affinity $context.Values.mastodon.sidekiq.affinity) .affinity) }}
49
48
affinity:
50
-
{{- toYaml . | nindent 8 }}
51
-
{{- end }}
49
+
{{- if (not $context.Values.mastodon.s3.enabled) }}
50
+
{{- if not (default $context.Values.affinity $context.Values.mastodon.sidekiq.affinity).podAffinity }}
51
+
{{- if or (eq "ReadWriteOnce" $context.Values.mastodon.persistence.assets.accessMode) (eq "ReadWriteOnce" $context.Values.mastodon.persistence.system.accessMode) }}
52
+
# the pods need to end up to the same node for ReadWriteOnce
53
+
podAffinity:
54
+
requiredDuringSchedulingIgnoredDuringExecution:
55
+
- labelSelector:
56
+
matchExpressions:
57
+
- key: app.kubernetes.io/part-of
58
+
operator: In
59
+
values:
60
+
- rails
61
+
topologyKey: kubernetes.io/hostname
62
+
{{- end }}
63
+
{{- end }}
64
+
{{- end }}
65
+
{{- with (default $context.Values.affinity $context.Values.mastodon.sidekiq.affinity) }}
66
+
{{- toYaml . | nindent 8 }}
67
+
{{- end }}
52
68
{{- if (not $context.Values.mastodon.s3.enabled) }}
0 commit comments