Skip to content

Conversation

chetan-rns
Copy link
Collaborator

What does this PR do / why we need it:

  • Add informers to both agent and principal to reconcile repository secrets
  • Propagate the repository secrets to the correct target agent based on AppProjects.
  • Cache the mapping between repos to agents in case the AppProject is deleted.
  • Add unit tests and e2e tests

Which issue(s) this PR fixes:

Fixes #474

How to test changes / Special notes to the reviewer:

  1. Create an AppProject on the principal cluster targeting one of the managed agents.
  2. Create a repository secret referring to the newly created AppProject
  3. Repository must be synced to the managed agent.

Checklist

  • Documentation update is required by this PR (and has been updated) OR no documentation update is required.

@codecov-commenter
Copy link

codecov-commenter commented Aug 20, 2025

Codecov Report

❌ Patch coverage is 42.69311% with 549 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.23%. Comparing base (398a271) to head (2ec11ef).

Files with missing lines Patch % Lines
internal/manager/repository/repository.go 18.97% 109 Missing and 2 partials ⚠️
internal/resync/resync.go 11.82% 79 Missing and 3 partials ⚠️
internal/manager/manager.go 0.00% 75 Missing ⚠️
...ternal/backend/kubernetes/repository/kubernetes.go 34.44% 59 Missing ⚠️
agent/inbound.go 62.67% 39 Missing and 14 partials ⚠️
principal/server.go 38.55% 42 Missing and 9 partials ⚠️
principal/callbacks.go 74.41% 38 Missing and 6 partials ⚠️
agent/agent.go 16.66% 23 Missing and 2 partials ⚠️
internal/event/event.go 0.00% 17 Missing ⚠️
agent/outbound.go 83.09% 11 Missing and 1 partial ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #526      +/-   ##
==========================================
- Coverage   45.16%   44.23%   -0.93%     
==========================================
  Files          88       89       +1     
  Lines       10945    11757     +812     
==========================================
+ Hits         4943     5201     +258     
- Misses       5611     6129     +518     
- Partials      391      427      +36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chetan-rns chetan-rns marked this pull request as ready for review August 21, 2025 12:38
@jannfis
Copy link
Collaborator

jannfis commented Aug 25, 2025

I'm just testing this PR locally, and most of the things work really great.

I noticed one thing:

  • I have scoped a repository to a project. The project itself allows the agent-managed cluster.
  • The repository gets propagated to the agent-managed agent, and is created on the target cluster.
  • I stop the principal temporarily and make a change to the project, removing the agent-managed from the list of allowed destinations.
  • I start the principal again. The agent reconnects, but the repository credentials are never removed from the agent-managed cluster

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Assisted-by: Cursor
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
@chetan-rns
Copy link
Collaborator Author

I start the principal again. The agent reconnects, but the repository credentials are never removed from the agent-managed cluster

@jannfis I've fixed the resync issue. Also added a few e2e tests to verify the resyncing of AppProject/Repository on restarts.

Copy link
Collaborator

@jannfis jannfis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Awesome PR, @chetan-rns 🙇

@jannfis jannfis merged commit e2ef906 into argoproj-labs:main Aug 29, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for private repositories
3 participants