• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 18715236732

22 Oct 2025 11:52AM UTC coverage: 46.595% (-1.2%) from 47.776%
18715236732

push

github

web-flow
Refactor: Extract common controller helpers to dedicated package (#2283)

Extract common helpers to dedicated package

Move ~900 lines of shared helper code from controllers/common_helpers.go
and controllers/config_helpers.go into a new dedicated package at
cmd/thv-operator/pkg/controllerutil/.

The new package organizes utilities by domain:
- platform.go: Platform detection (Kubernetes vs OpenShift)
- rbac.go: RBAC resource management helpers
- resources.go: Resource builders and metadata utilities
- authz.go: Cedar authorization configuration
- oidc.go: OIDC authentication configuration
- tokenexchange.go: OAuth2 token exchange middleware
- config.go: Configuration tracking and hashing

This refactoring:
- Improves code organization and reusability
- Sets foundation for Phase 2 of generic reconciler pattern
- Maintains 100% functional equivalence (no behavior changes)
- Updates all imports to use ctrlutil alias
- Exports previously private constants (defaultAuthzKey -> DefaultAuthzKey)
- Moves tests to new package location

All existing tests pass and linter reports 0 issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>

49 of 614 new or added lines in 15 files covered. (7.98%)

3 existing lines in 2 files now uncovered.

18232 of 39129 relevant lines covered (46.59%)

15.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cmd/thv-operator/pkg/controllerutil/platform.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc