Commit 12db325
committed
operator v1: use uncached client in initial Get Cluster
It's possible that Get returns a cached, stale value - even if the
missed change was performed in the same process. This is because of
various trade-offs made in controller-runtime's cache layers.
This brings the controller in a dangerous situtation, in practice it
happens that a previous run reduced status.currentReplicas from 3 to 2,
but the next run reads a stale object and sees 3.
To avoid this bug, and other bugs we can not yet foresee, we will
perform this one Get with an uncached read. It is a trade-off, where we
accept a performance hit, and increased load on kube-api server, but we
value the consistency higher. This is limited to this one, most
important Get call, of Cluster resource only (one per entire Reconcile).
Since controller-runtime has throttling built in, and it's only "that
on Cluster Get call", we believe this trade-off is acceptable, and the
benefits outweight the cost.1 parent a0c76f8 commit 12db325
File tree
2 files changed
+26
-9
lines changed- operator
- cmd/run
- internal/controller/vectorized
2 files changed
+26
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
255 | 262 | | |
256 | 263 | | |
| 264 | + | |
257 | 265 | | |
258 | 266 | | |
259 | 267 | | |
| |||
Lines changed: 18 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
134 | 144 | | |
135 | | - | |
| 145 | + | |
136 | 146 | | |
137 | | - | |
138 | 147 | | |
139 | 148 | | |
140 | 149 | | |
| |||
0 commit comments