@@ -187,20 +187,24 @@ func (r *VirtualMachineGroupReconciler) createOrUpdateVMG(ctx context.Context, c
187187 desiredVMG .Labels [clusterv1 .ClusterNameLabel ] = cluster .Name
188188 }
189189
190+ if desiredVMG .Annotations == nil {
191+ desiredVMG .Annotations = make (map [string ]string )
192+ }
193+
190194 // Add per-md-zone label for day-2 operations once placement of a VM belongs to MachineDeployment is done
191195 // Do not update per-md-zone label once set, as placement decision should not change without user explicitly
192196 // ask.
193- placementDecisionLabels , err := GenerateVMGPlacementAnnotations (ctx , desiredVMG , mdNames )
197+ placementDecisionAnnotations , err := GenerateVMGPlacementAnnotations (ctx , desiredVMG , mdNames )
194198 if err != nil {
195199 return err
196200 }
197- if len (placementDecisionLabels ) > 0 {
198- for k , v := range placementDecisionLabels {
199- if _ , exists := desiredVMG .Labels [k ]; exists {
201+ if len (placementDecisionAnnotations ) > 0 {
202+ for k , v := range placementDecisionAnnotations {
203+ if _ , exists := desiredVMG .Annotations [k ]; exists {
200204 // Skip if the label already exists
201205 continue
202206 }
203- desiredVMG .Labels [k ] = v
207+ desiredVMG .Annotations [k ] = v
204208 }
205209 }
206210
@@ -325,6 +329,10 @@ func GenerateVMGPlacementAnnotations(ctx context.Context, vmg *vmoprv1.VirtualMa
325329 }
326330 }
327331
332+ if len (annotations ) == 0 {
333+ log .V (4 ).Info ("Waiting for VM placement info to add placement annotations" , "VMG" , vmg .Name , "Namespace" , vmg .Namespace )
334+ }
335+
328336 return annotations , nil
329337}
330338
0 commit comments