Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(agent): scale down using agent shutdown hook #22

Closed
wants to merge 11 commits into from
Prev Previous commit
Next Next commit
make idle timeout configurable
  • Loading branch information
lucaspin committed Dec 6, 2023
commit 05d058aaa7d2912c71de1be158fdf498e0bce637
2 changes: 1 addition & 1 deletion charts/agent/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ stringData:
{{- end }}
{{- if .Values.agent.autoscaling.enabled }}
shutdown-hook-path: /opt/semaphore/shutdown-hook
disconnect-after-idle-timeout: 120
disconnect-after-idle-timeout: {{ .Values.agent.autoscaling.idleTimeoutForScaleDown }}
{{- end }}

{{- if and .Values.jobs.preJobHook.enabled .Values.jobs.preJobHook.customScript }}
Expand Down
4 changes: 4 additions & 0 deletions charts/agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ agent:
min: 1
max: 10

# The deployment will be scaled down every time an agent becomes idle.
# By default, agents become idle after 30m of waiting for jobs, and not getting any.
idleTimeoutForScaleDown: 1800

# Controls the HPA's scaleUp behavior, and controls how fast agents are scaled up.
# By default, we either increase the number of pods by 200% or by 10, whatever is greatest, every 30s.
# See: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior
Expand Down