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

kubernetes cleanup-pods CLI command only available when using KubernetesExecutor #46978

Open
1 of 2 tasks
jedcunningham opened this issue Feb 21, 2025 · 1 comment
Open
1 of 2 tasks
Labels
area:CLI area:core kind:bug This is a clearly a bug

Comments

@jedcunningham
Copy link
Member

jedcunningham commented Feb 21, 2025

Apache Airflow version

main (development)

If "Other Airflow 2 version" selected, which one?

No response

What happened?

Currently, the k8s cleanup command is directly tied to the KubernetesExecutor, but the command is helpful for and documented to be used for KubernetesPodOperator users as well.

What you think should happen instead?

The command should work regardless of executor choice, if you have the kubernetes provider installed.

How to reproduce

With LocalExecutor:

$ AIRFLOW__CORE__EXECUTOR=LocalExecutor airflow kubernetes cleanup-pods --help
Usage: airflow [-h] GROUP_OR_COMMAND ...
...
airflow command error: argument GROUP_OR_COMMAND: invalid choice: 'kubernetes' (choose from 'assets', 'backfill', 'cheat-sheet', 'config', 'connections', 'd
ag-processor', 'dags', 'db', 'fab-db', 'fastapi-api', 'info', 'jobs', 'kerberos', 'plugins', 'pools', 'providers', 'roles', 'rotate-fernet-key', 'scheduler'
, 'standalone', 'sync-perm', 'tasks', 'triggerer', 'users', 'variables', 'version', 'webserver'), see help above.

With KubernetesExecutor:

$ AIRFLOW__CORE__EXECUTOR=KubernetesExecutor airflow kubernetes cleanup-pods --help
Usage: airflow kubernetes cleanup-pods [-h] [--min-pending-minutes MIN_PENDING_MINUTES] [--namespace NAMESPACE] [-v]

Clean up Kubernetes pods (created by KubernetesExecutor/KubernetesPodOperator) in evicted/failed/succeeded/pending states

Options:
  -h, --help            show this help message and exit
  --min-pending-minutes MIN_PENDING_MINUTES
                        Pending pods created before the time interval are to be cleaned up, measured in minutes. Default value is 30(m). The minimum value is 5(m).
  --namespace NAMESPACE
                        Kubernetes Namespace. Default value is ` namespace` in configuration.
  -v, --verbose         Make logging output more verbose

Operating System

macos

Versions of Apache Airflow Providers

No response

Deployment

Virtualenv installation

Deployment details

No response

Anything else?

This likely means that providers generally need to be able to add cli commands, not just things in providers (e.g. executors).

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@jedcunningham jedcunningham added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet and removed needs-triage label for new issues that we didn't triage yet labels Feb 21, 2025
@dosubot dosubot bot added the area:CLI label Feb 21, 2025
@jason810496
Copy link
Contributor

Hi @jedcunningham I can work on this issue, could you assign to me ? Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:CLI area:core kind:bug This is a clearly a bug
Projects
None yet
Development

No branches or pull requests

2 participants