You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Drop annotation toggle; use plain Get+Update for re-encoding
The annotation toggle was a workaround for a misdiagnosed problem.
Earlier in this branch we observed empty SSAs being elided and
generalised it to "all unmodified writes elide" — and added a
toolhive.stacklok.dev/storage-version-migrated-at annotation toggle
to force a real diff per write. A second-opinion investigation
pointed out the elision check happens AFTER storage encoding: the
apiserver re-encodes the request body at the current storage version,
then byte-compares against etcd. For the actual migration scenario
(CR stamped at an older apiVersion in etcd, storage version now newer)
the encoded apiVersion differs, the comparison fails, and the write
proceeds. Verified empirically: a CR stored at v1alpha1 with storage
flipped to v1beta1 has plain Get+Update bump RV from 202 to 204; a CR
already at v1beta1 has plain Get+Update elide cleanly. Both behaviours
are correct — the elision is exactly the no-migration-needed case.
Changes:
- restoreOne: plain Get + Update of the unmodified live object. No
annotation, no timestamp, no MigrationTimestampAnnotation constant.
- Controller docstring rewritten to describe the actual mechanism
(encode-then-compare elision) and cite ksvm#65 for posterity.
- HappyPath envtest loosened: per-CR resourceVersion bump assertions
are dropped (already-clean CRs correctly elide; checking RV bumps
on them was an artefact of the annotation-induced writes). The
storedVersions convergence assertion remains as the contract test.
- New cross-version envtest "re-encodes CRs that are stored at a
prior storage version" exercises the real migration scenario:
install CRD with v1alpha1 storage, create CR, flip storage to
v1beta1, run reconciler, assert storedVersions trims and the CR's
RV bumped (proving the apiserver actually rewrote etcd).
- User docs updated to drop annotation references and describe the
real mechanism. Reference implementation citation switched from
cluster-api/crdmigrator to kube-storage-version-migrator (the
actual upstream SIG tool we share semantics with).
- FallsBackWhenNoStatusSubresource test removed: the SSA path it
exercised no longer exists. Plain Update on a CRD without /status
is just a normal Update; covered by the happy-path spec.
8/8 envtest cases pass. Lint clean. No RBAC drift (verbs already
correct).
Refs PR #5011 review by @jhrozek.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments