gtxu opened a new pull request, #70960:
URL: https://github.com/apache/airflow/pull/70960

    <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   Service discovery systems with dynamic port mapping (like AWS Service
   Discovery for ECS) often define external services using DNS SRV records.
   Currently, reaching these services from Airflow requires routing traffic
   through a static load balancer.
   
   This pull request allows HttpHook and HttpAsyncHook
   to dynamically discover target hosts and ports using DNS SRV records.
   Instead of connecting to a stale IP, the hooks resolve the service
   name Just-In-Time (JIT) before making the request.
   
   This change introduces `dnspython` as an optional dependency to keep
   the core HTTP provider lightweight. To prevent DNS query flooding,
   a TTL cache mechanism is implemented.
   
    - Implemented soft dependency via the `srv` extra.
   
    - Built RFC 2782 compliant failover (lowest priority tier filtering
      and random target selection).
   
    - Added concurrency-safe TTL caching (`srv_cache_ttl`) using
      `asyncio.Lock` to prevent cache stampedes in asynchronous contexts.
   
    - Exposed `srv_lookup` and `srv_cache_ttl` configuration directly
      in the Airflow Connection UI via custom form widgets.
   
   closes: #9186
   
   <!--
   Thank you for contributing!
   
   Please provide above a brief description of the changes made in this pull 
request.
   Write a good git commit message following this guide: 
https://chris.beams.io/posts/git-commit/
   
   Please make sure that your code changes are covered with tests.
   And in case of new features or big changes remember to adjust the 
documentation.
   
   For user-facing UI changes, please attach before/after screenshots (or a 
short
   screen recording) so reviewers can assess the visual impact.
   
   Feel free to ping (in general) for the review if you do not see reaction for 
a few days
   (72 Hours is the minimum reaction time you can expect from volunteers) - we 
sometimes miss notifications.
   
   In case of an existing issue, reference it using one of the following:
   
   * closes: #ISSUE
   * related: #ISSUE
   -->
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, 
please
   change below checkbox to `[X]` followed by the name of the tool, uncomment 
the "Generated-by".
   -->
   
   - [X] Yes - Claude Sonnet 5
   
   Generated-by: Claude Sonnet 5 following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to