Commit 1c68435
committed
status: Conditionally add CRDs to relatedObjects
Check whether the gatewayclasses, gateways, and istios CRDs actually
exist before adding them to relatedObjects.
Also, use the "GatewayAPIController" featuregate to determine whether to
add the gatewayclasses, gateways, istios, and subscriptions resources to
relatedObjects, rather than using the "GatewayAPI" featuregate.
Before this change, the operator could add istios to relatedObjects even
if the OSSM subscription failed to install. By convention, an operator
should only add resources to relatedObjects if those resources exist.
This commit fixes OCPBUGS-54745.
https://issues.redhat.com/browse/OCPBUGS-54745
* pkg/operator/controller/status/controller.go
(gatewaysResourceName, gatewayclassesResourceName, istiosResourceName):
New consts for the CRD names.
(relatedObjectsCRDs): New var for a string set that contains
gatewaysResourceName, gatewayclassesResourceName, and
istiosResourceName.
(New): Add a watch on CRDs, with a predicate for CRDs with names that
are in relatedObjectsCRDs.
(Config): Add GatewayAPIControllerEnabled.
(Reconcile): Check the GatewayAPIControllerEnabled field in the operator
config as well as the haveIstiosResource, haveGatewayclassesResource,
and haveGatewaysResource fields in the operatorState object and
conditionally add the corresponding resources to relatedObjects.
(operatorState): Add haveIstiosResource, haveGatewaysResource, and
haveGatewayclassesResource fields.
(getOperatorState): Set haveGatewaysResource,
haveGatewayclassesResource, and haveIstiosResource.
* pkg/operator/operator.go (New): Specify GatewayAPIControllerEnabled in
the status controller config.
* test/e2e/operator_test.go (TestClusterOperatorStatusRelatedObjects):
Expect to see "gateways" and "gatewayclasses" in relatedObjects if the
"GatewayAPI" and "GatewayAPIController" featuregates are enabled.1 parent f3fa969 commit 1c68435
File tree
3 files changed
+116
-21
lines changed- pkg/operator
- controller/status
- test/e2e
3 files changed
+116
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
56 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
57 | 71 | | |
58 | | - | |
59 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
60 | 76 | | |
61 | 77 | | |
62 | 78 | | |
| |||
116 | 132 | | |
117 | 133 | | |
118 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
119 | 153 | | |
120 | 154 | | |
121 | 155 | | |
| |||
124 | 158 | | |
125 | 159 | | |
126 | 160 | | |
127 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
128 | 165 | | |
129 | 166 | | |
130 | 167 | | |
| |||
206 | 243 | | |
207 | 244 | | |
208 | 245 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
| 246 | + | |
214 | 247 | | |
215 | 248 | | |
216 | 249 | | |
| |||
219 | 252 | | |
220 | 253 | | |
221 | 254 | | |
| 255 | + | |
| 256 | + | |
222 | 257 | | |
223 | 258 | | |
224 | 259 | | |
225 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
226 | 269 | | |
227 | 270 | | |
228 | 271 | | |
| |||
300 | 343 | | |
301 | 344 | | |
302 | 345 | | |
303 | | - | |
304 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
305 | 357 | | |
306 | 358 | | |
307 | 359 | | |
| |||
352 | 404 | | |
353 | 405 | | |
354 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
355 | 438 | | |
356 | 439 | | |
357 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
216 | 217 | | |
217 | 218 | | |
218 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
242 | 253 | | |
243 | 254 | | |
244 | 255 | | |
| |||
0 commit comments