-
Notifications
You must be signed in to change notification settings - Fork 48
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
(DIO-2675) Undo pool size & template overrides #461
Conversation
6bf0c8a
to
4d90d46
Compare
The initial method I used to accomplish this would clean up things in redis but would not update the running config properly. I move the PR back to draft and am reworking some aspects of it. |
fb05341
to
069c12d
Compare
@sbeaulie I think this is ready for another review. |
it 'the copy is a separate object and not a reference' do | ||
Dir.chdir(fixtures_dir) do | ||
configuration = Vmpooler.config | ||
configuration[:pools][0]['template'] = 'sam' |
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.
lolz
# rubocop:disable Security/MarshalLoad | ||
|
||
# retain a copy of the pools that were observed at startup | ||
serialized_pools = Marshal.dump(parsed_config[:pools]) |
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.
could do one liner here
serialized_pools = Marshal.dump(parsed_config[:pools]) | |
parsed_config[:pools_at_startup] = Marshal.load(Marshal.dump(parsed_config[:pools])) |
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.
It think the one liner is a little hard to follow, personally
This makes it so that cached layers can be used when all that is changing is VMPooler's code, and not its gems.
This implements a delete method for pooltemplate and poolsize. The API removes the override from Redis and then adds an entry in Redis that causes the pool manager to wake up and process the removal of the override. To facilitate this, a new variable has been created in lib/vmpooler.rb to hold a copy of the original / pre-override config. This supplemental copy of the pools is then indexed for use as a reference. When pool manager wakes up to process an override removal, it looks up the pre-override value from the config via the new variables mentioned above. Just as with entering overrides, no restart is needed. Template and pool size changes are logged so that anyone watching or reviewing the logs can see what happened when. The new API endpoints also return values for both the pre-revert and post-revert value.
This implements a delete method for pooltemplate and poolsize. The API removes the override from Redis and then adds an entry in Redis that causes the pool manager to wake up and process the removal of the override.
To facilitate this, a new variable has been created in lib/vmpooler.rb to hold a copy of the original / pre-override config. This supplemental copy of the pools is then indexed for use as a reference.
When pool manager wakes up to process an override removal, it looks up the pre-override value from the config via the new variables mentioned above.
Just as with entering overrides, no restart is needed. Template and pool size changes are logged so that anyone watching or reviewing the logs can see what happened when. The new API endpoints also return values for both the pre-revert and post-revert value.
There is a second commit that also makes it so that Dockerfile_local can use cached layers when all that is changing is VMPooler's code, and not its gems.