dstandish commented on code in PR #27719:
URL: https://github.com/apache/airflow/pull/27719#discussion_r1025613515


##########
airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py:
##########
@@ -326,6 +328,23 @@ def _render_nested_template_fields(
             self._do_render_template_fields(content, ("limits", "requests"), 
context, jinja_env, seen_oids)
             return
 
+        if id(content) not in seen_oids and isinstance(content, k8s.V1Volume):
+            seen_oids.add(id(content))
+            self._do_render_template_fields(
+                content, ("name", "persistent_volume_claim"), context, 
jinja_env, seen_oids
+            )
+            return
+
+        if id(content) not in seen_oids and isinstance(content, 
k8s.V1VolumeMount):
+            seen_oids.add(id(content))
+            self._do_render_template_fields(content, ("name",), context, 
jinja_env, seen_oids)
+            return
+
+        if id(content) not in seen_oids and isinstance(content, 
k8s.V1PersistentVolumeClaimVolumeSource):
+            seen_oids.add(id(content))
+            self._do_render_template_fields(content, ("claim_name",), context, 
jinja_env, seen_oids)
+            return
+

Review Comment:
   ok so.... at this point probably best to simplify / condense a bit
   
   here's what i came up with .
   
   
   you could add your additions to this 
   
   ```python
       def _render_nested_template_fields(
           self,
           content: Any,
           context: Context,
           jinja_env: jinja2.Environment,
           seen_oids: set,
       ) -> None:
           if id(content) not in seen_oids:
               template_fields = None
               if isinstance(content, k8s.V1EnvVar):
                   template_fields = ("value", "name")
               elif isinstance(content, k8s.V1ResourceRequirements):
                   template_fields = ("limits", "requests")
               if template_fields:
                   seen_oids.add(id(content))
                   self._do_render_template_fields(content, template_fields, 
context, jinja_env, seen_oids)
                   return
           super()._render_nested_template_fields(content, context, jinja_env, 
seen_oids)
   
   ```



-- 
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]

Reply via email to