-
Notifications
You must be signed in to change notification settings - Fork 62
🐛 Demonstrate that admission cannot ensure field uniqueness. #819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
The only field you can practically guarantee uniqueness on is .metadata.name because it is used to construct the etcd key, and etcd does offer consistency. API servers can't because they can handle more than one concurrent request for the same resource and both can be past admission but before storage. There's also latency between creation and an update to the binding's param informer. The problems gets worse in HA setups when you have multiple kube-apiserver instances.
5ab410d
to
cfb453e
Compare
@joelanford @m1kola FYI |
|
Thanks! And also, 😭. As our resident apiserver experts, do you have any suggestions about how to handle package uniqueness. Should we keep these best effort admission checks and then fallback to a reconciler-based check? Even then, it seems like we'd need to have some synchorization going on to avoid similar problems detecting dups in a reconciler. |
If you must guarantee that at most one ClusterExtension resource can have a certain package name, the only practical option is to validate that ClusterExtension's metadata.name is the same as spec.packageName. If you do that, duplicate name conflicts come from the etcd level and will be consistent. The prior art on this that comes to mind is name validation for CustomResourceDefinitions and the singleton pattern (validating that metadata.name matches some constant string). |
I think that's what OCP platform-operators does. I need to see if all package names validate as |
Thanks for the demo and explanation. At some point I was wondering about issues of this sort. My bad for not digging deeper. |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Please hold this from merging till #846 gets in. Thanks! |
Description
The only field you can practically guarantee uniqueness on is .metadata.name because it is used to construct the etcd key, and etcd does offer consistency. API servers can't because they can handle more than one concurrent request for the same resource and both can be past admission but before storage. There's also latency between creation and an update to the binding's param informer. The problems gets worse in HA setups when you have multiple kube-apiserver instances.
This test nearly always fails on my machine against a kind cluster set up with
make run
:Reviewer Checklist