File tree Expand file tree Collapse file tree 6 files changed +39
-1
lines changed Expand file tree Collapse file tree 6 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ const Env = z.object({
90
90
KUBERNETES_MEMORY_REQUEST_MIN_GB : z . coerce . number ( ) . min ( 0 ) . default ( 0 ) ,
91
91
KUBERNETES_MEMORY_REQUEST_RATIO : z . coerce . number ( ) . min ( 0 ) . max ( 1 ) . default ( 1 ) , // Ratio of memory limit, so 1 = 100% of memory limit
92
92
KUBERNETES_MEMORY_OVERHEAD_GB : z . coerce . number ( ) . min ( 0 ) . optional ( ) , // Optional memory overhead to add to the limit in GB
93
+ KUBERNETES_TOPOLOGY_SPREAD_CONSTRAINTS : z . string ( ) . optional ( ) , // JSON string
93
94
94
95
// Placement tags settings
95
96
PLACEMENT_TAGS_ENABLED : BoolEnv . default ( false ) ,
Original file line number Diff line number Diff line change @@ -56,6 +56,22 @@ export class KubernetesWorkloadManager implements WorkloadManager {
56
56
} ;
57
57
}
58
58
59
+ private parseTopologySpreadConstraints ( ) : k8s . V1TopologySpreadConstraint [ ] | null {
60
+ if ( ! env . KUBERNETES_TOPOLOGY_SPREAD_CONSTRAINTS ) {
61
+ return null ;
62
+ }
63
+
64
+ try {
65
+ return JSON . parse ( env . KUBERNETES_TOPOLOGY_SPREAD_CONSTRAINTS ) ;
66
+ } catch ( error ) {
67
+ this . logger . error ( "[KubernetesWorkloadManager] Failed to parse topology spread constraints" , {
68
+ error : error instanceof Error ? error . message : String ( error ) ,
69
+ raw : env . KUBERNETES_TOPOLOGY_SPREAD_CONSTRAINTS ,
70
+ } ) ;
71
+ return null ;
72
+ }
73
+ }
74
+
59
75
private stripImageDigest ( imageRef : string ) : string {
60
76
if ( ! env . KUBERNETES_STRIP_IMAGE_DIGEST ) {
61
77
return imageRef ;
@@ -270,6 +286,8 @@ export class KubernetesWorkloadManager implements WorkloadManager {
270
286
}
271
287
272
288
get #defaultPodSpec( ) : Omit < k8s . V1PodSpec , "containers" > {
289
+ const topologySpreadConstraints = this . parseTopologySpreadConstraints ( ) ;
290
+
273
291
return {
274
292
restartPolicy : "Never" ,
275
293
automountServiceAccountToken : false ,
@@ -281,6 +299,7 @@ export class KubernetesWorkloadManager implements WorkloadManager {
281
299
} ,
282
300
}
283
301
: { } ) ,
302
+ ...( topologySpreadConstraints ? { topologySpreadConstraints } : { } ) ,
284
303
} ;
285
304
}
286
305
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ apiVersion: v2
2
2
name : trigger
3
3
description : The official Trigger.dev Helm chart
4
4
type : application
5
- version : 4.0.1
5
+ version : 4.0.2
6
6
appVersion : v4.0.4
7
7
home : https://trigger.dev
8
8
sources :
Original file line number Diff line number Diff line change @@ -184,6 +184,10 @@ spec:
184
184
value : {{ default "10Gi" .Values.supervisor.config.kubernetes.ephemeralStorageSizeLimit | quote }}
185
185
- name : KUBERNETES_EPHEMERAL_STORAGE_SIZE_REQUEST
186
186
value : {{ default "2Gi" .Values.supervisor.config.kubernetes.ephemeralStorageSizeRequest | quote }}
187
+ {{- with .Values.supervisor.config.kubernetes.topologySpreadConstraints }}
188
+ - name : KUBERNETES_WORKER_TOPOLOGY_SPREAD_CONSTRAINTS
189
+ value : {{ tpl (toYaml .) $ | toJson | quote }}
190
+ {{- end }}
187
191
# Pod cleaner configuration
188
192
- name : POD_CLEANER_ENABLED
189
193
value : {{ .Values.supervisor.config.podCleaner.enabled | quote }}
@@ -272,6 +276,10 @@ spec:
272
276
tolerations :
273
277
{{- toYaml . | nindent 8 }}
274
278
{{- end }}
279
+ {{- with .Values.supervisor.topologySpreadConstraints }}
280
+ topologySpreadConstraints :
281
+ {{- tpl (toYaml .) $ | nindent 8 }}
282
+ {{- end }}
275
283
---
276
284
apiVersion : v1
277
285
kind : Service
Original file line number Diff line number Diff line change @@ -419,6 +419,10 @@ spec:
419
419
tolerations :
420
420
{{- toYaml . | nindent 8 }}
421
421
{{- end }}
422
+ {{- with .Values.webapp.topologySpreadConstraints }}
423
+ topologySpreadConstraints :
424
+ {{- tpl (toYaml .) $ | nindent 8 }}
425
+ {{- end }}
422
426
---
423
427
apiVersion : v1
424
428
kind : Service
Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ webapp:
69
69
nodeSelector : {}
70
70
tolerations : []
71
71
affinity : {}
72
+ # Topology Spread Constraints for pod assignment spread across your cluster among failure-domains. Evaluated as a template
73
+ topologySpreadConstraints : []
72
74
73
75
logLevel : " info"
74
76
gracefulShutdownTimeout : 1000
@@ -263,6 +265,8 @@ supervisor:
263
265
workerNodetypeLabel : " " # When set, runs will only be scheduled on nodes with "nodetype=<label>"
264
266
ephemeralStorageSizeLimit : " " # Default: 10Gi
265
267
ephemeralStorageSizeRequest : " " # Default: 2Gi´
268
+ # Topology Spread Constraints for worker pods created by the supervisor. Evaluated as a template
269
+ topologySpreadConstraints : []
266
270
podCleaner :
267
271
enabled : true
268
272
batchSize : 100
@@ -353,6 +357,8 @@ supervisor:
353
357
nodeSelector : {}
354
358
tolerations : []
355
359
affinity : {}
360
+ # Topology Spread Constraints for pod assignment spread across your cluster among failure-domains. Evaluated as a template
361
+ topologySpreadConstraints : []
356
362
357
363
# PostgreSQL configuration
358
364
# Subchart: https://github.com/bitnami/charts/tree/main/bitnami/postgresql
You can’t perform that action at this time.
0 commit comments