Skip to content

Commit

Permalink
Merge pull request #248 from slintes/prevent-status-reconcile
Browse files Browse the repository at this point in the history
Prevent status triggered reconciles
  • Loading branch information
openshift-merge-robot authored Aug 17, 2023
2 parents 35a85c5 + 51bc5d5 commit 723a4ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion controllers/nodehealthcheck_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ type NodeHealthCheckReconciler struct {
// SetupWithManager sets up the controller with the Manager.
func (r *NodeHealthCheckReconciler) SetupWithManager(mgr ctrl.Manager) error {
controller, err := ctrl.NewControllerManagedBy(mgr).
For(&remediationv1alpha1.NodeHealthCheck{}).
For(&remediationv1alpha1.NodeHealthCheck{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
Watches(
&source.Kind{Type: &v1.Node{}},
handler.EnqueueRequestsFromMapFunc(utils.NHCByNodeMapperFunc(mgr.GetClient(), mgr.GetLogger())),
Expand Down
8 changes: 2 additions & 6 deletions controllers/nodehealthcheck_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,8 @@ var _ = Describe("Node Health Check CR", func() {
By("faking time and triggering another reconcile")
afterTimeout := time.Now().Add(remediationCRAlertTimeout).Add(2 * time.Minute)
fakeTime = &afterTimeout
labels := underTest.Labels
if labels == nil {
labels = make(map[string]string)
}
labels["trigger"] = "now"
underTest.Labels = labels
newMinHealthy := intstr.FromString("52%")
underTest.Spec.MinHealthy = &newMinHealthy
Expect(k8sClient.Update(context.Background(), underTest)).To(Succeed())
time.Sleep(2 * time.Second)

Expand Down

0 comments on commit 723a4ca

Please sign in to comment.