@@ -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