This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 7932958488 Fix assignment of template field in `__init__` in 
`KubernetesPodOperator` (#37010)
7932958488 is described below

commit 7932958488761cd01cd94b7eea0c646dc41c3981
Author: rom sharon <33751805+romsharo...@users.noreply.github.com>
AuthorDate: Mon Feb 5 17:29:58 2024 +0200

    Fix assignment of template field in `__init__` in `KubernetesPodOperator` 
(#37010)
---
 .pre-commit-config.yaml                            | 1 -
 airflow/providers/cncf/kubernetes/operators/pod.py | 9 ++++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ded656d9dc..8b91b24b98 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -322,7 +322,6 @@ repos:
               ^airflow\/providers\/amazon\/aws\/transfers\/redshift_to_s3\.py$|
               ^airflow\/providers\/google\/cloud\/operators\/compute\.py$|
               
^airflow\/providers\/google\/cloud\/operators\/vertex_ai\/custom_job\.py$|
-              ^airflow\/providers\/cncf\/kubernetes\/operators\/pod\.py$|
               ^airflow\/providers\/amazon\/aws\/operators\/emr\.py$|
               ^airflow\/providers\/amazon\/aws\/operators\/eks\.py$
           )$
diff --git a/airflow/providers/cncf/kubernetes/operators/pod.py 
b/airflow/providers/cncf/kubernetes/operators/pod.py
index 693932f022..1ab32a5cd7 100644
--- a/airflow/providers/cncf/kubernetes/operators/pod.py
+++ b/airflow/providers/cncf/kubernetes/operators/pod.py
@@ -309,15 +309,18 @@ class KubernetesPodOperator(BaseOperator):
         self.labels = labels or {}
         self.startup_timeout_seconds = startup_timeout_seconds
         self.startup_check_interval_seconds = startup_check_interval_seconds
-        self.env_vars = convert_env_vars(env_vars) if env_vars else []
+        env_vars = convert_env_vars(env_vars) if env_vars else []
+        self.env_vars = env_vars
         if pod_runtime_info_envs:
             self.env_vars.extend([convert_pod_runtime_info_env(p) for p in 
pod_runtime_info_envs])
         self.env_from = env_from or []
         if configmaps:
             self.env_from.extend([convert_configmap(c) for c in configmaps])
         self.ports = [convert_port(p) for p in ports] if ports else []
-        self.volume_mounts = [convert_volume_mount(v) for v in volume_mounts] 
if volume_mounts else []
-        self.volumes = [convert_volume(volume) for volume in volumes] if 
volumes else []
+        volume_mounts = [convert_volume_mount(v) for v in volume_mounts] if 
volume_mounts else []
+        self.volume_mounts = volume_mounts
+        volumes = [convert_volume(volume) for volume in volumes] if volumes 
else []
+        self.volumes = volumes
         self.secrets = secrets or []
         self.in_cluster = in_cluster
         self.cluster_context = cluster_context

Reply via email to