diff --git a/providers/src/airflow/providers/cncf/kubernetes/CHANGELOG.rst b/providers/src/airflow/providers/cncf/kubernetes/CHANGELOG.rst index c54da827b56e..28417d6ac3da 100644 --- a/providers/src/airflow/providers/cncf/kubernetes/CHANGELOG.rst +++ b/providers/src/airflow/providers/cncf/kubernetes/CHANGELOG.rst @@ -27,6 +27,14 @@ Changelog --------- + +main +..... + +.. warning:: + Set the default value of ``namespace`` in ``@task.kubernetes`` to ``None``, so it uses the cluster namespace when ``in_cluster`` is True. Be sure to specify a namespace when using this decorator. To retain the previous behavior, set ``namespace="default"`` + + 9.0.1 ..... diff --git a/providers/src/airflow/providers/cncf/kubernetes/decorators/kubernetes.py b/providers/src/airflow/providers/cncf/kubernetes/decorators/kubernetes.py index 2f00de10b0c2..c3f5951540cb 100644 --- a/providers/src/airflow/providers/cncf/kubernetes/decorators/kubernetes.py +++ b/providers/src/airflow/providers/cncf/kubernetes/decorators/kubernetes.py @@ -65,7 +65,7 @@ class _KubernetesDecoratedOperator(DecoratedOperator, KubernetesPodOperator): # there are some cases we can't deepcopy the objects (e.g protobuf). shallow_copy_attrs: Sequence[str] = ("python_callable",) - def __init__(self, namespace: str = "default", use_dill: bool = False, **kwargs) -> None: + def __init__(self, namespace: str | None = None, use_dill: bool = False, **kwargs) -> None: self.use_dill = use_dill super().__init__( namespace=namespace, diff --git a/providers/src/airflow/providers/cncf/kubernetes/provider.yaml b/providers/src/airflow/providers/cncf/kubernetes/provider.yaml index a6f4b266b6ff..79c885ffb014 100644 --- a/providers/src/airflow/providers/cncf/kubernetes/provider.yaml +++ b/providers/src/airflow/providers/cncf/kubernetes/provider.yaml @@ -25,6 +25,7 @@ state: ready source-date-epoch: 1730012271 # note that those versions are maintained by release manager - do not update them manually versions: + - 10.0.0 - 9.0.1 - 9.0.0 - 8.4.2 diff --git a/providers/tests/cncf/kubernetes/decorators/test_kubernetes.py b/providers/tests/cncf/kubernetes/decorators/test_kubernetes.py index 93198cbe0a7e..9545e9adbf3d 100644 --- a/providers/tests/cncf/kubernetes/decorators/test_kubernetes.py +++ b/providers/tests/cncf/kubernetes/decorators/test_kubernetes.py @@ -78,6 +78,7 @@ def test_basic_kubernetes(dag_maker, session, mock_create_pod: mock.Mock, mock_h in_cluster=False, cluster_context="default", config_file="/tmp/fake_file", + namespace="default", ) def f(): import random @@ -122,6 +123,7 @@ def test_kubernetes_with_input_output( in_cluster=False, cluster_context="default", config_file="/tmp/fake_file", + namespace="default", ) def f(arg1, arg2, kwarg1=None, kwarg2=None): return {"key1": "value1", "key2": "value2"}