XD-DENG commented on a change in pull request #15204:
URL: https://github.com/apache/airflow/pull/15204#discussion_r607159566
##########
File path: airflow/cli/commands/kubernetes_command.py
##########
@@ -90,7 +90,25 @@ def cleanup_pods(args):
print('Loading Kubernetes configuration')
kube_client = get_kube_client()
print(f'Listing pods in namespace {namespace}')
- list_kwargs = {"namespace": namespace, "limit": 500}
+ airflow_pod_labels = [
+ 'airflow-worker',
+ 'dag_id',
+ 'task_id',
+ 'execution_date',
+ 'try_number',
+ 'airflow_version',
+ 'kubernetes_executor',
+ ]
+ list_kwargs = {
+ "namespace": namespace,
+ "limit": 500,
+ "label_selector": client.V1LabelSelector(
+ match_expressions=[
+ client.V1LabelSelectorRequirement(key=label, operator="Exists")
Review comment:
Makes sense to me. For the same reason, if I'm not wrong, we should
exclude considering `airflow-worker` as well.
Addressed in
https://github.com/apache/airflow/pull/15204/commits/e406a0895a173587fd0cff8354650c740e687fd1
Thanks!
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]