From 226fe6bf79c6c42a23333c55edb7db53ab12173f Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Sun, 2 Jan 2022 06:00:06 +0000 Subject: [PATCH] Make logs less verbose in cell reconcilation --- pkg/cell/cell.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/cell/cell.go b/pkg/cell/cell.go index 4d43863..a73bb3c 100644 --- a/pkg/cell/cell.go +++ b/pkg/cell/cell.go @@ -472,8 +472,6 @@ func Sync(config SyncInput) error { return fmt.Errorf("stable tgs weight cannot be less than 0: %v", desiredStableTGsWeight) } - log.Printf("stable weight(%v): %d -> %d\n", currentStableTGsMaxVer, currentStableTGsWeight, desiredStableTGsWeight) - // Do update by step weight var updatedTGs []okrav1alpha1.ForwardTargetGroup @@ -517,7 +515,6 @@ func Sync(config SyncInput) error { } } } - log.Printf("canary(%s) weight: %d -> %d\n", canaryVersion, currentCanaryTGsWeight, desiredCanaryTGsWeight) updatedCanatyTGs := map[string]okrav1alpha1.ForwardTargetGroup{} @@ -558,6 +555,13 @@ func Sync(config SyncInput) error { desiredHash := sync.ComputeHash(albConfig.Spec) if currentHash != desiredHash { + if currentStableTGsWeight != desiredStableTGsWeight { + log.Printf("Changing stable weight(%v): %d -> %d\n", currentStableTGsMaxVer, currentStableTGsWeight, desiredStableTGsWeight) + } + if currentCanaryTGsWeight != desiredCanaryTGsWeight { + log.Printf("Changing canary(%s) weight: %d -> %d\n", canaryVersion, currentCanaryTGsWeight, desiredCanaryTGsWeight) + } + metav1.SetMetaDataAnnotation(&albConfig.ObjectMeta, LabelKeyTemplateHash, desiredHash) if err := runtimeClient.Update(ctx, &albConfig); err != nil { @@ -566,7 +570,7 @@ func Sync(config SyncInput) error { log.Printf("Updated target groups and weights to: %v\n", updated) } else { - log.Printf("Skipped updating target groups") + log.Printf("No change detected on AWSApplicationLoadBalancerConfig and target group weights. Skipped updating.") } }