k3s-io / kine

Run Kubernetes on MySQL, Postgres, sqlite, dqlite, not etcd.
Apache License 2.0
1.56k stars 233 forks source link

Failed delete must return a ResponseRange instead #147

Closed neoaggelos closed 1 year ago

neoaggelos commented 1 year ago

Summary

Follow-up PR for #145 to account for delete operations that do not succeed.

For more context see:

@brandond Apologies for the initial PR being incomplete, I'm testing this as I go as well :) With this change I don't see anything blowing up, so things should be fine now.

brandond commented 1 year ago

Right, this would probably be harder to get wrong if we actually looked at the transaction operation that the apiserver is trying to do, instead of assuming it and hardcoding the responses. Unfortunately, making assumptions is a lot easier than implementing the full transaction syntax.

This says "if the revision is equal, then delete, otherwise get": https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/storage/etcd3/store.go#L326-L332