feat(register): expose Backend wrapper for registry (KPEP-0001 phase 2)#1
Closed
zachsmith1 wants to merge 2 commits into
Closed
feat(register): expose Backend wrapper for registry (KPEP-0001 phase 2)#1zachsmith1 wants to merge 2 commits into
zachsmith1 wants to merge 2 commits into
Conversation
…y (KPEP-0001 phase 2) Adds register.go: an Options struct that implements registry.Backend so the kplane apiserver can register Spanner against a *registry.Backends in its Phase 3 dispatch swap, without the apiserver source needing to know anything Spanner-specific. The wrapper is thin: NewOptions() returns an Options whose Build() calls the existing NewBackendFactory. Identical store/broadcaster/watcher behavior to the legacy 'if opts.SpannerProject != ""' branch in the apiserver, so the Phase 3 cutover is behavior-preserving. Bumps go.mod fork pin to the cherry-pick branch (kplane-dev/kubernetes#3) so 'storage.WithDecodeCallback' resolves at the storage package — that's the symbol watcher.go/store.go have been calling since they were written, but no merged fork commit exposed it publicly until the cherry-pick. Also adds the github.com/kplane-dev/storage require (registry/ subpackage) pinned to the kpep-0001/add-registry branch head. Once both prerequisite PRs merge, a follow-up bumps these pins to whichever main SHAs end up containing them. Tested: - go build ./... clean (was previously broken at HEAD). - go test -run 'TestOptions|TestAddFlags|TestValidate|TestRegister' ./... passes against the published storage branch. - Existing emulator-backed store tests still gated on SPANNER_EMULATOR_HOST. See KPEP-0001 in kplane-dev/enhancements for the design rationale, and the chain: - kplane-dev/kubernetes#3 (fork: move DecodeCallback to storage pkg) - kplane-dev/storage#2 (registry types) - this PR (Spanner Register wrapper) - kplane-dev/apiserver#? (TBD: dispatch swap)
3 tasks
…-0001 head Aligns with the consolidated KPEP-0001 fork branch. Both prerequisite features (DecodeCallback move + per-cluster allocators) live there; the former is what unblocks store.go/watcher.go from using storage.WithDecodeCallback. Apiserver Phase 3 will pin the same fork SHA.
zachsmith1
added a commit
to kplane-dev/storage
that referenced
this pull request
Jun 17, 2026
…P-0001)
Brings the Spanner backend into kplane-dev/storage as the first in-tree
implementation, matching the KPEP-0001 end-state layout:
kplane-dev/storage/
registry/ (added in previous commits)
decorator.go BackendFactory = registry.Factory alias
backends/
register.go RegisterBuiltin(b) aggregator
spanner/
broadcast.go, config.go,
factory.go, register.go,
store.go, watcher.go,
store_test.go, register_test.go
What this collapses:
- Drops the standalone kplane-dev/spanner repo entirely. It existed only
because BackendFactory needed to be declared somewhere without
importing kplane-dev/storage (the 'avoid an import cycle' comment in
the old factory.go). Now that Spanner is a subpackage of
kplane-dev/storage, it references storage.BackendFactory directly.
- BackendFactory is now a type alias to registry.Factory, so the
apiserver can pass registry.Backend.Build()'s return value into
DecoratorConfig without a conversion.
- The aggregator (backends/register.go) is one import + one Register()
call per backend. Adding postgres or kine in the future means editing
one file here, not the apiserver.
Tested:
- go test ./registry/... ./backends/... clean.
- Spanner emulator-backed tests pass.
- decorator.go alias compiles cleanly; the BackendFactory hook path in
StorageWithClusterIdentity is unchanged.
Follow-up: archive kplane-dev/spanner (or leave as a one-release re-export
shim). kplane-dev/spanner#1 will be closed since its work is now here.
See KPEP-0001 in kplane-dev/enhancements for the design.
Contributor
Author
|
Closing. KPEP-0001 collapses kplane-dev/spanner into kplane-dev/storage/backends/spanner/ — see kplane-dev/storage#2 for the migrated source. The standalone repo's BackendFactory duplication ('to avoid an import cycle') goes away when Spanner lives as a subpackage of storage. |
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
Phase 2 of KPEP-0001 (pluggable storage backends). Adds a thin `Options` struct that implements `registry.Backend` from `kplane-dev/storage/registry` so the kplane apiserver can register Spanner against a `*registry.Backends` without the apiserver source needing to know anything Spanner-specific.
What's in the package
Two go.mod bumps
This PR pins:
Once both prerequisite PRs merge, a follow-up bumps these pins to whichever `main` SHAs end up containing them.
Merge chain
This PR is the third link:
Test plan
See KPEP-0001 in kplane-dev/enhancements for the design rationale.