Skip to content

Commit

Permalink
Bug: crash-looping config-policy-controller-uninstaller
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Rae Kim <yikim@redhat.com>
  • Loading branch information
yiraeChristineKim authored and openshift-merge-robot committed May 15, 2023
1 parent 0e3e42c commit 7c79594
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions controllers/configurationpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,14 @@ func (r *ConfigurationPolicyReconciler) PeriodicallyExecConfigPolicies(
_ = r.refreshDiscoveryInfo()
}

if discoveryErr == nil {
cleanupImmediately, err := r.cleanupImmediately()
if err != nil {
log.Error(err, "Failed to determine if it's time to cleanup immediately")

skipLoop = true
}

if !skipLoop && (discoveryErr == nil || cleanupImmediately) {
// This retrieves the policies from the controller-runtime cache populated by the watch.
err := r.List(context.TODO(), &policiesList)
if err != nil {
Expand All @@ -207,13 +214,6 @@ func (r *ConfigurationPolicyReconciler) PeriodicallyExecConfigPolicies(
skipLoop = true
}

cleanupImmediately, err := r.cleanupImmediately()
if err != nil {
log.Error(err, "Failed to determine if it's time to cleanup immediately")

skipLoop = true
}

// This is done every loop cycle since the channel needs to be variable in size to account for the number of
// policies changing.
policyQueue := make(chan *policyv1.ConfigurationPolicy, len(policiesList.Items))
Expand Down

0 comments on commit 7c79594

Please sign in to comment.