apache-airflow-providers-cncf-kubernetes 7.4.0__py3-none-any.whl → 7.4.1rc1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,7 @@ import packaging.version
28
28
 
29
29
  __all__ = ["__version__"]
30
30
 
31
- __version__ = "7.4.0"
31
+ __version__ = "7.4.1"
32
32
 
33
33
  try:
34
34
  from airflow import __version__ as airflow_version
@@ -23,6 +23,7 @@ KubernetesExecutor.
23
23
  """
24
24
  from __future__ import annotations
25
25
 
26
+ import argparse
26
27
  import json
27
28
  import logging
28
29
  import multiprocessing
@@ -727,3 +728,11 @@ class KubernetesExecutor(BaseExecutor):
727
728
  subcommands=KUBERNETES_COMMANDS,
728
729
  )
729
730
  ]
731
+
732
+
733
+ def _get_parser() -> argparse.ArgumentParser:
734
+ """This method is used by Sphinx to generate documentation.
735
+
736
+ :meta private:
737
+ """
738
+ return KubernetesExecutor._get_parser()
@@ -29,6 +29,7 @@ def get_provider_info():
29
29
  "description": "`Kubernetes <https://kubernetes.io/>`__\n",
30
30
  "suspended": False,
31
31
  "versions": [
32
+ "7.4.1",
32
33
  "7.4.0",
33
34
  "7.3.0",
34
35
  "7.2.0",
@@ -17,6 +17,7 @@
17
17
  from __future__ import annotations
18
18
 
19
19
  import contextlib
20
+ import json
20
21
  import tempfile
21
22
  from functools import cached_property
22
23
  from typing import TYPE_CHECKING, Any, Generator
@@ -99,6 +100,12 @@ class KubernetesHook(BaseHook, PodOperatorHookProtocol):
99
100
  "cluster_context": StringField(lazy_gettext("Cluster context"), widget=BS3TextFieldWidget()),
100
101
  "disable_verify_ssl": BooleanField(lazy_gettext("Disable SSL")),
101
102
  "disable_tcp_keepalive": BooleanField(lazy_gettext("Disable TCP keepalive")),
103
+ "xcom_sidecar_container_image": StringField(
104
+ lazy_gettext("XCom sidecar image"), widget=BS3TextFieldWidget()
105
+ ),
106
+ "xcom_sidecar_container_resources": StringField(
107
+ lazy_gettext("XCom sidecar resources (JSON format)"), widget=BS3TextFieldWidget()
108
+ ),
102
109
  }
103
110
 
104
111
  @staticmethod
@@ -356,6 +363,17 @@ class KubernetesHook(BaseHook, PodOperatorHookProtocol):
356
363
  return self._get_field("namespace")
357
364
  return None
358
365
 
366
+ def get_xcom_sidecar_container_image(self):
367
+ """Returns the xcom sidecar image that defined in the connection."""
368
+ return self._get_field("xcom_sidecar_container_image")
369
+
370
+ def get_xcom_sidecar_container_resources(self):
371
+ """Returns the xcom sidecar resources that defined in the connection."""
372
+ field = self._get_field("xcom_sidecar_container_resources")
373
+ if not field:
374
+ return None
375
+ return json.loads(field)
376
+
359
377
  def get_pod_log_stream(
360
378
  self,
361
379
  pod_name: str,
@@ -361,9 +361,7 @@ class KubernetesPodOperator(BaseOperator):
361
361
  self.get_logs = get_logs
362
362
  self.container_logs = container_logs
363
363
  if self.container_logs == KubernetesPodOperator.BASE_CONTAINER_NAME:
364
- self.container_logs = (
365
- base_container_name if base_container_name else KubernetesPodOperator.BASE_CONTAINER_NAME
366
- )
364
+ self.container_logs = base_container_name if base_container_name else self.BASE_CONTAINER_NAME
367
365
  self.image_pull_policy = image_pull_policy
368
366
  self.node_selector = node_selector or {}
369
367
  self.annotations = annotations or {}
@@ -592,7 +590,9 @@ class KubernetesPodOperator(BaseOperator):
592
590
  container_logs=self.container_logs,
593
591
  follow_logs=True,
594
592
  )
595
- else:
593
+ if not self.get_logs or (
594
+ self.container_logs is not True and self.base_container_name not in self.container_logs
595
+ ):
596
596
  self.pod_manager.await_container_completion(
597
597
  pod=self.pod, container_name=self.base_container_name
598
598
  )
@@ -762,7 +762,10 @@ class KubernetesPodOperator(BaseOperator):
762
762
  self.log.info("Skipping deleting pod: %s", pod.metadata.name)
763
763
 
764
764
  def _build_find_pod_label_selector(self, context: Context | None = None, *, exclude_checked=True) -> str:
765
- labels = self._get_ti_pod_labels(context, include_try_number=False)
765
+ labels = {
766
+ **self.labels,
767
+ **self._get_ti_pod_labels(context, include_try_number=False),
768
+ }
766
769
  label_strings = [f"{label_id}={label}" for label_id, label in sorted(labels.items())]
767
770
  labels_value = ",".join(label_strings)
768
771
  if exclude_checked:
@@ -880,7 +883,11 @@ class KubernetesPodOperator(BaseOperator):
880
883
  pod = secret.attach_to_pod(pod)
881
884
  if self.do_xcom_push:
882
885
  self.log.debug("Adding xcom sidecar to task %s", self.task_id)
883
- pod = xcom_sidecar.add_xcom_sidecar(pod)
886
+ pod = xcom_sidecar.add_xcom_sidecar(
887
+ pod,
888
+ sidecar_container_image=self.hook.get_xcom_sidecar_container_image(),
889
+ sidecar_container_resources=self.hook.get_xcom_sidecar_container_resources(),
890
+ )
884
891
 
885
892
  labels = self._get_ti_pod_labels(context)
886
893
  self.log.info("Building pod %s with labels: %s", pod.metadata.name, labels)
@@ -101,6 +101,12 @@ class PodOperatorHookProtocol(Protocol):
101
101
  def get_namespace(self) -> str | None:
102
102
  """Returns the namespace that defined in the connection."""
103
103
 
104
+ def get_xcom_sidecar_container_image(self) -> str | None:
105
+ """Returns the xcom sidecar image that defined in the connection."""
106
+
107
+ def get_xcom_sidecar_container_resources(self) -> str | None:
108
+ """Returns the xcom sidecar resources that defined in the connection."""
109
+
104
110
 
105
111
  def get_container_status(pod: V1Pod, container_name: str) -> V1ContainerStatus | None:
106
112
  """Retrieves container status."""
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-cncf-kubernetes
3
- Version: 7.4.0
3
+ Version: 7.4.1rc1
4
4
  Summary: Provider for Apache Airflow. Implements apache-airflow-providers-cncf-kubernetes package
5
5
  Home-page: https://airflow.apache.org/
6
6
  Download-URL: https://archive.apache.org/dist/airflow/providers
7
7
  Author: Apache Software Foundation
8
8
  Author-email: dev@airflow.apache.org
9
9
  License: Apache License 2.0
10
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/7.4.0/
11
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/7.4.0/changelog.html
10
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/7.4.1/
11
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/7.4.1/changelog.html
12
12
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
13
13
  Project-URL: Source Code, https://github.com/apache/airflow
14
14
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
@@ -31,7 +31,7 @@ Requires-Python: ~=3.8
31
31
  Description-Content-Type: text/x-rst
32
32
  License-File: LICENSE
33
33
  License-File: NOTICE
34
- Requires-Dist: apache-airflow (>=2.4.0)
34
+ Requires-Dist: apache-airflow (>=2.4.0.dev0)
35
35
  Requires-Dist: asgiref (>=3.5.2)
36
36
  Requires-Dist: cryptography (>=2.0.0)
37
37
  Requires-Dist: kubernetes (<24,>=21.7.0)
@@ -75,7 +75,7 @@ Requires-Dist: kubernetes-asyncio (<25,>=18.20.1)
75
75
 
76
76
  Package ``apache-airflow-providers-cncf-kubernetes``
77
77
 
78
- Release: ``7.4.0``
78
+ Release: ``7.4.1rc1``
79
79
 
80
80
 
81
81
  `Kubernetes <https://kubernetes.io/>`__
@@ -88,7 +88,7 @@ This is a provider package for ``cncf.kubernetes`` provider. All classes for thi
88
88
  are in ``airflow.providers.cncf.kubernetes`` python package.
89
89
 
90
90
  You can find package information and changelog for the provider
91
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/7.4.0/>`_.
91
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/7.4.1/>`_.
92
92
 
93
93
 
94
94
  Installation
@@ -114,4 +114,4 @@ PIP package Version required
114
114
  ====================== ==================
115
115
 
116
116
  The changelog for the provider package can be found in the
117
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/7.4.0/changelog.html>`_.
117
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-cncf-kubernetes/7.4.1/changelog.html>`_.
@@ -1,5 +1,5 @@
1
- airflow/providers/cncf/kubernetes/__init__.py,sha256=oDhCsIEtqmrHFj751UZxfqitrJlQRM2G4JksowkTKes,1584
2
- airflow/providers/cncf/kubernetes/get_provider_info.py,sha256=bmlxNJzjWqNaI_APrcweffJG9mzDw3s-NEP_LHgpxe0,15865
1
+ airflow/providers/cncf/kubernetes/__init__.py,sha256=UIwpT7IQLH63kfJleOq1CPVNLESADcgNymHusA4dOqE,1584
2
+ airflow/providers/cncf/kubernetes/get_provider_info.py,sha256=pDwe3siVIrE18BZNtdT7xLJRdNNGefKexzud0kAe67o,15886
3
3
  airflow/providers/cncf/kubernetes/k8s_model.py,sha256=yA5mZDLSicmwEF48V_yfXUz9ZsEyAVeFSn29WhzpJwU,2045
4
4
  airflow/providers/cncf/kubernetes/kube_client.py,sha256=QgOZmDb8arulCXil9LH4KA-iI1S8jMOhVSCFWDyOb3s,5344
5
5
  airflow/providers/cncf/kubernetes/kube_config.py,sha256=SZhMYmCJACkzxEFe0vcCW0m1XmoFpmDaIYf_Rl_uycA,4851
@@ -16,16 +16,16 @@ airflow/providers/cncf/kubernetes/backcompat/backwards_compat_converters.py,sha2
16
16
  airflow/providers/cncf/kubernetes/decorators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
17
17
  airflow/providers/cncf/kubernetes/decorators/kubernetes.py,sha256=1BtTiZS0W1w_X-GixB1mXftgz2utPFT2ci2GX83sEY4,6178
18
18
  airflow/providers/cncf/kubernetes/executors/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
19
- airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py,sha256=e00ZTqMcHsvukjATb1Zb7oa9q2GpzQfZBpwMDh4nQmk,30257
19
+ airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py,sha256=2eSdwAuX1LZwBbB_lijLvoPj8xoik-M0Lq2ps79X380,30457
20
20
  airflow/providers/cncf/kubernetes/executors/kubernetes_executor_types.py,sha256=JrGIamWOE82z_zr45w4VpviJGJGmwZ5gUICGGGwy1jg,1540
21
21
  airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py,sha256=L4wtjYU-6w60-NVHR6RhkS-IVoaQjWThlcDBIyJ3Wrc,21132
22
22
  airflow/providers/cncf/kubernetes/executors/local_kubernetes_executor.py,sha256=RvFPYy6YJAyzBYkfJnNqtzNPB_IZBwEEajwQdgWa98U,9983
23
23
  airflow/providers/cncf/kubernetes/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
24
- airflow/providers/cncf/kubernetes/hooks/kubernetes.py,sha256=OSAQEquMd34Mp48BUtkXgtEkjz4jKQoCwdqCDl0Lszc,23140
24
+ airflow/providers/cncf/kubernetes/hooks/kubernetes.py,sha256=EmW9DGLl_OkHID8vSvYq1JUCfH_QT5Gxn0hrkGScu_4,23948
25
25
  airflow/providers/cncf/kubernetes/kubernetes_executor_templates/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
26
26
  airflow/providers/cncf/kubernetes/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
27
27
  airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py,sha256=XvJgehU-4ZubJZ2vsekHX4DlCLlzBttXuZQlpVZZ2Ro,1262
28
- airflow/providers/cncf/kubernetes/operators/pod.py,sha256=_iaAJHPLJQSuBRdjdhyCDJXXlBFrh8ev872xC6MC0TI,41271
28
+ airflow/providers/cncf/kubernetes/operators/pod.py,sha256=AE5qbjEgKtkQMHWotlT-jOo9t83LK__ildJhcsDZDW8,41626
29
29
  airflow/providers/cncf/kubernetes/operators/resource.py,sha256=cWpygD5-d8O3ja2U3oOd3kkSzUs5ya6uGVEQA-8eq9g,3827
30
30
  airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py,sha256=8PEtSlZ-8EPJepaBOFFnqWD0hBYVrjEhohbPZ9dtKBs,7387
31
31
  airflow/providers/cncf/kubernetes/pod_template_file_examples/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
@@ -37,12 +37,12 @@ airflow/providers/cncf/kubernetes/triggers/pod.py,sha256=-d_B1DHmFxnJDOkBMuIAcgl
37
37
  airflow/providers/cncf/kubernetes/utils/__init__.py,sha256=ClZN0VPjWySdVwS_ktH7rrgL9VLAcs3OSJSB9s3zaYw,863
38
38
  airflow/providers/cncf/kubernetes/utils/delete_from.py,sha256=wxpVlB7mYfwSdeIvPfH_scdT_uwO_7fxMSEztt5IOr8,5176
39
39
  airflow/providers/cncf/kubernetes/utils/k8s_hashlib_wrapper.py,sha256=HepA1Jnfbsr9iUZMGnG1zSGboV5l1RaWuTO02OGXoVc,1553
40
- airflow/providers/cncf/kubernetes/utils/pod_manager.py,sha256=ZIrbOqarKnjkKKVLm0hv1fAKnwzjaTfaknGk-j1M2iA,28943
40
+ airflow/providers/cncf/kubernetes/utils/pod_manager.py,sha256=5JgrlXN2T0hNfVSmBJTOyli2GqsWTmEACCUjYfcmw5g,29231
41
41
  airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py,sha256=GswqPXv24XQhAJGxt7PXrrDx0kVxIx3ljlRP2ix9Ews,2519
42
- apache_airflow_providers_cncf_kubernetes-7.4.0.dist-info/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
43
- apache_airflow_providers_cncf_kubernetes-7.4.0.dist-info/METADATA,sha256=6B9g1yQOFWUMgFI1SWFNAJA_HZdknptd-sN7nSRJ8lQ,4833
44
- apache_airflow_providers_cncf_kubernetes-7.4.0.dist-info/NOTICE,sha256=m-6s2XynUxVSUIxO4rVablAZCvFq-wmLrqV91DotRBw,240
45
- apache_airflow_providers_cncf_kubernetes-7.4.0.dist-info/WHEEL,sha256=AtBG6SXL3KF_v0NxLf0ehyVOh0cold-JbJYXNGorC6Q,92
46
- apache_airflow_providers_cncf_kubernetes-7.4.0.dist-info/entry_points.txt,sha256=GZl6SYJuUg-3koITGRd9PU1lBmqhecrKTeCQ6-wyHpM,112
47
- apache_airflow_providers_cncf_kubernetes-7.4.0.dist-info/top_level.txt,sha256=OeMVH5md7fr2QQWpnZoOWWxWO-0WH1IP70lpTVwopPg,8
48
- apache_airflow_providers_cncf_kubernetes-7.4.0.dist-info/RECORD,,
42
+ apache_airflow_providers_cncf_kubernetes-7.4.1rc1.dist-info/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
43
+ apache_airflow_providers_cncf_kubernetes-7.4.1rc1.dist-info/METADATA,sha256=i1kovGbx0zztuRmHYaF4yePfJXKiAx_Vey7GlO7ZhDY,4844
44
+ apache_airflow_providers_cncf_kubernetes-7.4.1rc1.dist-info/NOTICE,sha256=m-6s2XynUxVSUIxO4rVablAZCvFq-wmLrqV91DotRBw,240
45
+ apache_airflow_providers_cncf_kubernetes-7.4.1rc1.dist-info/WHEEL,sha256=AtBG6SXL3KF_v0NxLf0ehyVOh0cold-JbJYXNGorC6Q,92
46
+ apache_airflow_providers_cncf_kubernetes-7.4.1rc1.dist-info/entry_points.txt,sha256=GZl6SYJuUg-3koITGRd9PU1lBmqhecrKTeCQ6-wyHpM,112
47
+ apache_airflow_providers_cncf_kubernetes-7.4.1rc1.dist-info/top_level.txt,sha256=OeMVH5md7fr2QQWpnZoOWWxWO-0WH1IP70lpTVwopPg,8
48
+ apache_airflow_providers_cncf_kubernetes-7.4.1rc1.dist-info/RECORD,,