Skip to content

Commit

Permalink
Merge pull request #78 from invakid404/main
Browse files Browse the repository at this point in the history
feat: allow deploying worker groups as statefulsets
  • Loading branch information
rubenfiszel authored Jan 24, 2025
2 parents 71bbef0 + deadbd1 commit d66f503
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 6 deletions.
13 changes: 13 additions & 0 deletions charts/windmill/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,16 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Validate controller kind, defaulting to "Deployment"
*/}}
{{- define "validateControllerKind" -}}
{{- $validTypes := list "Deployment" "StatefulSet" -}}
{{- $inputType := default "Deployment" . -}}
{{- if has $inputType $validTypes -}}
{{ $inputType }}
{{- else -}}
{{- fail (printf "Invalid controller type: %s. Must be either Deployment or StatefulSet" $inputType) -}}
{{- end -}}
{{- end -}}
17 changes: 16 additions & 1 deletion charts/windmill/templates/worker-groups.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{{- range $v := .Values.windmill.workerGroups }}
{{ if and $v.replicas (gt (int $v.replicas) 0)}}
---
{{- $controllerType := include "validateControllerKind" $v.controller }}
apiVersion: apps/v1
kind: Deployment
kind: {{ $controllerType }}
metadata:
name: windmill-workers-{{ $v.name }}
labels:
Expand All @@ -14,11 +15,19 @@ metadata:
workerGroup: {{ $v.name }}
spec:
replicas: {{ $v.replicas }}
{{- if eq $controllerType "Deployment" }}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 3
maxUnavailable: 0
{{- else if eq $controllerType "StatefulSet" }}
serviceName: windmill-workers-{{ $v.name }}
updateStrategy:
type: RollingUpdate
rollingUpdate:
partition: 0
{{- end }}
selector:
matchLabels:
app: windmill-workers
Expand Down Expand Up @@ -184,5 +193,11 @@ spec:
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if eq $controllerType "StatefulSet" }}
{{- if $v.volumeClaimTemplates }}
volumeClaimTemplates:
{{- toYaml $v.volumeClaimTemplates | nindent 2 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
24 changes: 19 additions & 5 deletions charts/windmill/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ windmill:
# workers configuration
# The default worker group
- name: "default"
# -- Controller to use. Valid options are "Deployment" and "StatefulSet"
controller: "Deployment"

replicas: 3
# -- Annotations to apply to the pods
annotations: {}
Expand All @@ -98,7 +101,6 @@ windmill:
# -- Security context to apply to the pod
containerSecurityContext: {}


# -- Affinity rules to apply to the pods
affinity: {}

Expand All @@ -118,13 +120,19 @@ windmill:
volumes: []
volumeMounts: []

# -- Volume claim templates. Only applies when controller is "StatefulSet"
volumeClaimTemplates: []

# -- command override
command: []

# -- mount the docker socket inside the container to be able to run docker command as docker client to the host docker daemon
exposeHostDocker: false

- name: "native"
# -- Controller to use. Valid options are "Deployment" and "StatefulSet"
controller: "Deployment"

replicas: 1
# -- Annotations to apply to the pods
annotations: {}
Expand All @@ -147,7 +155,6 @@ windmill:
# -- Security context to apply to the pod
containerSecurityContext: {}


# -- Affinity rules to apply to the pods
affinity: {}

Expand All @@ -173,7 +180,13 @@ windmill:
# -- mount the docker socket inside the container to be able to run docker command as docker client to the host docker daemon
exposeHostDocker: false

# -- Volume claim templates. Only applies when controller is "StatefulSet"
volumeClaimTemplates: []

- name: "gpu"
# -- Controller to use. Valid options are "Deployment" and "StatefulSet"
controller: "Deployment"

replicas: 0
# -- Annotations to apply to the pods
annotations: {}
Expand All @@ -196,7 +209,6 @@ windmill:
# -- Security context to apply to the pod
containerSecurityContext: {}


# -- Affinity rules to apply to the pods
affinity: {}

Expand All @@ -218,6 +230,9 @@ windmill:

# -- mount the docker socket inside the container to be able to run docker command as docker client to the host docker daemon
exposeHostDocker: false

# -- Volume claim templates. Only applies when controller is "StatefulSet"
volumeClaimTemplates: []
# app configuration
app:
# -- Annotations to apply to the pods
Expand Down Expand Up @@ -263,7 +278,7 @@ windmill:
volumes: []

volumeMounts: []

# app autoscaling configuration
autoscaling:
# -- enable or disable autoscaling
Expand All @@ -285,7 +300,6 @@ windmill:
# -- annotations to apply to the service
annotations: {}


# lsp configuration
lsp:
tag: "latest"
Expand Down

0 comments on commit d66f503

Please sign in to comment.