-
Notifications
You must be signed in to change notification settings - Fork 48
Handle OS interrupts in lokoctl to fix leaking terraform process. #483
Conversation
f765f95
to
09d7f89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts, please have a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some partial review I did the other day.
After a call with @invidian we found out that An upstream issue has been filed for the same. |
09d7f89
to
0800591
Compare
7530cbb
to
84da10b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some nits and a general comment.
From my testing it seems when I interrupt lokoctl at, say, terraform init
this doesn't stop lokoctl. I'm aware terraform init doesn't handle interrupts but I would expect lokoctl to stop after terraform init
is finished instead of continuing with the next steps (terraform plan
and so on). This works fine if I do two interrupts for example when terraform plan
is running, I guess because the process ends with exit status 1 and we propagate the error.
Should we add a channel to send interrupt information from the signal handler to the Executor
so we can os.Exit()
or error out after the command is finished if we get an interrupt?
It would become quite messy, besides there would be two branches where it would be handle the differently if the current process is Nevertheless, I am opening up a follow up issue that tracks this limitation and and will also link the upstream issue in the follow up issue. |
- Fix issue #329, to handle OS interrupts. - signalHandler returns an instance of handler, currently we only deal with the signal os.Interrupt. - stop terminates listening of interrupts once the terraform process has released its resources by either successful exit for forced termination. This way there are no leaking terraform processes. Signed-off-by: Imran Pochi <imran@kinvolk.io>
84da10b
to
9fbbd02
Compare
- Registers signal handler for the terraform command. Signed-off-by: Imran Pochi <imran@kinvolk.io>
Signed-off-by: Imran Pochi <imran@kinvolk.io>
9fbbd02
to
5997c39
Compare
Follow up issue created #555 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Addressed your feedback, follow up issue created, please re-review changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Fixes #329
Registers a Signal handler for terraform process and components installation/deletion.
Before running the
lokoctl cluster apply
After Ctrl + C