kcp icon indicating copy to clipboard operation
kcp copied to clipboard

Fix conditionalDelete returning no success for undecodable objects in 1.37.0 rebase

Open mjudeikis-bot opened this issue 1 month ago • 0 comments

What exists today

In the kcp-dev/kubernetes 1.37.0 rebase (PR https://github.com/kcp-dev/kubernetes/pull/198, head 5ec79958933dfa6999e77eab9e90b691e26fbcd5), conditionalDelete in staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go (around lines 470-485) has the final return nil inside the if !expectTransformOrDecodeError { ... } block:

if !expectTransformOrDecodeError {
    err = s.decode(s.codec, s.versioner, origState.data, out, txnResp.Revision, clusterName, shardName)
    if err != nil {
        recordDecodeError(s.groupResource, key)
        return err
    }
    return nil
}

Upstream returns nil after that block, unconditionally. When ExpectTransformOrDecodeError is set (deleting a corrupt or undecodable object), the loop continues after OptimisticDelete has already succeeded. It then retries against a key that no longer exists, so the delete never returns success.

Review comment that raised it: https://github.com/kcp-dev/kubernetes/pull/198#discussion_r4413090476 Request to track it: https://github.com/kcp-dev/kubernetes/pull/198#discussion_r4421218709

What should replace it

Move return nil out of the if, matching upstream, so a successful delete always returns.

Steps

  • [ ] Move return nil after the if !expectTransformOrDecodeError block in conditionalDelete in the kcp-dev/kubernetes 1.37.0 branch (or the patch in kcp-dev/kubernetes-patches).
  • [ ] Add or run a test that deletes a corrupt object with ExpectTransformOrDecodeError set and expects success.
  • [ ] Confirm the diff against upstream conditionalDelete is empty for this block.
  • [ ] Make sure the fix lands before kcp bumps to 1.37.0.

mjudeikis-bot avatar Oct 30 '26 07:10 mjudeikis-bot