apache / apache/airflow

Allow passing config_path as a parameter to KubernetesExecutor

Open
#46,293 7 comments 0 reactions 0 assignees View on GitHub
good first issue kind:feature provider:cncf-kubernetes
Dominant language
Python
Stars
46.9k
Forks
17.8k
Avg merge
2d 10h
Merged PRs (30d)
483

Description

### 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:
```python
executor_config={"KubernetesExecutor": {"config_file": "/opt/airflow/config/kubernetes/docker-desktop-config.yaml"}}
```
However, if we attempt to pass it dynamically, it fails:
```python
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](https://cwiki.apache.org/confluence/display/AIRFLOW/AIP-61+Hybrid+Execution). 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

- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Research direction

Start at the KubernetesExecutor entry point that processes executor_config and its config_file value, then compare it with other parameters that already support templating. Verify the behavior with a dynamically supplied params.config_path across the described deployment environments; done means the rendered path is accepted at runtime without breaking static paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, python
Domain
backend, devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.