<#6262 Rework MergePodSpecs logic> Pull request op...
# flyte-github
c
#6262 Rework MergePodSpecs logic Pull request opened by Sovietaced Tracking issue Related to #6232 This pull request is a follow up to #6232 which introduced some regressions for pod templates with init containers. Why are the changes needed? We discovered a bug where init containers from pod templates were being injected into tasks which had no init containers. This is because of an out of order merge of the task pod spec onto the pod template spec. What changes were proposed in this pull request? Fundamentally,
MergePodSpecs
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/flyte