From 20fcdf39a7107cae8a3cd0c06610b4aa1ac682b5 Mon Sep 17 00:00:00 2001 From: "sailesh.duddupudi@nutanix.com" Date: Thu, 22 Aug 2024 16:36:31 +0000 Subject: [PATCH] update PA annotations --- pkg/reconciler/revision/reconcile_resources.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/reconciler/revision/reconcile_resources.go b/pkg/reconciler/revision/reconcile_resources.go index 3fa6f07d24fe..a1f6376f974c 100644 --- a/pkg/reconciler/revision/reconcile_resources.go +++ b/pkg/reconciler/revision/reconcile_resources.go @@ -173,12 +173,14 @@ func (c *Reconciler) reconcilePA(ctx context.Context, rev *v1.Revision) error { // We no longer require immutability, so need to reconcile PA each time. tmpl := resources.MakePA(rev, deployment) logger.Debugf("Desired PASpec: %#v", tmpl.Spec) - if !equality.Semantic.DeepEqual(tmpl.Spec, pa.Spec) { - diff, _ := kmp.SafeDiff(tmpl.Spec, pa.Spec) // Can't realistically fail on PASpec. - logger.Infof("PA %s needs reconciliation, diff(-want,+got):\n%s", pa.Name, diff) + if !equality.Semantic.DeepEqual(tmpl.Spec, pa.Spec) || !equality.Semantic.DeepEqual(tmpl.Annotations, pa.Annotations) { + diffSpec, _ := kmp.SafeDiff(tmpl.Spec, pa.Spec) // Can't realistically fail on PASpec. + diffAnnotations, _ := kmp.SafeDiff(tmpl.Annotations, pa.Annotations) + logger.Infof("PA %s needs reconciliation, diff(-want,+got):\n%s\n%s", pa.Name, diffAnnotations, diffSpec) want := pa.DeepCopy() want.Spec = tmpl.Spec + want.Annotations = tmpl.Annotations if pa, err = c.client.AutoscalingV1alpha1().PodAutoscalers(ns).Update(ctx, want, metav1.UpdateOptions{}); err != nil { return fmt.Errorf("failed to update PA %q: %w", paName, err) }