Skip to content

feat(storage): move DecodeCallback to storage package, add SetFeatureSupported#3

Closed
zachsmith1 wants to merge 1 commit into
mainfrom
feat/decode-callback-storage-package
Closed

feat(storage): move DecodeCallback to storage package, add SetFeatureSupported#3
zachsmith1 wants to merge 1 commit into
mainfrom
feat/decode-callback-storage-package

Conversation

@zachsmith1

Copy link
Copy Markdown
Contributor

Summary

Cherry-picks 32f5e90 off the `feat/per-cluster-allocators` branch so the relocation can land independently of the larger per-cluster-allocators work. The change is a pure prerequisite for KPEP-0001 (pluggable storage backends) — without it, non-etcd backends cannot honor the cacher-installed decode callback.

Two related changes in one commit:

  1. `DecodeCallback` / `WithDecodeCallback` / `DecodeCallbackFromContext` move from `k8s.io/apiserver/pkg/storage/etcd3` → `k8s.io/apiserver/pkg/storage`. Backwards-compat aliases stay in `etcd3` (marked `Deprecated:`) so any in-tree caller still compiles.
  2. `feature.SetFeatureSupported()` added to the storage feature checker so non-etcd backends (Spanner) can declare native support for capabilities like `RequestWatchProgress` without bolting on a fake etcd implementation.

Why now

KPEP-0001 lands a registry of pluggable storage backends in `kplane-dev/storage`, with Spanner as the first non-etcd consumer. Spanner's source already uses `storage.WithDecodeCallback`, but no merged fork commit exposes it at the `storage` package — Spanner doesn't build standalone today. Pulling this commit out of `feat/per-cluster-allocators` (which has unrelated changes still in flight) unblocks:

  • `kplane-dev/storage` PR — registry types
  • `kplane-dev/spanner` PR — `Register()` wrapper
  • `kplane-dev/apiserver` PR — dispatch swap

…all of which can pin against this branch via pseudo-version while we iterate, then move to `main` once this merges.

Files

  • `staging/src/k8s.io/apiserver/pkg/storage/decode_callback.go` — new (42 lines)
  • `staging/src/k8s.io/apiserver/pkg/storage/etcd3/decode_callback.go` — now a thin shim of deprecated aliases
  • `staging/src/k8s.io/apiserver/pkg/storage/cacher/lister_watcher.go` — 3-line import update so the cacher uses the new location
  • `staging/src/k8s.io/apiserver/pkg/storage/feature/feature_support_checker.go` — adds `SetFeatureSupported()`

Test plan

  • `go build ./pkg/storage/... ./pkg/storage/etcd3/... ./pkg/storage/feature/...` clean.
  • `kplane-dev/spanner` with go.mod fork pin bumped to this branch's HEAD: `go build ./...` clean (currently fails — that's the symptom).
  • In-tree etcd3 callers via the deprecated aliases compile unchanged.

Original commit author/co-author preserved from the cherry-pick.

- Move DecodeCallback from etcd3 to storage package so non-etcd backends
  (Spanner) can use it
- Add deprecated aliases in etcd3 for backwards compatibility
- Add SetFeatureSupported() on feature checker so non-etcd backends can
  declare native feature support (e.g. RequestWatchProgress)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zachsmith1

Copy link
Copy Markdown
Contributor Author

Closing in favor of pinning directly against feat/per-cluster-allocators — that branch already contains this cherry-pick (32f5e90) plus the per-cluster allocator helpers the apiserver also needs. The KPEP-0001 PR chain (kplane-dev/storage#2, kplane-dev/spanner#1, kplane-dev/apiserver#TBD) will pin against feat/per-cluster-allocators HEAD instead of this branch, and move to whichever main SHA the per-cluster-allocators feature lands on.

@zachsmith1 zachsmith1 closed this Jun 16, 2026
@zachsmith1 zachsmith1 deleted the feat/decode-callback-storage-package branch June 16, 2026 23:51
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