Skip to content

Commit 638375e

Browse files
tmshorteverettravenbentito
committed
OCPBUGS-37982: Reduce Frequency of Update Requests for Copied CSVs (#3597)
* (bugfix): reduce frequency of update requests for CSVs by adding annotations to copied CSVs that are populated with hashes of the non-status fields and the status fields. This seems to be how this was intended to work, but was not actually working this way because the annotations never actually existed on the copied CSV. This resulted in a hot loop of update requests being made on all copied CSVs. Signed-off-by: everettraven <[email protected]> * update unit tests Signed-off-by: everettraven <[email protected]> * updates to test so far Signed-off-by: everettraven <[email protected]> * Small changes Signed-off-by: Brett Tofel <[email protected]> * Add metadata drift guard to copyToNamespace Since we switched to a PartialObjectMetadata cache to save memory, we lost visibility into copied CSV spec and status fields, and the reintroduced nonStatusCopyHash/statusCopyHash annotations only partially solved the problem. Manual edits to a copied CSV could still go undetected, causing drift without reconciliation. This commit adds two new annotations: olm.operatorframework.io/observedGeneration and olm.operatorframework.io/observedResourceVersion. It implements a mechanism to guard agains metadata drift at the top of the existing-copy path in copyToNamespace. If a stored observedGeneration or observedResourceVersion no longer matches the live object, the operator now: • Updates the spec and hash annotations • Updates the status subresource • Records the new generation and resourceVersion in the guard annotations Because the guard only fires when its annotations are already present, all existing unit tests pass unchanged. We preserve the memory benefits of the metadata‐only informer, avoid extra GETs, and eliminate unnecessary API churn. Future work may explore a WithTransform informer to regain full object visibility with minimal memory impact. Signed-off-by: Brett Tofel <[email protected]> * Tests for metadata guard Verifies that exactly three updates (spec, status, guard) are issued when the observedGeneration doesn’t match. Signed-off-by: Brett Tofel <[email protected]> * Persist observed annotations on all status updates Signed-off-by: Brett Tofel <[email protected]> * GCI the file Signed-off-by: Brett Tofel <[email protected]> * Use TransformFunc Unit tests not updated Signed-off-by: Todd Short <[email protected]> * Update operatorgroup tests to compile Signed-off-by: Todd Short <[email protected]> * Restore operatorgroup_test from master Remove metadatalister Signed-off-by: Todd Short <[email protected]> * Remove more PartialObjectMetadata Signed-off-by: Todd Short <[email protected]> * Remove hashes from operator_test Signed-off-by: Todd Short <[email protected]> * Fix error messages for static-analysis Signed-off-by: Todd Short <[email protected]> * Update test annotations and test client Signed-off-by: Todd Short <[email protected]> * Rename pruning to listerwatcher Signed-off-by: Todd Short <[email protected]> * Set resync to 6h Signed-off-by: Todd Short <[email protected]> * Add CSV copy revert syncer Signed-off-by: Todd Short <[email protected]> * Log tweaks Signed-off-by: Todd Short <[email protected]> * Consolidate revert and gc syncers Signed-off-by: Todd Short <[email protected]> * Add logging and reduce the amount of metadata in the TransformFunc Signed-off-by: Todd Short <[email protected]> * Handle the copy CSV revert via a requeue of the primary CSV Signed-off-by: Todd Short <[email protected]> * Revert "Set resync to 6h" This reverts commit 855f940a2199bd4071c51f14ef44728550bf13cf. Signed-off-by: Todd Short <[email protected]> * Add delete handler for copied csv Signed-off-by: Todd Short <[email protected]> * Revert whitespace change Signed-off-by: Todd Short <[email protected]> * Rename function, fix comment Signed-off-by: Todd Short <[email protected]> --------- Signed-off-by: everettraven <[email protected]> Signed-off-by: Brett Tofel <[email protected]> Signed-off-by: Todd Short <[email protected]> Co-authored-by: everettraven <[email protected]> Co-authored-by: Brett Tofel <[email protected]> Upstream-repository: operator-lifecycle-manager Upstream-commit: d055f28750cf62f966f566d36990fff5285c7a71 (cherry picked from commit bc111a9) (cherry picked from commit 882eb21) (cherry picked from commit e4bc847)
1 parent 650a3cd commit 638375e

File tree

17 files changed

+516
-328
lines changed

17 files changed

+516
-328
lines changed

manifests/0000_50_olm_00-clusterserviceversions.crd.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ spec:
9898
path:
9999
type: string
100100
value:
101-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
101+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
102102
type: string
103103
format: byte
104104
x-descriptors:
@@ -154,7 +154,7 @@ spec:
154154
path:
155155
type: string
156156
value:
157-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
157+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
158158
type: string
159159
format: byte
160160
x-descriptors:
@@ -176,7 +176,7 @@ spec:
176176
path:
177177
type: string
178178
value:
179-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
179+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
180180
type: string
181181
format: byte
182182
x-descriptors:
@@ -211,7 +211,7 @@ spec:
211211
path:
212212
type: string
213213
value:
214-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
214+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
215215
type: string
216216
format: byte
217217
x-descriptors:
@@ -267,7 +267,7 @@ spec:
267267
path:
268268
type: string
269269
value:
270-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
270+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
271271
type: string
272272
format: byte
273273
x-descriptors:
@@ -289,7 +289,7 @@ spec:
289289
path:
290290
type: string
291291
value:
292-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
292+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
293293
type: string
294294
format: byte
295295
x-descriptors:
@@ -335,7 +335,7 @@ spec:
335335
path:
336336
type: string
337337
value:
338-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
338+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
339339
type: string
340340
format: byte
341341
x-descriptors:
@@ -384,7 +384,7 @@ spec:
384384
path:
385385
type: string
386386
value:
387-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
387+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
388388
type: string
389389
format: byte
390390
x-descriptors:
@@ -406,7 +406,7 @@ spec:
406406
path:
407407
type: string
408408
value:
409-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
409+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
410410
type: string
411411
format: byte
412412
x-descriptors:
@@ -440,7 +440,7 @@ spec:
440440
path:
441441
type: string
442442
value:
443-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
443+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
444444
type: string
445445
format: byte
446446
x-descriptors:
@@ -489,7 +489,7 @@ spec:
489489
path:
490490
type: string
491491
value:
492-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
492+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
493493
type: string
494494
format: byte
495495
x-descriptors:
@@ -511,7 +511,7 @@ spec:
511511
path:
512512
type: string
513513
value:
514-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
514+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
515515
type: string
516516
format: byte
517517
x-descriptors:

microshift-manifests/0000_50_olm_00-clusterserviceversions.crd.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ spec:
9898
path:
9999
type: string
100100
value:
101-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
101+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
102102
type: string
103103
format: byte
104104
x-descriptors:
@@ -154,7 +154,7 @@ spec:
154154
path:
155155
type: string
156156
value:
157-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
157+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
158158
type: string
159159
format: byte
160160
x-descriptors:
@@ -176,7 +176,7 @@ spec:
176176
path:
177177
type: string
178178
value:
179-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
179+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
180180
type: string
181181
format: byte
182182
x-descriptors:
@@ -211,7 +211,7 @@ spec:
211211
path:
212212
type: string
213213
value:
214-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
214+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
215215
type: string
216216
format: byte
217217
x-descriptors:
@@ -267,7 +267,7 @@ spec:
267267
path:
268268
type: string
269269
value:
270-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
270+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
271271
type: string
272272
format: byte
273273
x-descriptors:
@@ -289,7 +289,7 @@ spec:
289289
path:
290290
type: string
291291
value:
292-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
292+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
293293
type: string
294294
format: byte
295295
x-descriptors:
@@ -335,7 +335,7 @@ spec:
335335
path:
336336
type: string
337337
value:
338-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
338+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
339339
type: string
340340
format: byte
341341
x-descriptors:
@@ -384,7 +384,7 @@ spec:
384384
path:
385385
type: string
386386
value:
387-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
387+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
388388
type: string
389389
format: byte
390390
x-descriptors:
@@ -406,7 +406,7 @@ spec:
406406
path:
407407
type: string
408408
value:
409-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
409+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
410410
type: string
411411
format: byte
412412
x-descriptors:
@@ -440,7 +440,7 @@ spec:
440440
path:
441441
type: string
442442
value:
443-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
443+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
444444
type: string
445445
format: byte
446446
x-descriptors:
@@ -489,7 +489,7 @@ spec:
489489
path:
490490
type: string
491491
value:
492-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
492+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
493493
type: string
494494
format: byte
495495
x-descriptors:
@@ -511,7 +511,7 @@ spec:
511511
path:
512512
type: string
513513
value:
514-
description: RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
514+
description: RawMessage is a raw encoded JSON value. It implements [Marshaler] and [Unmarshaler] and can be used to delay JSON decoding or precompute a JSON encoding.
515515
type: string
516516
format: byte
517517
x-descriptors:

0 commit comments

Comments
 (0)