Skip to content

Commit e3dbec6

Browse files
committed
Restore last-applied-config annotation in cache
This restores the last-applied-config annotation in the cache, as its absense can cause issues with clients when we update our finalizers. This increases memory utilization until we can solve the finalizer issue. Also, since managedFields is needed by boxcutter (and was reverted from being removed by another attempted memory optimization) add that field into the accept list of sanitizeResources. Signed-off-by: Todd Short <tshort@redhat.com>
1 parent c06f27f commit e3dbec6

File tree

5 files changed

+4
-105
lines changed

5 files changed

+4
-105
lines changed

cmd/catalogd/main.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ import (
5959
"github.com/operator-framework/operator-controller/internal/catalogd/storage"
6060
"github.com/operator-framework/operator-controller/internal/catalogd/webhook"
6161
sharedcontrollers "github.com/operator-framework/operator-controller/internal/shared/controllers"
62-
cacheutil "github.com/operator-framework/operator-controller/internal/shared/util/cache"
6362
fsutil "github.com/operator-framework/operator-controller/internal/shared/util/fs"
6463
httputil "github.com/operator-framework/operator-controller/internal/shared/util/http"
6564
imageutil "github.com/operator-framework/operator-controller/internal/shared/util/image"
@@ -255,8 +254,6 @@ func run(ctx context.Context) error {
255254

256255
cacheOptions := crcache.Options{
257256
ByObject: map[client.Object]crcache.ByObject{},
258-
// Memory optimization: strip managed fields and large annotations from cached objects
259-
DefaultTransform: cacheutil.StripManagedFieldsAndAnnotations(),
260257
}
261258

262259
saKey, err := sautil.GetServiceAccount()

cmd/operator-controller/main.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ import (
7878
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render/registryv1"
7979
"github.com/operator-framework/operator-controller/internal/operator-controller/scheme"
8080
sharedcontrollers "github.com/operator-framework/operator-controller/internal/shared/controllers"
81-
cacheutil "github.com/operator-framework/operator-controller/internal/shared/util/cache"
8281
fsutil "github.com/operator-framework/operator-controller/internal/shared/util/fs"
8382
httputil "github.com/operator-framework/operator-controller/internal/shared/util/http"
8483
imageutil "github.com/operator-framework/operator-controller/internal/shared/util/image"
@@ -233,8 +232,6 @@ func run() error {
233232
cfg.systemNamespace: {LabelSelector: k8slabels.Everything()},
234233
},
235234
DefaultLabelSelector: k8slabels.Nothing(),
236-
// Memory optimization: strip managed fields and large annotations from cached objects
237-
DefaultTransform: cacheutil.StripAnnotations(),
238235
}
239236

240237
if features.OperatorControllerFeatureGate.Enabled(features.BoxcutterRuntime) {

internal/operator-controller/applier/boxcutter.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
ocv1 "github.com/operator-framework/operator-controller/api/v1"
2929
"github.com/operator-framework/operator-controller/internal/operator-controller/controllers"
3030
"github.com/operator-framework/operator-controller/internal/operator-controller/labels"
31-
"github.com/operator-framework/operator-controller/internal/shared/util/cache"
3231
)
3332

3433
const (
@@ -68,9 +67,6 @@ func (r *SimpleRevisionGenerator) GenerateRevisionFromHelmRelease(
6867
maps.Copy(labels, objectLabels)
6968
obj.SetLabels(labels)
7069

71-
// Memory optimization: strip large annotations
72-
// Note: ApplyStripTransform never returns an error in practice
73-
_ = cache.ApplyStripAnnotationsTransform(&obj)
7470
sanitizedUnstructured(ctx, &obj)
7571

7672
objs = append(objs, ocv1.ClusterExtensionRevisionObject{
@@ -122,10 +118,6 @@ func (r *SimpleRevisionGenerator) GenerateRevision(
122118
unstr := unstructured.Unstructured{Object: unstrObj}
123119
unstr.SetGroupVersionKind(gvk)
124120

125-
// Memory optimization: strip large annotations
126-
if err := cache.ApplyStripAnnotationsTransform(&unstr); err != nil {
127-
return nil, err
128-
}
129121
sanitizedUnstructured(ctx, &unstr)
130122

131123
objs = append(objs, ocv1.ClusterExtensionRevisionObject{
@@ -155,6 +147,7 @@ func sanitizedUnstructured(ctx context.Context, unstr *unstructured.Unstructured
155147
var allowedMetadata = []string{
156148
"annotations",
157149
"labels",
150+
"managedFields",
158151
"name",
159152
"namespace",
160153
}

internal/operator-controller/applier/boxcutter_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ func Test_SimpleRevisionGenerator_GenerateRevisionFromHelmRelease(t *testing.T)
8989
Labels: map[string]string{
9090
"olm.operatorframework.io/owner": "test-123",
9191
},
92+
ManagedFields: []metav1.ManagedFieldsEntry{
93+
{Manager: "test-manager"},
94+
},
9295
},
9396
Spec: ocv1.ClusterExtensionRevisionSpec{
9497
Revision: 1,

internal/shared/util/cache/transform.go

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)