Skip to content

Commit

Permalink
better early return conditional comment
Browse files Browse the repository at this point in the history
Signed-off-by: everettraven <everettraven@gmail.com>
  • Loading branch information
everettraven committed Jan 11, 2024
1 parent 9186d16 commit 201244b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions internal/controllers/clusterextension_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,15 @@ func SetDeprecationStatus(ext *ocv1alpha1.ClusterExtension, bundle *catalogmetad
})
}

// Even if the bundle is not deprecated, there may be channel
// deprecations associated with this bundle. If there are we need
// verify if it matches the channel specified in the ClusterExtension.
// if the bundle is not deprecated and there is no channel specified
// in the ClusterExtension there is no deprecations to be applied.
// There are two early return scenarios here:
// 1) The bundle is not deprecated (i.e no package or bundle deprecations)
// AND there are no other deprecations associated with the bundle
// 2) The bundle is not deprecated, there are deprecations associated
// with the bundle (i.e at least one channel the bundle is present in is deprecated),
// and the ClusterExtension does not specify a channel. This is because the channel deprecations
// are a loose deprecation coupling on the bundle. A ClusterExtension installation is only
// considered deprecated by a channel deprecation when a deprecated channel is specified via
// the spec.channel field.
if (!bundle.IsDeprecated() && !bundle.HasDeprecation()) || (!bundle.IsDeprecated() && ext.Spec.Channel == "") {
return
}
Expand Down

0 comments on commit 201244b

Please sign in to comment.