Repository navigation
Support reloading TSA worker keys via SIGHUP signal - #5652
Conversation
0d59a2e to
ae3f297
Compare
|
IDK how the documentation part works, but I would suggest to comment it somewhere as if not it's a hidden feature hehe. Could potentially be commented on the |
|
@gaelL I'm having trouble testing this feature out, and require some help. I'm bringing up this build via docker-compose. When I send Could you validate the feature on your end, and tell me the exact steps for doing so? Thanks. |
|
@muntac this is how I test it: This PR add a new goroutine on web/atc/tsa process. This goroutine will "run" each time it catch a The goroutine code contain one logger line Basic test with AuthorizedKeysI simply run docker compose in one term. And in another term I run a kill signal on the concourse web process : docker-compose updocker exec -it concourse_web_1 bash -c 'kill -s SIGHUP $(pgrep concourse)'In my docker compose term I have the following log displayed each time I send the kill signal: As noticed, this log line is the expected one. Second test with authorizedKeys using team yaml fileFor this it require a little patch to configure Concourse web to read the TEAM_AUTHORIZED_KEYS_FILE. But also a little change to generate the file for our test: I add a new env var in docker compose to configure the usage of TEAM_AUTHORIZED_KEYS_FILE. Same as above we expect the log line let's test it: Output expected: Let me know if you need more details or help to test it. |
|
@gaelL Thanks a lot! I kept making the basic mistake of sending the signal to the Anyway, it works for me now. I'm going to request some changes to the comments and then we should be good to go. Thanks for your patience. |
|
Lastly, this would benefit from being mentioned in the docs as @xescugc suggested. It seems most appropriate as a subsection under the operating a web node section. This would involve a PR to the docs repo and the change would be in here. @gaelL Let me know if you are able to get around to that. Otherwise, I can try updating it myself. |
|
thanks for this review. I will give a try with the doc |
|
On ce04b9f you renamed When |
|
Thanks, the code have been fixed and tested again. I'm waiting while I create and push in // the doc PR before doing a last rebase of this PR |
5d2b2f7 to
656e9f0
Compare
Fix concourse#1105 : TSA should support reloading authorized keys without restart This commit give the ability for a user to send a signal to Concourse web process to reload the keys in authorized keys files. eg ``` kill -s SIGHUP <PID of Concourse web> ``` Signed-off-by: gaelL <[email protected]>
Signed-off-by: gaelL <[email protected]>
Signed-off-by: gaelL <[email protected]>
Signed-off-by: gaelL <[email protected]>
Co-authored-by: Muntasir Chowdhury <[email protected]> Signed-off-by: gaelL <[email protected]>
Signed-off-by: gaelL <[email protected]>
|
Just realized we should write some sort of test for this feature. One option is to do it in the acceptance test suite, topgun. In Still thinking through if this is the best place to test. |
|
I think you should actually be able to exercise this using similar setup/helpers to |
|
FYI I created the Doc pull request related to this one : concourse/docs#339 I will try to have a look on tests. It indeed does not look that easy to test. Any leads or help are welcome on this part :p |
There was a problem hiding this comment.
@gaelL I thought about this a bit more.
An integration test would not be possible. We can get a TSA process going via Ifrit, and send a signal. But we won't be able to inspect the Authorized keys object within ifrit to see if it has changed.
The only way of validating it is running an acceptance test that basically tests out the scenario that originally called for this solution i.e. validate if we can bring up an additional worker and get it to talk to the TSA after updating and reloading the authorized keys. That would be a significant amount of work, especially relative to the size of the change.
Considering all that, the add-on nature of this feature, and the immediate benefits it would provide I'm okay with merging this in its current state. Thanks again for the contribution.
|
@muntac Thanks for your help on this pull request 👍 |
SIGHUP signal
Why is this PR needed?
This pull request fix the issue #1105 by adding TSA support for reloading authorized keys without restart based on signal
SIGUSR1As described in #1105 and #3551 it is really handy for HA purpose to be able to add worker keys without having to restart a Concourse web/TSA process.
It also rely on this pull request that have been merged concourse/flag#5
What is this PR trying to accomplish?
Provide a solution for user to dynamically add or remove worker keys without having to restart Concourse.
closes #1105 .
How does it accomplish that?
I choose to use signal
SIGHUPthat any user can send with the following command:The implementation is really simple and for a user point of view it's really easy to send this signal to concourse when you update any authorized keys file.
Signal usage have been inspired by Concourse worker process https://concourse-ci.org/concourse-worker.html#restarting-a-worker
Contributor Checklist
Let's discuss about those points if the technical solution is approved.
Reviewer Checklist
and Helm packaging; otherwise, ignored for the integration tests (for example, if they are Garden configs that are not displayed in the
--helptext).