Add RegisterProviderFactory extension point to pkg/config#4340
Merged
aponcedeleonch merged 1 commit intomainfrom Mar 24, 2026
Merged
Add RegisterProviderFactory extension point to pkg/config#4340aponcedeleonch merged 1 commit intomainfrom
aponcedeleonch merged 1 commit intomainfrom
Conversation
NewProvider() currently hard-codes the selection between KubernetesProvider and DefaultProvider with no way for downstream consumers to inject a custom Provider implementation. This adds a ProviderFactory registration hook so that callers can register a custom factory at startup, and NewProvider() will use it before falling back to the built-in logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4340 +/- ##
==========================================
- Coverage 69.30% 68.92% -0.39%
==========================================
Files 478 479 +1
Lines 48425 48489 +64
==========================================
- Hits 33559 33419 -140
- Misses 12271 12335 +64
- Partials 2595 2735 +140 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
JAORMX
approved these changes
Mar 24, 2026
amirejaz
approved these changes
Mar 24, 2026
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.
Summary
NewProvider()currently hard-codes the selection betweenKubernetesProviderandDefaultProviderwith no way for downstream consumers to inject a customProviderimplementation without forkingProviderFactoryregistration hook (RegisterProviderFactory) so that callers can register a custom factory at startup, andNewProvider()will consult it before falling back to the built-in logicniltriggers the fallback rather than a nil-pointer dereferenceType of change
Changes
pkg/config/factory.goProviderFactorytype,registeredFactoryvar,RegisterProviderFactoryfuncpkg/config/interface.goNewProvider()to consultregisteredFactorybefore built-in logicpkg/config/factory_test.goTest plan
go test ./pkg/config/)task lint)Generated with Claude Code