Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1869717: fix(install): account for installplans when calculating generation #1737

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion pkg/controller/operators/catalog/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,17 @@ func (o *Operator) syncResolvingNamespace(obj interface{}) error {
// create installplan if anything updated
if len(updatedSubs) > 0 {
logger.Debug("resolution caused subscription changes, creating installplan")
// Finish calculating max generation by checking the existing installplans
installPlans, err := o.listInstallPlans(namespace)
if err != nil {
return err
}
for _, ip := range installPlans {
if gen := ip.Spec.Generation; gen > maxGeneration {
maxGeneration = gen
}
}

// any subscription in the namespace with manual approval will force generated installplans to be manual
// TODO: this is an odd artifact of the older resolver, and will probably confuse users. approval mode could be on the operatorgroup?
installPlanApproval := v1alpha1.ApprovalAutomatic
Expand Down Expand Up @@ -1194,7 +1205,7 @@ func (o *Operator) gcInstallPlans(log logrus.FieldLogger, namespace string) {

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

Expand Down