Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default value of namespace in task.kubernetes to be None #43402

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions providers/src/airflow/providers/cncf/kubernetes/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
.....

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions providers/tests/cncf/kubernetes/decorators/test_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"}
Expand Down