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

   **Tl;dr:** A Kubernetes ConfigMap or Secret mounted as the plugins or Dags 
folder no longer fails file discovery with "Detected recursive loop".
   
   **Context:**
   
   The kubelet writes these volumes with its 
[AtomicWriter](https://github.com/kubernetes/kubernetes/blob/3c690c189e5d/pkg/volume/util/atomic_writer.go#L120-L134):
 the files live in a hidden `..<timestamp>` directory, `..data` links to it, 
and every visible entry is a symlink through `..data`. Walking with 
`followlinks=True` reaches the timestamped directory twice, so the loop check 
raises `RuntimeError: Detected recursive loop when walking DAG directory 
/opt/airflow/plugins: /opt/airflow/plugins/..2026_10_31_12_00_00.123456789 has 
appeared more than once.` For the plugins folder this crash-loops the 
api-server.
   
   **This Change:**
   
   - In a directory that contains `..data`, skip the `..`-prefixed entries; the 
files are still found once, through the visible symlinks
   - Kubernetes reserves that prefix 
([validatePath](https://github.com/kubernetes/kubernetes/blob/3c690c189e5d/pkg/volume/util/atomic_writer.go#L286-L323)
 rejects user paths starting with `..`), so no user file is skipped
   - The recursive-loop check itself is unchanged (see #40982)
   
   **Test Plan:**
   
   - [x] New test of the kubelet layout with an `.airflowignore` from the 
volume: fails on main, passes with the fix
   - [x] `shared/module_loading` tests, ruff and prek (including mypy) pass on 
the changed files
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Claude Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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