Skip to content

feat: make managed namespace configurable (USER_ARGOCD_NAMESPACE)#143

Merged
1995parham merged 1 commit into
mainfrom
feat/configurable-user-argocd-ns
Jun 20, 2026
Merged

feat: make managed namespace configurable (USER_ARGOCD_NAMESPACE)#143
1995parham merged 1 commit into
mainfrom
feat/configurable-user-argocd-ns

Conversation

@1995parham

Copy link
Copy Markdown
Member

What

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 in ~12 places. Make it configurable via the USER_ARGOCD_NAMESPACE env var (default user-argocd).

Changes

  • internal/controller: replaced the userArgocdNS const with an exported, env-backed UserArgocdNS var (resolved by a testable userArgocdNamespace() helper); updated all references.
  • cmd/main.go: the cache-scoping cache.Options.ByObject now uses controller.UserArgocdNS so the cache follows the configured namespace.
  • config/manager/manager.yaml: sets USER_ARGOCD_NAMESPACE explicitly to the default for discoverability.
  • Added a unit test (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

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

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.22222% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.94%. Comparing base (6901f6c) to head (710a4e9).

Files with missing lines Patch % Lines
internal/controller/argocduser_controller.go 66.66% 0 Missing and 3 partials ⚠️
cmd/main.go 0.00% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@1995parham 1995parham merged commit 43fd237 into main Jun 20, 2026
5 checks passed
@1995parham 1995parham deleted the feat/configurable-user-argocd-ns branch June 20, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant