vbottu commented on code in PR #61798:
URL: https://github.com/apache/airflow/pull/61798#discussion_r2868617075
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/kube_config.py:
##########
@@ -16,71 +16,95 @@
# under the License.
from __future__ import annotations
+from typing import TYPE_CHECKING
+
from airflow.configuration import conf
from airflow.exceptions import AirflowConfigException
from airflow.settings import AIRFLOW_HOME
+if TYPE_CHECKING:
+ from airflow.executors.base_executor import ExecutorConf
+
class KubeConfig:
- """Configuration for Kubernetes."""
+ """
+ Configuration for Kubernetes.
+
+ :param executor_conf: Optional team-aware configuration object. If not
provided,
+ falls back to the global configuration for backwards compatibility.
This parameter
+ supports the multi-team feature introduced in AIP-67.
+ """
core_section = "core"
kubernetes_section = "kubernetes_executor"
logging_section = "logging"
- def __init__(self):
+ def __init__(self, executor_conf: ExecutorConf | None = None):
Review Comment:
Fixed both. For `template_rendering.py`, added a helper that grabs the team
name from `DagModel.get_team_name(dag_id)` using the TI's dag_id, builds an
`ExecutorConf`, and passes it into `KubeConfig`. It's behind the multi_team
config check so there's no extra DB call when multi team isn't enabled. For
`kubernetes_command.py` I agree it's worth covering too, added a `--team` flag
to `generate-dag-yaml` so users can preview the team specific pod YAML. If they
don't pass it, everything works exactly as before. While working on this I also
found a bug in `configuration.py` where `get_provider_config_fallback_defaults`
was forwarding `team_name` to the underlying `RawConfigParser.get()` which
blows up with a TypeError. Stripped it with `kwargs.pop` before the delegation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]