Commit b1a112f
fix(redisproxy): support classic ArgoCD applications without agent prefix
## Problem
The redisproxy implementation strictly required all Redis keys to start with
an agent name prefix in the format 'agentName_'. This worked for agent-managed
applications but broke for classic ArgoCD applications (using token authentication)
which generate Redis keys without any prefix.
When a key without the prefix arrived at redisproxy, the extractAgentNameFromRedisCommandKey
function would fail with 'unexpected lack of "_" namespace/name separator' error,
causing PUB/SUB connections to drop and resource requests for classic applications
to fail completely.
## Solution
Modified extractAgentNameFromRedisCommandKey function to gracefully handle Redis keys
without the agent prefix by:
1. Detecting keys without underscore separator in the namespace field
2. Returning empty string (instead of error) for non-agent-prefixed keys
3. This allows these keys to be routed to the principal Redis instead of failing
The routing logic in handleConnectionMessageLoop already supports this via the
'if agentName != ""' check, which will forward local keys to principal Redis.
## Changes Made
### principal/redisproxy/redisproxy.go
- Modified extractAgentNameFromRedisCommandKey() function
- Changed error case for missing underscore to return empty string with debug log
- Updated comments to clarify behavior for classic vs agent-managed applications
### principal/redisproxy/redisproxy_test.go
- Updated test cases to reflect new behavior
- Changed 'errorExpected: true' to 'errorExpected: false' for classic app keys
- Updated test descriptions to clarify that keys without prefix are classic apps
## Testing
✅ All existing tests pass (21 tests in redisproxy package)
✅ Code compiles without errors
✅ Multi-platform Docker image builds successfully (linux/amd64 and linux/arm64)
## Impact
- ✅ Agent-managed applications continue to work as before
- ✅ Classic ArgoCD applications now work correctly
- ✅ Mixed environments with both types of applications are now supported
- ✅ No breaking changes to existing functionality
## Example Routing
- Agent-managed key: 'app|managed-resources|agent-managed_my-app|1.8.3'
→ Routed to agent via gRPC
- Classic app key: 'app|managed-resources|my-app|1.8.3'
→ Routed to principal Redis (control plane)
Signed-off-by: Petr Lebedev <[email protected]>1 parent a62e7e0 commit b1a112f
File tree
3 files changed
+9
-7
lines changed- principal/redisproxy
3 files changed
+9
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
814 | 814 | | |
815 | 815 | | |
816 | 816 | | |
| 817 | + | |
| 818 | + | |
817 | 819 | | |
818 | | - | |
819 | | - | |
820 | | - | |
| 820 | + | |
| 821 | + | |
821 | 822 | | |
822 | 823 | | |
823 | 824 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
0 commit comments