feat: add ARGOCD_REDIS_SERVER to support external Redis (#24406) #25906
+91
−0
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.
Checklist:
Summary
This PR addresses issue #24406. ( Fixes #24406 )
The core problem occurs when users want to use an external Redis instance instead of the bundled in-cluster Redis for better maintainability and scalability.
To replicate the issue in a test environment, I configured Argo CD to run in a Minikube cluster and attempted to connect it to an external Redis running in a separate, logically isolated Docker container.
Problem Replay
The following command was used to attempt cluster creation.
argocd cluster add minikube --name cluster-name --upsert --yes --coreAs a result, the following fatal error was encountered.
In contrast, when using the in-cluster Redis (without the
--coremode or when the Redis pod is available),the command completes successfully. (
Cluster 'https://127.0.0.1:61284' added)Changes
I have identified that when creating a cluster using the
--coreCLI, the execution flow enters thedoLazyfunction within theheadless.gofile. To address the reported issue, I introduced a new environment variableARGOCD_REDIS_SERVERto store connection information for an external Redis instance.In this logic, externalRedis retrieves the connection details from the $ARGOCD_REDIS_SERVER environment variable:
Verification
If the in-cluster Redis is active and the environment variable is not set, the CLI correctly falls back to the default behavior.
Notes
ARGOCD_prefix to maintain consistency with Argo CD's existing environment variable naming conventions. Please let me know if any changes are required.REDIS_PASSWORDlogic.