fix(server): rebuild extension proxy registry when secrets change#27726
Open
saidsef wants to merge 1 commit intoargoproj:masterfrom
Open
fix(server): rebuild extension proxy registry when secrets change#27726saidsef wants to merge 1 commit intoargoproj:masterfrom
saidsef wants to merge 1 commit intoargoproj:masterfrom
Conversation
🔴 Preview Environment stopped on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
7 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #27726 +/- ##
=======================================
Coverage 63.80% 63.80%
=======================================
Files 419 419
Lines 57221 57223 +2
=======================================
+ Hits 36509 36513 +4
- Misses 17290 17293 +3
+ Partials 3422 3417 -5 ☔ View full report in Codecov by Sentry. |
The watchSettings() loop only called UpdateExtensionRegistry() when ExtensionConfig (ConfigMap data) changed, but not when settings.Secrets changed. This meant that if secrets were populated after initial startup (e.g. by External Secrets Operator), the proxy registry was never rebuilt with resolved secret values. UpdateExtensionRegistry() runs parseAndValidateConfig() which calls ReplaceMapSecrets() to substitute $key references with actual secret values. Without rebuilding the registry on secret changes, proxies continued sending literal strings like $openai-api-key to backends, causing 401 errors. Add a check for settings.Secrets changes alongside ExtensionConfig changes, and update prevSecrets accordingly. Also add a test that verifies proxy headers are updated when secrets change. Signed-off-by: Said Sef <saidsef@gmail.com>
98feda1 to
6aa6dde
Compare
Author
|
Hey @agaudreault — would you mind taking a look when you get a chance? Given your work on the extension proxy, I think this is right in your wheelhouse. |
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.
Fixes #27758
Summary
Argo CD's proxy extension registry is rebuilt when
ExtensionConfigchanges, but not whenSecretschange. This means that if a user updates a secret referenced by an extension config (e.g. rotating an API key stored inargocd-secret), the proxy continues to use the old cached secret value until the nextExtensionConfigedit — or until the server restarts.This PR adds
settings.Secretsto the watch condition inserver.go:watchSettings(), ensuring the proxy registry is rebuilt whenever secrets are modified.Root cause
watchSettings()trackedprevExtConfigto detect changes, but ignoredprevSecrets. SinceReplaceMapSecrets()is called insideUpdateExtensionRegistry(), any new secret values were invisible to the proxy until something else triggered a registry rebuild.Changes
server/server.go: AddedprevSecretstracking alongsideprevExtConfigin the settings watch loop.server/extension/extension_test.go: AddedTestUpdateExtensionRegistryWithSecretsto verify that proxy headers are updated after a secret change triggers registry rebuild.Checklist