@@ -188,15 +188,9 @@ func (c *CloudProvider) Create(ctx context.Context, nodeClaim *karpv1.NodeClaim)
188188 if err != nil {
189189 return nil , err
190190 }
191- inPlaceUpdateHash , err := inplaceupdate .HashFromNodeClaim (options .FromContext (ctx ), nc , nodeClass )
192- if err != nil {
193- return nil , fmt .Errorf ("failed to calculate in place update hash, %w" , err )
191+ if err := setAdditionalAnnotationsForNewNodeClaim (ctx , nc , nodeClass ); err != nil {
192+ return nil , err
194193 }
195- nc .Annotations = lo .Assign (nc .Annotations , map [string ]string {
196- v1beta1 .AnnotationAKSNodeClassHash : nodeClass .Hash (),
197- v1beta1 .AnnotationAKSNodeClassHashVersion : v1beta1 .AKSNodeClassHashVersion ,
198- v1beta1 .AnnotationInPlaceUpdateHash : inPlaceUpdateHash ,
199- })
200194 return nc , nil
201195}
202196
@@ -526,3 +520,19 @@ func truncateMessage(msg string) string {
526520 }
527521 return msg [:truncateAt ] + "..."
528522}
523+
524+ func setAdditionalAnnotationsForNewNodeClaim (ctx context.Context , nodeClaim * karpv1.NodeClaim , nodeClass * v1beta1.AKSNodeClass ) error {
525+ // Additional annotations
526+ // ASSUMPTION: this is not needed in other places that the core also wants NodeClaim (e.g., Get, List).
527+ // As of the time of writing, AWS is doing something similar.
528+ inPlaceUpdateHash , err := inplaceupdate .HashFromNodeClaim (options .FromContext (ctx ), nodeClaim , nodeClass )
529+ if err != nil {
530+ return fmt .Errorf ("failed to calculate in place update hash, %w" , err )
531+ }
532+ nodeClaim .Annotations = lo .Assign (nodeClaim .Annotations , map [string ]string {
533+ v1beta1 .AnnotationAKSNodeClassHash : nodeClass .Hash (),
534+ v1beta1 .AnnotationAKSNodeClassHashVersion : v1beta1 .AKSNodeClassHashVersion ,
535+ v1beta1 .AnnotationInPlaceUpdateHash : inPlaceUpdateHash ,
536+ })
537+ return nil
538+ }
0 commit comments