Add first-class support for external destination clusters in ArgoCD with strict error handling#100
Draft
Add first-class support for external destination clusters in ArgoCD with strict error handling#100
Conversation
Co-authored-by: NiklasRosenstein <1318438+NiklasRosenstein@users.noreply.github.com>
…ocumentation Co-authored-by: NiklasRosenstein <1318438+NiklasRosenstein@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] First-class support for external destination clusters in ArgoCD
Add first-class support for external destination clusters in ArgoCD
Aug 10, 2025
src/nyl/commands/template.py
Outdated
| logger.info("Using destination cluster client for lookups") | ||
| client = destination_client | ||
| else: | ||
| logger.warning("Failed to create destination cluster client, falling back to ArgoCD cluster client") |
Collaborator
There was a problem hiding this comment.
@copilot I think we should error here instead of falling back.
Author
There was a problem hiding this comment.
Changed to error instead of fallback. Now raises a RuntimeError with a clear message when destination cluster client creation fails, ensuring we fail fast instead of silently using the wrong cluster. Commit: 417eb70
Replace fallback behavior with RuntimeError when ArgoCD destination cluster client creation fails, as requested in code review. This ensures we fail fast instead of silently using the wrong cluster for lookups. Co-authored-by: NiklasRosenstein <1318438+NiklasRosenstein@users.noreply.github.com>
Copilot
AI
changed the title
Add first-class support for external destination clusters in ArgoCD
Add first-class support for external destination clusters in ArgoCD with strict error handling
Aug 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.