Skip to content

Commit

Permalink
Remove deprecated kubernetes commands from core (apache#44826)
Browse files Browse the repository at this point in the history
These are deprecated in core and moved to the provider. We should remove
them for Airflow 3.
  • Loading branch information
jedcunningham authored Dec 11, 2024
1 parent 42dfa7e commit cc41721
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 525 deletions.
2 changes: 1 addition & 1 deletion .github/boring-cyborg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ labelPRBasedOnFilePath:
- providers/tests/cloudant/**/*

provider:cncf-kubernetes:
- airflow/**/kubernetes_*.py
- airflow/example_dags/example_kubernetes_executor.py
- airflow/example_dags/example_local_kubernetes_executor.py
- providers/src/airflow/providers/cncf/kubernetes/**/*
- providers/src/airflow/providers/celery/executors/celery_kubernetes_executor.py
- docs/apache-airflow-providers-cncf-kubernetes/**/*
Expand Down
37 changes: 0 additions & 37 deletions airflow/cli/cli_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,23 +862,6 @@ def string_lower_type(val):
help="The section name",
)

# kubernetes cleanup-pods
ARG_NAMESPACE = Arg(
("--namespace",),
default=conf.get("kubernetes_executor", "namespace"),
help="Kubernetes Namespace. Default value is `[kubernetes] namespace` in configuration.",
)

ARG_MIN_PENDING_MINUTES = Arg(
("--min-pending-minutes",),
default=30,
type=positive_int(allow_zero=False),
help=(
"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)."
),
)

# jobs check
ARG_JOB_TYPE_FILTER = Arg(
("--job-type",),
Expand Down Expand Up @@ -1752,26 +1735,6 @@ class GroupCommand(NamedTuple):
),
)

KUBERNETES_COMMANDS = (
ActionCommand(
name="cleanup-pods",
help=(
"Clean up Kubernetes pods "
"(created by KubernetesExecutor/KubernetesPodOperator) "
"in evicted/failed/succeeded/pending states"
),
func=lazy_load_command("airflow.providers.cncf.kubernetes.cli.kubernetes_command.cleanup_pods"),
args=(ARG_NAMESPACE, ARG_MIN_PENDING_MINUTES, ARG_VERBOSE),
),
ActionCommand(
name="generate-dag-yaml",
help="Generate YAML files for all tasks in DAG. Useful for debugging tasks without "
"launching into a cluster",
func=lazy_load_command("airflow.providers.cncf.kubernetes.cli.kubernetes_command.generate_pod_yaml"),
args=(ARG_DAG_ID, ARG_LOGICAL_DATE, ARG_SUBDIR, ARG_OUTPUT_PATH, ARG_VERBOSE),
),
)

JOBS_COMMANDS = (
ActionCommand(
name="check",
Expand Down
16 changes: 0 additions & 16 deletions airflow/cli/commands/hybrid_commands/__init__.py

This file was deleted.

171 changes: 0 additions & 171 deletions airflow/cli/commands/hybrid_commands/kubernetes_command.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ def get_imports(path: str):

errors: list[str] = []

EXCEPTIONS = ["airflow/cli/commands/hybrid_commands/kubernetes_command.py"]


def main() -> int:
for path in sys.argv[1:]:
Expand All @@ -62,9 +60,8 @@ def main() -> int:
import_count += 1
if len(imp.module) > 3:
if imp.module[:4] == ["airflow", "providers", "cncf", "kubernetes"]:
if path not in EXCEPTIONS:
local_error_count += 1
errors.append(f"{path}: ({'.'.join(imp.module)})")
local_error_count += 1
errors.append(f"{path}: ({'.'.join(imp.module)})")
console.print(f"[blue]{path}:[/] Import count: {import_count}, error_count {local_error_count}")
if errors:
console.print(
Expand Down
1 change: 0 additions & 1 deletion scripts/cov/cli_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"airflow/cli/commands/local_commands/db_command.py",
"airflow/cli/commands/local_commands/info_command.py",
"airflow/cli/commands/remote_commands/jobs_command.py",
"airflow/cli/commands/hybrid_commands/kubernetes_command.py",
"airflow/cli/commands/local_commands/plugins_command.py",
"airflow/cli/commands/remote_commands/pool_command.py",
"airflow/cli/commands/remote_commands/provider_command.py",
Expand Down
16 changes: 0 additions & 16 deletions tests/cli/commands/hybrid_commands/__init__.py

This file was deleted.

Loading

0 comments on commit cc41721

Please sign in to comment.