Skip to content

Commit 94cab65

Browse files
committed
Stop corrupting resolver cache.
Signed-off-by: Ben Luddy <[email protected]>
1 parent 7a6de48 commit 94cab65

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

pkg/controller/registry/resolver/resolver.go

+15-2
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,26 @@ func (r *SatResolver) SolveOperators(namespaces []string, csvs []*v1alpha1.Clust
159159
errs = append(errs, err)
160160
continue
161161
}
162+
163+
// copy consumed fields to avoid directly mutating cachep
164+
op = &cache.Entry{
165+
Name: op.Name,
166+
Replaces: op.Replaces,
167+
BundlePath: op.BundlePath,
168+
SourceInfo: &cache.OperatorSourceInfo{
169+
Catalog: op.SourceInfo.Catalog,
170+
StartingCSV: op.SourceInfo.StartingCSV,
171+
},
172+
Properties: op.Properties,
173+
Bundle: op.Bundle,
174+
}
162175
if len(installableOperator.Replaces) > 0 {
163-
op.Replaces = installableOperator.Replaces // TODO: Don't mutate object from cache!
176+
op.Replaces = installableOperator.Replaces
164177
}
165178

166179
// lookup if this installable came from a starting CSV
167180
if _, ok := startingCSVs[csvName]; ok {
168-
op.SourceInfo.StartingCSV = csvName // TODO: Don't mutate object from cache!
181+
op.SourceInfo.StartingCSV = csvName
169182
}
170183

171184
operators[csvName] = op

0 commit comments

Comments
 (0)