Commit 6903fb2
Use Patch instead of Update for finalizer operations
Refactor all controllers to use Patch() instead of Update()
when adding or removing finalizers to improve performance, and to avoid
removing non-cached fields erroneously. Create shared finalizer utilities
to eliminate code duplication across controllers.
This is necesary because we no longer cache the`last-applied-configuration`
annotation, so when we add/remove the finalizers, we are removing that field
from the metadata. This causes issues with clients when they don't see that
annotation (e.g. apply the same ClusterExtension twice).
- Add shared finalizer.EnsureFinalizer() utilities
- Update ClusterCatalog, ClusterExtension, and ClusterExtensionRevision
controllers to use Patch-based finalizer management
- Maintain early return behavior after adding finalizers on create
- Remove unused internal/operator-controller/finalizers package
- Update all unit tests to match new behavior
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Signed-off-by: Todd Short <[email protected]>1 parent f3569d5 commit 6903fb2
File tree
10 files changed
+292
-208
lines changed- cmd/operator-controller
- internal
- catalogd/controllers/core
- operator-controller
- controllers
- finalizers
10 files changed
+292
-208
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
| |||
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
73 | | - | |
74 | 72 | | |
75 | 73 | | |
76 | 74 | | |
| |||
388 | 386 | | |
389 | 387 | | |
390 | 388 | | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
397 | 394 | | |
398 | 395 | | |
399 | 396 | | |
| |||
440 | 437 | | |
441 | 438 | | |
442 | 439 | | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
448 | 445 | | |
449 | 446 | | |
450 | 447 | | |
| |||
461 | 458 | | |
462 | 459 | | |
463 | 460 | | |
464 | | - | |
| 461 | + | |
465 | 462 | | |
466 | | - | |
| 463 | + | |
467 | 464 | | |
468 | 465 | | |
469 | 466 | | |
| |||
528 | 525 | | |
529 | 526 | | |
530 | 527 | | |
531 | | - | |
532 | 528 | | |
533 | 529 | | |
534 | 530 | | |
| |||
557 | 553 | | |
558 | 554 | | |
559 | 555 | | |
560 | | - | |
| 556 | + | |
561 | 557 | | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
| 558 | + | |
567 | 559 | | |
568 | 560 | | |
569 | 561 | | |
| |||
636 | 628 | | |
637 | 629 | | |
638 | 630 | | |
639 | | - | |
640 | 631 | | |
641 | 632 | | |
642 | 633 | | |
| |||
675 | 666 | | |
676 | 667 | | |
677 | 668 | | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
686 | 672 | | |
687 | 673 | | |
688 | 674 | | |
| |||
Lines changed: 42 additions & 62 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | 62 | | |
65 | 63 | | |
66 | 64 | | |
| |||
106 | 104 | | |
107 | 105 | | |
108 | 106 | | |
109 | | - | |
110 | 107 | | |
111 | 108 | | |
112 | 109 | | |
113 | 110 | | |
114 | 111 | | |
115 | 112 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | 113 | | |
123 | 114 | | |
124 | 115 | | |
125 | 116 | | |
126 | 117 | | |
127 | 118 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | 119 | | |
137 | 120 | | |
138 | 121 | | |
| |||
142 | 125 | | |
143 | 126 | | |
144 | 127 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | 128 | | |
150 | 129 | | |
151 | 130 | | |
| |||
171 | 150 | | |
172 | 151 | | |
173 | 152 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | 153 | | |
179 | 154 | | |
180 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
181 | 166 | | |
182 | 167 | | |
183 | 168 | | |
184 | 169 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
192 | 184 | | |
193 | 185 | | |
194 | 186 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
200 | 194 | | |
201 | 195 | | |
202 | 196 | | |
| |||
419 | 413 | | |
420 | 414 | | |
421 | 415 | | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
443 | 421 | | |
444 | | - | |
445 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
446 | 426 | | |
447 | 427 | | |
448 | 428 | | |
| |||
Lines changed: 21 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
304 | 306 | | |
305 | 307 | | |
306 | 308 | | |
| 309 | + | |
307 | 310 | | |
308 | 311 | | |
309 | 312 | | |
| |||
332 | 335 | | |
333 | 336 | | |
334 | 337 | | |
| 338 | + | |
| 339 | + | |
335 | 340 | | |
336 | 341 | | |
337 | 342 | | |
| |||
802 | 807 | | |
803 | 808 | | |
804 | 809 | | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
805 | 814 | | |
806 | | - | |
| 815 | + | |
807 | 816 | | |
808 | 817 | | |
809 | 818 | | |
| |||
812 | 821 | | |
813 | 822 | | |
814 | 823 | | |
815 | | - | |
816 | 824 | | |
817 | 825 | | |
818 | 826 | | |
| |||
826 | 834 | | |
827 | 835 | | |
828 | 836 | | |
| 837 | + | |
829 | 838 | | |
830 | 839 | | |
831 | 840 | | |
| |||
909 | 918 | | |
910 | 919 | | |
911 | 920 | | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
912 | 925 | | |
913 | | - | |
| 926 | + | |
914 | 927 | | |
915 | 928 | | |
916 | 929 | | |
| |||
924 | 937 | | |
925 | 938 | | |
926 | 939 | | |
927 | | - | |
928 | 940 | | |
929 | 941 | | |
930 | 942 | | |
| |||
1136 | 1148 | | |
1137 | 1149 | | |
1138 | 1150 | | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
1139 | 1155 | | |
1140 | | - | |
| 1156 | + | |
1141 | 1157 | | |
1142 | 1158 | | |
1143 | 1159 | | |
1144 | 1160 | | |
1145 | | - | |
1146 | 1161 | | |
1147 | 1162 | | |
1148 | 1163 | | |
| |||
0 commit comments