feat: make managed namespace configurable (USER_ARGOCD_NAMESPACE)#143
Merged
Conversation
The "user-argocd" namespace (where the operator manages AppProjects and the argocd static-user ConfigMap/Secret, and which scopes the manager's Secret/ConfigMap informer caches) was hardcoded. Replace the const with an exported `UserArgocdNS` resolved from the USER_ARGOCD_NAMESPACE env var, defaulting to "user-argocd" when unset. - controller: const -> env-backed var `UserArgocdNS` (+ testable `userArgocdNamespace()` helper); all references updated. - cmd/main.go: cache.Options scoping uses controller.UserArgocdNS. - manager.yaml sets USER_ARGOCD_NAMESPACE explicitly (default value). - Unit test for the env override; README documents the var. Backward-compatible: behavior is unchanged unless the env var is set. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #143 +/- ##
==========================================
+ Coverage 47.73% 47.94% +0.21%
==========================================
Files 8 8
Lines 970 974 +4
==========================================
+ Hits 463 467 +4
Misses 443 443
Partials 64 64 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What
The
user-argocdnamespace — where the operator manages AppProjects and the argocd static-user ConfigMap/Secret, and which scopes the manager's Secret/ConfigMap informer caches — was hardcoded in ~12 places. Make it configurable via theUSER_ARGOCD_NAMESPACEenv var (defaultuser-argocd).Changes
internal/controller: replaced theuserArgocdNSconst with an exported, env-backedUserArgocdNSvar (resolved by a testableuserArgocdNamespace()helper); updated all references.cmd/main.go: the cache-scopingcache.Options.ByObjectnow usescontroller.UserArgocdNSso the cache follows the configured namespace.config/manager/manager.yaml: setsUSER_ARGOCD_NAMESPACEexplicitly to the default for discoverability.TestUserArgocdNamespace) covering default + override; documented the var in the README.Backward-compatible — no behavior change unless the env var is set to something other than
user-argocd.🤖 Generated with Claude Code