Skip to content

Commit

Permalink
chore: add debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hrak committed Aug 16, 2024
1 parent 36a2a0c commit dbc081c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controllers/cloudstackmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package controllers
import (
"context"
"fmt"
"k8s.io/klog/v2"
"math/rand"
"reflect"
"regexp"
Expand Down Expand Up @@ -460,15 +461,18 @@ func (reconciler *CloudStackMachineReconciler) SetupWithManager(ctx context.Cont
log.V(4).Info("Expected CloudStackIsolatedNetwork", "type", fmt.Sprintf("%T", e.ObjectOld))
return false
}
log = log.WithValues("CloudStackIsolatedNetwork", klog.KObj(oldCSIsoNet))

newCSIsoNet := e.ObjectNew.(*infrav1.CloudStackIsolatedNetwork)

// We're only interested in status updates, not Spec updates
log.V(4).Info("CSIsonet generation", "old", oldCSIsoNet.Generation, "new", newCSIsoNet.Generation)
if oldCSIsoNet.Generation != newCSIsoNet.Generation {
return false
}

// Only trigger a CloudStackMachine reconcile if the loadbalancer rules changed.
log.V(4).Info("LoadBalancerRuleIDs length", "old", len(oldCSIsoNet.Status.LoadBalancerRuleIDs), "new", len(newCSIsoNet.Status.LoadBalancerRuleIDs))
return len(oldCSIsoNet.Status.LoadBalancerRuleIDs) != len(newCSIsoNet.Status.LoadBalancerRuleIDs)
},
},
Expand Down

0 comments on commit dbc081c

Please sign in to comment.