Skip to content

Invalid keys in executor_config should raise an error #47702

@karenbraganz

Description

@karenbraganz

Apache Airflow Provider(s)

cncf-kubernetes

Versions of Apache Airflow Providers

10.0.1

Apache Airflow version

2.10.5

Operating System

Debian GNU/Linux 12 (bookworm)

Deployment

Astronomer

Deployment details

No response

What happened

The executor_config dictionary used to configure worker pods with the Kubernetes executor does not raise an error if any keys besides "pod_override" or "pod_template_file" are used. Even with invalid keys, the DAG is imported and will run as expected. The invalid executor_config will simply be disregarded.

What you think should happen instead

If any keys besides "pod_override" or "pod_template_file" are used in executor_config, and error (maybe a DAG import error) should be raised.

This should give the user feedback that their executor_config keys are invalid and need to be removed or changed.

How to reproduce

  1. Create an Airflow instance that uses the Kubernetes Executor.
  2. Create a DAG with the following code including an invalid key in executor_config.
import datetime

from airflow.decorators import dag
from airflow.decorators import task

executor_config = {
    "key": "value"
}

@dag(start_date=datetime.datetime(2024, 10, 1), schedule="@daily", catchup=False)
def dag_1():

    @task(executor_config=executor_config)
    def task_1():
        print("task 1")

    task_1()

dag_1()
  1. Observe that the DAG will be imported and run on the Airflow instance without any issues.

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions