Skip to content

Commit 9a83a95

Browse files
committed
tweak diff output so we don't see defaulted values always being added
1 parent 787af40 commit 9a83a95

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

pkg/reconciler/revision/reconcile_resources.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,21 +185,20 @@ func (c *Reconciler) reconcilePA(ctx context.Context, rev *v1.Revision) error {
185185
tmpl := resources.MakePA(rev, deployment)
186186
logger.Debugf("Desired PASpec: %#v", tmpl.Spec)
187187
if !equality.Semantic.DeepEqual(tmpl.Spec, pa.Spec) || !annotationsPresent(pa.Annotations, tmpl.Annotations) {
188+
want := pa.DeepCopy()
189+
want.Spec = tmpl.Spec
190+
// copy template annotations over while preserving existing ones
191+
maps.Copy(want.Annotations, tmpl.Annotations)
192+
188193
// Can't realistically fail on PASpec.
189-
if diff, _ := kmp.SafeDiff(tmpl.Spec, pa.Spec); diff != "" {
194+
if diff, _ := kmp.SafeDiff(want.Spec, pa.Spec); diff != "" {
190195
logger.Infof("PA %q spec needs reconciliation, diff(-want,+got):\n%s", pa.Name, diff)
191196
}
192197

193-
if diff, _ := kmp.SafeDiff(tmpl.Annotations, pa.Annotations); diff != "" {
198+
if diff, _ := kmp.SafeDiff(want.Annotations, pa.Annotations); diff != "" {
194199
logger.Infof("PA %q annotations needs reconciliation, diff(-want,+got):\n%s", pa.Name, diff)
195200
}
196201

197-
want := pa.DeepCopy()
198-
want.Spec = tmpl.Spec
199-
200-
// copy template annotations over while preserving existing ones
201-
maps.Copy(want.Annotations, tmpl.Annotations)
202-
203202
_, err := c.client.AutoscalingV1alpha1().PodAutoscalers(ns).Update(ctx, want, metav1.UpdateOptions{})
204203
return err
205204
}

0 commit comments

Comments
 (0)