Add first-class support for external destination clusters in ArgoCD with strict error handling #100
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements automatic external destination cluster support for Nyl when used as an ArgoCD plugin, enabling
lookup()functions to work seamlessly against clusters different from the ArgoCD cluster itself.Problem
Previously, Nyl's
lookup()function only worked against the local ArgoCD cluster because it used in-cluster configuration. When an ArgoCD Application's destination cluster was different from the ArgoCD cluster, lookups would fail:Solution
Added transparent external cluster detection and credential resolution with strict error handling:
ARGOCD_APP_NAME, etc.)lookup()calls automatically use the destination clusterKey Features
Error Behavior
When running in ArgoCD context with an external destination cluster, if the destination cluster credentials cannot be resolved or the client cannot be created, Nyl will now raise a
RuntimeErrorwith a clear message instead of silently falling back to the ArgoCD cluster. This prevents potentially dangerous situations where deployments might target the wrong cluster.Files Changed
src/nyl/tools/argocd.py- New ArgoCD integration utilitiessrc/nyl/commands/template.py- Modified to use destination cluster client with strict error handlingsrc/nyl/tools/argocd_test.py- Comprehensive test suite covering all scenariosdocs/content/reference/cluster-connectivity.md- Updated documentationFixes #27.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.