Refactor: move CE project selection to job creation time#2109
Open
ElePT wants to merge 4 commits into
Open
Conversation
…election logic from the FleetsRunner.
…ead of get_or_assign_project
…at didn't really provide the functionality we needed. The new implementation updates the management command and supports both single and multi zone setups.
40e5eff to
0081b73
Compare
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 PR is built on top of the changes from #2108 and is currently blocked by it.
Up until now the gateway selected a Code Engine project the first time the scheduler touched a job, deep inside
FleetsRunner. This PR moves that decision toRunJobSerializer.create(), the moment the job is written to the database.The zone-lookup logic (reading
FLEETS_PROFILE_ZONE_MAPand queryingCodeEngineProjectby zone) moves into a newselect_ce_project()helper incore/model_managers/. The serializer calls it for every Fleets job and writes the chosen project onto the job record in the same save, so the runner never has to figure this out. If no suitable project exists the API returns a 400 right away instead of the job sitting in the queue and failing later.On the runner side,
_get_or_assign_project()is replaced by a much simpler_get_project()that just reads and validates whatever the serializer already put there.Details and comments
This PR also fixes the
sync_ce_projectmanagement command to define two separate initialization paths:CE_ZONElets single-project deployments pin their project to an availability zone, andCE_PROJECTSaccepts a JSON array for multi-zone setups where each zone has its own CE project.