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

ephraimanierobi pushed a commit to branch v2-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit d81bf8511f916e09674039c5dc1a84d3a2ac1883
Author: Jed Cunningham <[email protected]>
AuthorDate: Sat Apr 30 11:47:32 2022 -0600

    Fix duplicated Kubernetes DeprecationWarnings (#23302)
    
    (cherry picked from commit 45aadd267a68ecdc4f8491c79db26fa84024c5df)
---
 airflow/kubernetes/pod.py                  | 5 +++--
 airflow/kubernetes/pod_runtime_info_env.py | 1 +
 airflow/kubernetes/volume.py               | 1 +
 airflow/kubernetes/volume_mount.py         | 1 +
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/airflow/kubernetes/pod.py b/airflow/kubernetes/pod.py
index 733f184777..a5b6cde0e3 100644
--- a/airflow/kubernetes/pod.py
+++ b/airflow/kubernetes/pod.py
@@ -17,17 +17,18 @@
 # under the License.
 """
 This module is deprecated.
-Please use :mod:`kubernetes.client.models for V1ResourceRequirements and Port.
+Please use :mod:`kubernetes.client.models` for `V1ResourceRequirements` and 
`Port`.
 """
 # flake8: noqa
 
 import warnings
 
 with warnings.catch_warnings():
+    warnings.simplefilter("ignore", DeprecationWarning)
     from airflow.providers.cncf.kubernetes.backcompat.pod import Port, 
Resources  # noqa: autoflake
 
 warnings.warn(
-    "This module is deprecated. Please use `kubernetes.client.models for 
V1ResourceRequirements and Port.",
+    "This module is deprecated. Please use `kubernetes.client.models` for 
`V1ResourceRequirements` and `Port`.",
     DeprecationWarning,
     stacklevel=2,
 )
diff --git a/airflow/kubernetes/pod_runtime_info_env.py 
b/airflow/kubernetes/pod_runtime_info_env.py
index 5dbbd4249d..a51f3b96fc 100644
--- a/airflow/kubernetes/pod_runtime_info_env.py
+++ b/airflow/kubernetes/pod_runtime_info_env.py
@@ -19,6 +19,7 @@
 import warnings
 
 with warnings.catch_warnings():
+    warnings.simplefilter("ignore", DeprecationWarning)
     from airflow.providers.cncf.kubernetes.backcompat.pod_runtime_info_env 
import PodRuntimeInfoEnv  # noqa
 
 warnings.warn(
diff --git a/airflow/kubernetes/volume.py b/airflow/kubernetes/volume.py
index 90bd4c23bb..81b4fda3a1 100644
--- a/airflow/kubernetes/volume.py
+++ b/airflow/kubernetes/volume.py
@@ -19,6 +19,7 @@
 import warnings
 
 with warnings.catch_warnings():
+    warnings.simplefilter("ignore", DeprecationWarning)
     from airflow.providers.cncf.kubernetes.backcompat.volume import Volume  # 
noqa: autoflake
 
 warnings.warn(
diff --git a/airflow/kubernetes/volume_mount.py 
b/airflow/kubernetes/volume_mount.py
index aff5f30d58..f558425881 100644
--- a/airflow/kubernetes/volume_mount.py
+++ b/airflow/kubernetes/volume_mount.py
@@ -19,6 +19,7 @@
 import warnings
 
 with warnings.catch_warnings():
+    warnings.simplefilter("ignore", DeprecationWarning)
     from airflow.providers.cncf.kubernetes.backcompat.volume_mount import 
VolumeMount  # noqa: autoflake
 
 warnings.warn(

Reply via email to