cuddly-jelly-27016
02/24/2025, 10:37 PMMergePodSpecs is now used for two different use cases but it was originally designed for one:
1. Modifying a base pod spec based on a pod template (and handling magic container names)
2. Overlaying or overriding customized pod specs on top of the base pod spec
MergePodSpecs was originally designed to handle the first use case which gave it some strange behavior when it was used for the second case. Additionally, the signature of MergePodSpecs was documented such that the base pod spec was passed in first and the templates were passed in second but when templates were used they were passed in first which is enormously confusing.
This pull request reworks the two use cases into two different methods and hopes to clean up the semantics of the first use case. Lastly, it adds lots of new test coverage.
How was this patch tested?
Tested in production
Setup process
Screenshots
Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
Related PRs
Docs link
Summary by Bito
This PR refactors pod spec merging functionality by introducing separate methods (MergeBasePodSpecOntoTemplate and MergeOverlayPodSpecOntoBase) while simplifying mergeCustomPodSpec function. The implementation includes clearer error messages, improved template management, and simplified container merging logic. The changes fix bugs in init container handling and enhance pod spec merging semantics with more descriptive error messages for nil pod specs. The test suite provides comprehensive coverage for container handling, scheduler settings, and service account configurations.
Unit tests added: True
Estimated effort to review (1-5, lower is better): 3
flyteorg/flytecuddly-jelly-27016
02/24/2025, 10:37 PM