Commit 746f35f
committed
🐛 Fakeclient: Allow concurrent patching if RV is unset
Currently, the fake client always errors if patches are done
concurrently rather than only if the patch contains a ResourceVersion.
This is because we have a number of checks including the one related to
resourceVersion implemented in a `versionedTracker`. The
`versionedTracker` receives the patched object and assumes that the
patchedObject only contains a RV if the patch had one. That turns out
not to be true, it almost always has one.
The reason the object we receive in the `versionedTracker` almost always
has a RV is that we use a client-go reactor to apply the patch to an
object. The way this works is that the reactor takes the patch and a
tracker, fetches the object from the tracker and applies the patch to
it. This means that the resulting object always has a resourceVersion
unless the patch explicitly set it to `null`. This `null` case
apparently is special cased in the Kubernetes apiserver to be
acceptable, so we do the same here.
Fix the original issue by checking in the fakeclient if the patch
modifies the RV and if not, retry conflicts.1 parent 5af6ffa commit 746f35f
2 files changed
+78
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
471 | 476 | | |
472 | 477 | | |
473 | 478 | | |
| |||
904 | 909 | | |
905 | 910 | | |
906 | 911 | | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
907 | 922 | | |
908 | 923 | | |
909 | 924 | | |
| |||
912 | 927 | | |
913 | 928 | | |
914 | 929 | | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
915 | 933 | | |
916 | 934 | | |
917 | 935 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
580 | 581 | | |
581 | 582 | | |
582 | 583 | | |
583 | | - | |
| 584 | + | |
584 | 585 | | |
585 | 586 | | |
586 | 587 | | |
| |||
605 | 606 | | |
606 | 607 | | |
607 | 608 | | |
| 609 | + | |
608 | 610 | | |
609 | 611 | | |
610 | 612 | | |
| |||
2134 | 2136 | | |
2135 | 2137 | | |
2136 | 2138 | | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
2137 | 2194 | | |
2138 | 2195 | | |
2139 | 2196 | | |
| |||
2288 | 2345 | | |
2289 | 2346 | | |
2290 | 2347 | | |
2291 | | - | |
2292 | | - | |
| 2348 | + | |
| 2349 | + | |
2293 | 2350 | | |
2294 | 2351 | | |
2295 | 2352 | | |
| |||
0 commit comments