-
Notifications
You must be signed in to change notification settings - Fork 38
fix: sync default appproject updates to managed agents #529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #529 +/- ##
==========================================
+ Coverage 45.10% 45.19% +0.08%
==========================================
Files 88 88
Lines 10945 10992 +47
==========================================
+ Hits 4937 4968 +31
- Misses 5618 5631 +13
- Partials 390 393 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
// 2. The destination server is a wildcard AND | ||
// 3. The agent name is not denied by any of the destination names | ||
// Ref: https://github.com/argoproj/argo-cd/blob/master/pkg/apis/application/v1alpha1/app_project_types.go#L477 | ||
func doesAgentMatchWithProject(agentName string, appProject v1alpha1.AppProject) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the argo-cd code, it checks for both the destination name and the server, and either one of them should match. But the principal isn't aware of the workload cluster's server URL, and the cluster secret points to the resource proxy. So, if the user doesn't want to use the name, the only option is to use a wildcard for the server. i.e, we match the agent if the server is * even if the name doesn't match. WDYT?
I guess we could pass the workload cluster URL to the principal in the client context. But so far, the principal doesn't know about the workload cluster, and the agent is the only point of contact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and either one of them should match
Either one should match or be empty. Setting both fields as destination at the same time is imho not supported by Argo CD, i.e. you need to set either name or server, but not both.
the cluster secret points to the resource proxy
The cluster secret points to a specific URL including the agent-name in the query param, so a user could match it. However, I think it would be fair to force the user to use the name of the agent instead of the server URL for now. The URLs will all look similar, except for the suffix, anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've updated the logic to compare the agent name from the server URL query param. The server URL check is required for the default AppProject, which doesn't have the destination name set initially. The function will only compare the server if the name is not provided.
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>
Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
ca3e66a
to
2b021b5
Compare
@chetan-rns The merge of #526 introduced some conflicts that need to be resolved. |
What does this PR do / why we need it:
The principal should propagate default AppProject updates to the managed agents. This PR handles several issues:
Which issue(s) this PR fixes:
Fixes #509
How to test changes / Special notes to the reviewer:
Checklist