You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/11/17 19:25:11 UTC
[GitHub] [airflow] dstandish commented on a diff in pull request #27719: [FEATURE] KPO - volume nested template fields
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
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
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org