Skip to content

Commit

Permalink
update PA annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
saileshd1402 committed Aug 22, 2024
1 parent 5f5f6d8 commit 20fcdf3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/reconciler/revision/reconcile_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 20fcdf3

Please sign in to comment.