From 511f4342b719a7759af9adba2660b4c091b46182 Mon Sep 17 00:00:00 2001 From: pashakostohrys Date: Fri, 12 Jan 2024 22:29:32 +0200 Subject: [PATCH] feat: release-1.6 logs for priceline --- rollout/context.go | 3 +++ rollout/pause.go | 5 +++++ rollout/replicaset.go | 7 +++++++ rollout/service.go | 2 ++ rollout/trafficrouting.go | 3 +++ 5 files changed, 20 insertions(+) diff --git a/rollout/context.go b/rollout/context.go index f8fa5b5f03..1f1005e76f 100644 --- a/rollout/context.go +++ b/rollout/context.go @@ -1,6 +1,7 @@ package rollout import ( + logutil "github.com/argoproj/argo-rollouts/utils/log" "time" log "github.com/sirupsen/logrus" @@ -56,6 +57,8 @@ func (c *rolloutContext) reconcile() error { err := c.getRolloutValidationErrors() if err != nil { if vErr, ok := err.(*field.Error); ok { + logCtx := logutil.WithRollout(c.rollout) + logCtx.Info("rollout enqueue due reconcile error") // We want to frequently requeue rollouts with InvalidSpec errors, because the error // condition might be timing related (e.g. the Rollout was applied before the Service). c.enqueueRolloutAfter(c.rollout, 20*time.Second) diff --git a/rollout/pause.go b/rollout/pause.go index 25ae24c3ba..3f1c4a2570 100644 --- a/rollout/pause.go +++ b/rollout/pause.go @@ -1,6 +1,7 @@ package rollout import ( + logutil "github.com/argoproj/argo-rollouts/utils/log" "time" log "github.com/sirupsen/logrus" @@ -209,6 +210,10 @@ func (c *rolloutContext) checkEnqueueRolloutDuringWait(startTime metav1.Time, du if nextResync.After(expiredTime) && expiredTime.After(now.Time) { timeRemaining := expiredTime.Sub(now.Time) c.log.Infof("Enqueueing Rollout in %s seconds", timeRemaining.String()) + + logCtx := logutil.WithRollout(c.rollout) + logCtx.Info("rollout enqueue during wait") + c.enqueueRolloutAfter(c.rollout, timeRemaining) } } diff --git a/rollout/replicaset.go b/rollout/replicaset.go index 401e1b579d..70a190d5c8 100644 --- a/rollout/replicaset.go +++ b/rollout/replicaset.go @@ -3,6 +3,7 @@ package rollout import ( "context" "fmt" + logutil "github.com/argoproj/argo-rollouts/utils/log" "sort" "time" @@ -150,6 +151,8 @@ func (c *rolloutContext) reconcileNewReplicaSet() (bool, error) { c.log.Infof("RS '%s' has not reached the scaleDownTime", c.newRS.Name) remainingTime := scaleDownAt.Sub(now.Time) if remainingTime < c.resyncPeriod { + logCtx := logutil.WithRollout(c.rollout) + logCtx.Info("rollout enqueue due to scaleDownDelay") c.enqueueRolloutAfter(c.rollout, remainingTime) return false, nil } @@ -284,6 +287,8 @@ func (c *rolloutContext) scaleDownDelayHelper(rs *appsv1.ReplicaSet, annotatione if err != nil { return annotationedRSs, desiredReplicaCount, err } + logCtx := logutil.WithRollout(c.rollout) + logCtx.Info("rollout enqueue due to scaleDownDelay v2") c.enqueueRolloutAfter(c.rollout, scaleDownDelaySeconds) } } else if replicasetutil.HasScaleDownDeadline(rs) { @@ -297,6 +302,8 @@ func (c *rolloutContext) scaleDownDelayHelper(rs *appsv1.ReplicaSet, annotatione } else if remainingTime != nil { c.log.Infof("RS '%s' has not reached the scaleDownTime", rs.Name) if *remainingTime < c.resyncPeriod { + logCtx := logutil.WithRollout(c.rollout) + logCtx.Info("rollout enqueue due to scaleDownDelay v3") c.enqueueRolloutAfter(c.rollout, *remainingTime) } desiredReplicaCount = rolloutReplicas diff --git a/rollout/service.go b/rollout/service.go index 69739b9315..097f4160bf 100644 --- a/rollout/service.go +++ b/rollout/service.go @@ -172,6 +172,8 @@ func (c *rolloutContext) awsVerifyTargetGroups(svc *corev1.Service) error { } if !verifyRes.Verified { c.recorder.Warnf(c.rollout, record.EventOptions{EventReason: conditions.TargetGroupUnverifiedReason}, conditions.TargetGroupUnverifiedRegistrationMessage, svc.Name, tgb.Spec.TargetGroupARN, verifyRes.EndpointsRegistered, verifyRes.EndpointsTotal) + logCtx := logutil.WithRollout(c.rollout) + logCtx.Info("rollout enqueue due to awsVerifyTargetGroups") c.enqueueRolloutAfter(c.rollout, defaults.GetRolloutVerifyRetryInterval()) return nil } diff --git a/rollout/trafficrouting.go b/rollout/trafficrouting.go index a87e31a9e8..cc1e552d7c 100644 --- a/rollout/trafficrouting.go +++ b/rollout/trafficrouting.go @@ -2,6 +2,7 @@ package rollout import ( "fmt" + logutil "github.com/argoproj/argo-rollouts/utils/log" "reflect" "strconv" "strings" @@ -283,6 +284,8 @@ func (c *rolloutContext) reconcileTrafficRouting() error { c.log.Infof("Desired weight (stepIdx: %s) %d verified", indexString, desiredWeight) } else { c.log.Infof("Desired weight (stepIdx: %s) %d not yet verified", indexString, desiredWeight) + logCtx := logutil.WithRollout(c.rollout) + logCtx.Info("rollout enqueue due to trafficrouting") c.enqueueRolloutAfter(c.rollout, defaults.GetRolloutVerifyRetryInterval()) } }