Skip to content

Add OpenFeature provider - #70353

Closed
1fanwang wants to merge 1 commit into
apache:mainfrom
1fanwang:add-openfeature-provider
Closed

Add OpenFeature provider#70353
1fanwang wants to merge 1 commit into
apache:mainfrom
1fanwang:add-openfeature-provider

Conversation

@1fanwang

Copy link
Copy Markdown
Contributor

Why

Airflow has no vendor-neutral way to evaluate feature flags. Teams that want to canary or
progressively roll out a change (a new operator behavior, a migration, an executor option) either
hard-code a specific vendor SDK inside a PythonOperator or write a bespoke hook per backend.
OpenFeature is the CNCF standard for exactly this: one evaluation API with
a pluggable provider per backend (flagd, GrowthBook, Unleash, an in-house system).

What

A new apache-airflow-providers-openfeature provider:

  • OpenFeatureHook — registers an OpenFeature provider from a connection and evaluates
    boolean/string flags with a targeting context.
  • FeatureFlagSensor — waits until a flag is enabled for a targeting entity, e.g. hold a task until a
    rollout reaches its dag_id.
  • FractionalProvider — a dependency-free, in-process provider for deterministic percentage rollouts,
    so a canary works with no external flag daemon (mirrors flagd's fractional op).

The hook also backs a cluster-policy pattern (documented in the provider index): consult a flag from
task_policy in airflow_local_settings.py to flip a cohort's pool/queue and ramp a platform
change like a canary, with no core change. That progressive-delivery use case is the point; the
sensor and hook are the building blocks.

Scope is intentionally small to open the discussion. Out of scope here: vendor-specific provider
adapters (those belong to each vendor or the user's own code), named-client multi-provider setups, and
any core change.

Tests

providers/openfeature/tests/unit — 11 unit tests: the fractional provider (determinism, ramp
distribution, weighted variants), the hook (global-provider fallback, provider registration from a
connection, register-once), and the sensor (enabled, disabled, expected). Green on Airflow 3.2.2 with
openfeature-sdk 0.10.0.

Risk

Additive and opt-in: a new provider, nothing existing changes. openfeature-sdk is the only new
dependency and is pulled only when the provider is installed. FractionalProvider is a convenience for
testing and simple rollouts; production points OpenFeature at a real backend.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: GitHub Copilot CLI following the guidelines

Introduce a provider for OpenFeature (https://openfeature.dev), the CNCF vendor-neutral
feature-flag evaluation API. It lets DAG code and cluster policies evaluate flags against
any OpenFeature backend (flagd, GrowthBook, Unleash, an in-house system) without changing
call sites.

Ships:
- OpenFeatureHook: register a provider from a connection and evaluate boolean/string flags.
- FeatureFlagSensor: wait until a flag is enabled for a targeting entity.
- FractionalProvider: a dependency-free in-process provider for deterministic percentage
  rollouts, so a canary works without running a flag daemon.

The hook can back a task_policy to progressively deliver a platform change to a DAG/task
cohort with no core change (documented in the provider index).

Signed-off-by: 1fanwang <1fannnw@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant