Skip to content

Commit 69478e6

Browse files
Merge pull request #1684 from njhale/fix-ip-gen
Bug 1860185: fix(install): account for installplans when calculating generation
2 parents 6405f0e + 5de47d1 commit 69478e6

File tree

2 files changed

+353
-156
lines changed

2 files changed

+353
-156
lines changed

pkg/controller/operators/catalog/operator.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,17 @@ func (o *Operator) syncResolvingNamespace(obj interface{}) error {
857857
// create installplan if anything updated
858858
if len(updatedSubs) > 0 {
859859
logger.Debug("resolution caused subscription changes, creating installplan")
860+
// Finish calculating max generation by checking the existing installplans
861+
installPlans, err := o.listInstallPlans(namespace)
862+
if err != nil {
863+
return err
864+
}
865+
for _, ip := range installPlans {
866+
if gen := ip.Spec.Generation; gen > maxGeneration {
867+
maxGeneration = gen
868+
}
869+
}
870+
860871
// any subscription in the namespace with manual approval will force generated installplans to be manual
861872
// TODO: this is an odd artifact of the older resolver, and will probably confuse users. approval mode could be on the operatorgroup?
862873
installPlanApproval := v1alpha1.ApprovalAutomatic
@@ -1208,7 +1219,7 @@ func (o *Operator) gcInstallPlans(log logrus.FieldLogger, namespace string) {
12081219

12091220
// we only consider maxDeletesPerSweep more than the allowed number of installplans for delete at one time
12101221
ips := allIps
1211-
if len(ips) > maxInstallPlanCount + maxDeletesPerSweep {
1222+
if len(ips) > maxInstallPlanCount+maxDeletesPerSweep {
12121223
ips = allIps[:maxInstallPlanCount+maxDeletesPerSweep]
12131224
}
12141225

0 commit comments

Comments
 (0)