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

(DIO-2675) Undo pool size & template overrides #461

Merged
merged 2 commits into from
Nov 4, 2021
Merged

(DIO-2675) Undo pool size & template overrides #461

merged 2 commits into from
Nov 4, 2021

Conversation

genebean
Copy link
Contributor

@genebean genebean commented Oct 14, 2021

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.

@genebean genebean force-pushed the dio2675 branch 4 times, most recently from 6bf0c8a to 4d90d46 Compare October 14, 2021 20:52
@genebean genebean requested a review from mattkirby October 14, 2021 20:53
@genebean genebean marked this pull request as ready for review October 14, 2021 20:53
@genebean genebean requested a review from a team as a code owner October 14, 2021 20:53
@genebean genebean marked this pull request as draft October 18, 2021 15:20
@genebean
Copy link
Contributor Author

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.

@genebean genebean force-pushed the dio2675 branch 5 times, most recently from fb05341 to 069c12d Compare October 27, 2021 20:18
@genebean genebean changed the title (DIO-2675) Undo pool size template overrides (DIO-2675) Undo pool size & template overrides Oct 27, 2021
@genebean genebean marked this pull request as ready for review October 27, 2021 20:32
docs/API.md Outdated Show resolved Hide resolved
docs/API.md Show resolved Hide resolved
docs/API.md Outdated Show resolved Hide resolved
docs/API.md Show resolved Hide resolved
lib/vmpooler/api/v1.rb Outdated Show resolved Hide resolved
@genebean
Copy link
Contributor Author

genebean commented Nov 2, 2021

@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'
Copy link
Contributor

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])
Copy link
Contributor

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

Suggested change
serialized_pools = Marshal.dump(parsed_config[:pools])
parsed_config[:pools_at_startup] = Marshal.load(Marshal.dump(parsed_config[:pools]))

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 think the one liner is a little hard to follow, personally

docker/Dockerfile_local Outdated Show resolved Hide resolved
lib/vmpooler/api/v1.rb Outdated Show resolved Hide resolved
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.
@genebean genebean merged commit e24fa97 into master Nov 4, 2021
@genebean genebean deleted the dio2675 branch November 4, 2021 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants