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

Allow passing config_path as a parameter to KubernetesExecutor #46293

Open
1 of 2 tasks
pablo-moreno-mancebo opened this issue Jan 30, 2025 · 4 comments
Open
1 of 2 tasks
Labels
good first issue kind:feature Feature Requests provider:cncf-kubernetes Kubernetes provider related issues

Comments

@pablo-moreno-mancebo
Copy link

Description

Currently, when using executor_config with KubernetesExecutor, the config_file path must be hardcoded. If we try to pass it dynamically using a Jinja template ("{{ params.config_path }}"), it results in an error.

Example of a working static configuration:

executor_config={"KubernetesExecutor": {"config_file": "/opt/airflow/config/kubernetes/docker-desktop-config.yaml"}}

However, if we attempt to pass it dynamically, it fails:

executor_config={"KubernetesExecutor": {"config_file": "{{ params.config_path }}"}}

This would be useful when deploying DAGs across different environments (e.g., multiple regions) without hardcoding paths.

Proposed Solution:

Modify executor_config to allow templating in KubernetesExecutor.config_file, similar to other templated parameters in Airflow.

Use case/motivation

This would be useful when deploying DAGs across different environments (e.g., multiple regions) without hardcoding paths.
Airflow should allow config_file to accept templated values, resolving them at runtime.
This feature would improve flexibility when running KubernetesExecutor tasks that need different configurations based on dynamic parameters.
Would love to hear thoughts from the community on this! Thanks! 😊

Related issues

This feature would improve Airflow’s flexibility in hybrid execution environments and align with the goals of AIP-61. Would love to hear thoughts from the community on this! 🚀

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@pablo-moreno-mancebo pablo-moreno-mancebo added kind:feature Feature Requests needs-triage label for new issues that we didn't triage yet labels Jan 30, 2025
Copy link

boring-cyborg bot commented Jan 30, 2025

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

@dosubot dosubot bot added the provider:cncf-kubernetes Kubernetes provider related issues label Jan 30, 2025
@potiuk
Copy link
Member

potiuk commented Jan 31, 2025

If you can take a look at propose a PR solving it, yes I think it would be useful. But it needs a deep look in the code whether it's possible, also with Airflow 3 changes / Task SDK changes in progress, likely doing it after this is completed, is a good idea.

@potiuk potiuk added good first issue and removed needs-triage label for new issues that we didn't triage yet labels Jan 31, 2025
@insomnes
Copy link
Contributor

insomnes commented Feb 1, 2025

Are you sure you can rewrite it with?

executor_config={"KubernetesExecutor": {"config_file": "/opt/airflow/config/kubernetes/docker-desktop-config.yaml"}}

I've dug through the code and also experimented a bit, and couldn't find any way to rewrite the initial config file for KubernetesExecutor. Am I missing something? Any of the executor_config I've tried to use with deprecated KubernetesExecutor variant except the empty one led to the error:

{kubernetes_executor.py:355} ERROR - Invalid executor_config for TaskInstanceKey

@Maryam3107
Copy link

Description

Currently, when using executor_config with KubernetesExecutor, the config_file path must be hardcoded. If we try to pass it dynamically using a Jinja template ("{{ params.config_path }}"), it results in an error.

Example of a working static configuration:

executor_config={"KubernetesExecutor": {"config_file": "/opt/airflow/config/kubernetes/docker-desktop-config.yaml"}}
However, if we attempt to pass it dynamically, it fails:

executor_config={"KubernetesExecutor": {"config_file": "{{ params.config_path }}"}}
This would be useful when deploying DAGs across different environments (e.g., multiple regions) without hardcoding paths.

Proposed Solution:

Modify executor_config to allow templating in KubernetesExecutor.config_file, similar to other templated parameters in Airflow.

Use case/motivation

This would be useful when deploying DAGs across different environments (e.g., multiple regions) without hardcoding paths. Airflow should allow config_file to accept templated values, resolving them at runtime. This feature would improve flexibility when running KubernetesExecutor tasks that need different configurations based on dynamic parameters. Would love to hear thoughts from the community on this! Thanks! 😊

Related issues

This feature would improve Airflow’s flexibility in hybrid execution environments and align with the goals of AIP-61. Would love to hear thoughts from the community on this! 🚀

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

I can solve this problem. kindly assign it to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue kind:feature Feature Requests provider:cncf-kubernetes Kubernetes provider related issues
Projects
None yet
Development

No branches or pull requests

4 participants