Skip to content

feat: add terminationGracePeriodSeconds to provisioner chart #9048

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

Merged
merged 5 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions enterprise/cli/provisionerdaemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ func (r *RootCmd) provisionerDaemonStart() *clibase.Cmd {
cliui.Errorf(inv.Stderr, "Unexpected error, shutting down server: %s\n", exitErr)
}

shutdown, shutdownCancel := context.WithTimeout(ctx, time.Minute)
defer shutdownCancel()
err = srv.Shutdown(shutdown)
err = srv.Shutdown(ctx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What effect will this have outside of a Kubernetes environment if we have a build in progress that just hangs indefinitely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will do what we describe earlier in this file:

"Interrupt caught, gracefully exiting. Use ctrl+\\ to force quit", that is, we'll wait indefinitely until we get a more aggressive signal like SIGQUIT (ctrl + \) or SIGKILL.

if err != nil {
return xerrors.Errorf("shutdown: %w", err)
}
Expand Down
1 change: 1 addition & 0 deletions helm/provisioner/templates/_coder.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Deployment to merge into the libcoder template
spec:
template:
spec:
terminationGracePeriodSeconds: {{ .Values.provisionerDaemon.terminationGracePeriodSeconds }}
containers:
-
{{ include "libcoder.containerspec" (list . "coder.containerspec") | indent 8}}
Expand Down
2 changes: 1 addition & 1 deletion helm/provisioner/tests/testdata/command.golden
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,5 @@ spec:
volumeMounts: []
restartPolicy: Always
serviceAccountName: coder-provisioner
terminationGracePeriodSeconds: 60
terminationGracePeriodSeconds: 600
volumes: []
2 changes: 1 addition & 1 deletion helm/provisioner/tests/testdata/command_args.golden
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,5 @@ spec:
volumeMounts: []
restartPolicy: Always
serviceAccountName: coder-provisioner
terminationGracePeriodSeconds: 60
terminationGracePeriodSeconds: 600
volumes: []
2 changes: 1 addition & 1 deletion helm/provisioner/tests/testdata/default_values.golden
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,5 @@ spec:
volumeMounts: []
restartPolicy: Always
serviceAccountName: coder-provisioner
terminationGracePeriodSeconds: 60
terminationGracePeriodSeconds: 600
volumes: []
2 changes: 1 addition & 1 deletion helm/provisioner/tests/testdata/labels_annotations.golden
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,5 @@ spec:
volumeMounts: []
restartPolicy: Always
serviceAccountName: coder-provisioner
terminationGracePeriodSeconds: 60
terminationGracePeriodSeconds: 600
volumes: []
2 changes: 1 addition & 1 deletion helm/provisioner/tests/testdata/provisionerd_psk.golden
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,5 @@ spec:
volumeMounts: []
restartPolicy: Always
serviceAccountName: coder-provisioner
terminationGracePeriodSeconds: 60
terminationGracePeriodSeconds: 600
volumes: []
2 changes: 1 addition & 1 deletion helm/provisioner/tests/testdata/sa.golden
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ spec:
volumeMounts: []
restartPolicy: Always
serviceAccountName: coder-service-account
terminationGracePeriodSeconds: 60
terminationGracePeriodSeconds: 600
volumes: []
5 changes: 5 additions & 0 deletions helm/provisioner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,8 @@ provisionerDaemon:
{}
# location: usa
# provider: kubernetes

# provisionerDaemon.terminationGracePeriodSeconds -- Time in seconds that Kubernetes should wait before forcibly
# terminating the provisioner daemon. You should set this to be longer than your longest expected build time so that
# redeployments do not interrupt builds in progress.
terminationGracePeriodSeconds: 600