Skip to content

Commit

Permalink
Addressing comments from Angie
Browse files Browse the repository at this point in the history
  • Loading branch information
edcdavid committed Sep 27, 2024
1 parent b6de7f8 commit 64163cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions internal/controllers/clusterrequest_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,10 @@ func (t *clusterRequestReconcilerTask) handleClusterPolicyConfiguration(ctx cont
}

// If there are policies that are not Compliant, we need to requeue and see if they
// time out or complete.
return aConfigFSMHelper.NonCompliantPolicyInEnforce, nil
// time out. If the TimedOut state is reached, there is no need to requeue since reconcile will
// be called again if there is a change in the watched policies.
return aConfigFSMHelper.NonCompliantPolicyInEnforce &&
nextState != configfsm.TimedOut, nil
}

// updateConfigurationAppliedStatus updates the ClusterRequest ConfigurationApplied condition
Expand Down
9 changes: 6 additions & 3 deletions internal/controllers/clusterrequest_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2467,7 +2467,8 @@ defaultHugepagesSize: "1G"`,

// Call the handleClusterPolicyConfiguration function.
requeue, err = CRTask.handleClusterPolicyConfiguration(context.Background())
Expect(requeue).To(BeTrue()) // there are NonCompliant policies in enforce
Expect(requeue).To(BeFalse()) // there are NonCompliant policies in enforce but
// we are now in timedOut state so no need to requeue
Expect(err).ToNot(HaveOccurred())

// Check the status conditions.
Expand Down Expand Up @@ -2921,7 +2922,8 @@ defaultHugepagesSize: "1G"`,

// Call the handleClusterPolicyConfiguration function.
requeue, err = CRTask.handleClusterPolicyConfiguration(context.Background())
Expect(requeue).To(BeTrue()) // there are NonCompliant policies in enforce
Expect(requeue).To(BeFalse()) // there are NonCompliant policies in enforce but
// we are now in timedOut state so no need to requeue
Expect(err).ToNot(HaveOccurred())

// Check the status conditions.
Expand All @@ -2938,7 +2940,8 @@ defaultHugepagesSize: "1G"`,
// Check that another handleClusterPolicyConfiguration call doesn't change the status if
// the policies are the same.
requeue, err = CRTask.handleClusterPolicyConfiguration(context.Background())
Expect(requeue).To(BeTrue()) // there are NonCompliant policies in enforce
Expect(requeue).To(BeFalse()) // there are NonCompliant policies in enforce but
// we are now in timedOut state so no need to requeue
Expect(err).ToNot(HaveOccurred())

// Check the status conditions.
Expand Down

0 comments on commit 64163cf

Please sign in to comment.