Skip to content

Fix GKE operator imports with older Kubernetes providers - #74505

Merged
potiuk merged 3 commits into
apache:mainfrom
AlejandroMorgante:fix-gke-exec-import-fallback
Oct 9, 2026
Merged

potiuk merged 3 commits into
apache:mainfrom
AlejandroMorgante:fix-gke-exec-import-fallback

Conversation

@AlejandroMorgante

@AlejandroMorgante AlejandroMorgante commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

With apache-airflow-providers-cncf-kubernetes older than 10.22.0, importing the GKE operator module fails because KubernetesPodExecOperator is unavailable. This also prevents users from using existing GKE operators.

Mirror the fallback-class approach from #72542: keep the module importable and raise AirflowOptionalProviderFeatureException with the required provider version only when constructing GKEPodExecOperator. The regression verifies that existing cluster and Pod operators can still be constructed when the optional import is unavailable. Exclude the compatibility placeholder from the standalone-operator example coverage check, as in EKS.

Follow-up to #72577 and the provider RC testing feedback.

Validation:

  • Google provider suite in Breeze: 5,441 passed, 59 skipped (183.28s); includes all 108 GKE operator tests.
  • Confirmed the regression fails against the original source at module import.
  • Mypy on the changed source and applicable regular/manual prek checks passed.
  • Google documentation and spellcheck passed.
  • Core Always checks: 1,891 DB tests passed; 299 non-DB tests passed, with one expected failure.
  • Live GKE system test: 1 failed in 1343.28s. It used the command below. Cluster creation and the existing Pod examples succeeded, but the readiness sensor could not find the target exec Pod and timed out after 300s, before GKEPodExecOperator ran. Cluster deletion succeeded and an independent cluster listing confirmed cleanup. This run is not reported as passing.

Reproducible commands:

breeze testing providers-tests --backend sqlite --test-type 'Providers[google]'

SYSTEM_TESTS_ENV_ID=gf1009 \
BREEZE_INIT_COMMAND='export GOOGLE_CLOUD_PROJECT="${SYSTEM_TESTS_GCP_PROJECT}"' \
breeze testing system-tests \
  --forward-credentials \
  --test-timeout 2400 \
  providers/google/tests/system/google/cloud/kubernetes_engine/example_kubernetes_engine.py \
  -q

Was generative AI tooling used to co-author this PR?
  • Yes — Codex (GPT-6)

Generated-by: Codex (GPT-6) following the guidelines

Older Kubernetes provider versions lack the Pod exec operator. That optional feature must not prevent users from importing or creating existing GKE operators.
The compatibility placeholder cannot be used independently and therefore has no system example.
Keep the original ImportError as the cause of the missing-provider
error, import AirflowOptionalProviderFeatureException at module top,
and split the fallback test so each behaviour is asserted separately.

Generated-by: Claude Opus 5
@potiuk
potiuk merged commit bdfc02b into apache:main Oct 9, 2026
86 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants