Repository navigation
Add --gce_max_run_duration and --gce_instance_termination_action - #7202
Open
thestephenromano wants to merge 1 commit into
Open
thestephenromano wants to merge 1 commit into
thestephenromano wants to merge 1 commit into
Conversation
GCE can delete or stop an instance after a fixed lifetime, enforced by the provider independently of PKB. GCE accepts the limit only when the instance is created (instances set-scheduling refuses it on a running instance), so it has to be part of the create command. This exposes it as two flags, applied in _GenerateCreateCommand and recorded in the VM metadata, in the same way as --gce_provisioning_model.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds
--gce_max_run_duration(seconds, at least 30) and--gce_instance_termination_action(DELETEby default, orSTOP).When the duration is set, PKB passes
--max-run-durationand--instance-termination-actiontogcloud compute instances create. GCE then deletes or stops the instance after that lifetime, whether or not PKB is still running. Both values are recorded in the VM's resource metadata. The flags follow--gce_provisioning_model: applied in_GenerateCreateCommandand reported inGetResourceMetadata.Why
PKB's own timeout handling depends on the controller staying alive. A provider-side lifetime bounds cost and leftover instances when the controller is killed, loses connectivity, or crashes during a long run.
GCE accepts the limit only at creation:
gcloud compute instances set-scheduling --max-run-durationon a running instance fails with "Max run duration cannot be changed while the instance is running". So it can't be added after PKB has created the VM, and it has to go into the create command.Tests
tests/gce_virtual_machine_test.pygains three cases:DELETEaction;STOPaction;All 100 tests in that file pass. I also tested the same create-time flags live on GCE: an instance created with a one-hour limit and
DELETEwas deleted by GCE (compute.instances.deferredDeletebysystem) one hour after its insert, after the controlling PKB process had been killed.