repocho commented on a change in pull request #17537:
URL: https://github.com/apache/airflow/pull/17537#discussion_r690104400
##########
File path: airflow/kubernetes/pod_generator.py
##########
@@ -287,7 +287,8 @@ def reconcile_specs(
client_spec.containers = PodGenerator.reconcile_containers(
base_spec.containers, client_spec.containers
)
- merged_spec = extend_object_field(base_spec, client_spec,
'volumes')
+ merged_spec = extend_object_field(base_spec, client_spec,
'init_containers')
+ merged_spec = extend_object_field(base_spec, merged_spec,
'volumes')
Review comment:
I'm not an expert in python, but looking into the function
`extend_object_field` it seems that is returning a copy and not changing any of
the arguments. So I don't know exactly how reconcile_metatadata is working but
if I change the code to this:
```
extend_object_field(base_spec, client_spec, 'init_containers')
extend_object_field(base_spec, client_spec, 'volumes')
return merge_objects(base_spec, client_spec)
```
The test fails:
`tests/kubernetes/test_pod_generator.py::TestPodGenerator::test_reconcile_specs_init_containers
FAILED [ 96%]`
I've thinking another less confusing code and it could be this:
```
extended_spec = copy.deepcopy(client_spec)
extended_spec = extend_object_field(base_spec, extended_spec,
'init_containers')
extended_spec = extend_object_field(base_spec, extended_spec,
'volumes')
return merge_objects(base_spec, extended_spec)
```
What do you think?
Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]