fix: reduce excessive reconciliation and disable dev mode logging #75
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Development: truefrom zap.Options for production-appropriate loggingGenerationChangedPredicatefor ScalityUI watch to prevent unnecessary reconcile triggersProblem
Verbose debug logs in production: The Kubebuilder scaffold sets
Development: trueby default, causing verbose debug logs in production environments.Unnecessary status updates:
ScalityUIComponentExposerwas callingStatus().Update()on every reconcile, even when status hadn't changed, causing:Unnecessary reconcile triggers: ScalityUI status changes were triggering ScalityUIComponentExposer reconciliation, even though Exposer only depends on ScalityUI.Spec.Networks.
Changes
1.
cmd/main.go2.
reconcile_context.gooldStatusfield to store original statusSetOldStatus()andGetOldStatus()methodsExtendedStateinterface3.
controller.gooldStatusafter fetching CR:currentState.SetOldStatus(cr.Status.DeepCopy())GenerationChangedPredicateto ScalityUI watch4.
status.goupdateStatus()now compares oldStatus with current status before calling APIconditionsEqual()function to compare conditions (ignoring LastTransitionTime)How to enable debug logging