@@ -243,7 +243,7 @@ func ReconcileDependencies(ctx context.Context, c client.Client, dependenciesCon
243243 },
244244 }
245245
246- _ = wait .PollUntilContextTimeout (ctx , 250 * time .Millisecond , 5 * time .Second , true , func (ctx context.Context ) (bool , error ) {
246+ _ = wait .PollUntilContextTimeout (ctx , 1 * time .Second , 20 * time .Second , true , func (ctx context.Context ) (bool , error ) {
247247 retryError = nil
248248 if err := c .Get (ctx , client .ObjectKeyFromObject (availabilityZone ), availabilityZone ); err != nil {
249249 if ! apierrors .IsNotFound (err ) {
@@ -256,23 +256,24 @@ func ReconcileDependencies(ctx context.Context, c client.Client, dependenciesCon
256256 }
257257 log .Info ("Created vm-operator AvailabilityZone" , "AvailabilityZone" , klog .KObj (availabilityZone ))
258258 }
259+
260+ if _ , ok := availabilityZone .Spec .Namespaces [config .Namespace ]; ! ok {
261+ availabilityZone .Spec .Namespaces [config .Namespace ] = topologyv1.NamespaceInfo {
262+ PoolMoId : resourcePool .Reference ().Value ,
263+ FolderMoId : folder .Reference ().Value ,
264+ }
265+ if err := c .Update (ctx , availabilityZone ); err != nil {
266+ retryError = errors .Wrapf (err , "failed to update AvailabilityZone %s" , availabilityZone .Name )
267+ return false , nil
268+ }
269+ log .Info ("Update vm-operator AvailabilityZone" , "AvailabilityZone" , klog .KObj (availabilityZone ))
270+ }
259271 return true , nil
260272 })
261273 if retryError != nil {
262274 return retryError
263275 }
264276
265- if _ , ok := availabilityZone .Spec .Namespaces [config .Namespace ]; ! ok {
266- availabilityZone .Spec .Namespaces [config .Namespace ] = topologyv1.NamespaceInfo {
267- PoolMoId : resourcePool .Reference ().Value ,
268- FolderMoId : folder .Reference ().Value ,
269- }
270- if err := c .Update (ctx , availabilityZone ); err != nil {
271- return errors .Wrapf (err , "failed to update AvailabilityZone %s" , availabilityZone .Name )
272- }
273- log .Info ("Update vm-operator AvailabilityZone" , "AvailabilityZone" , klog .KObj (availabilityZone ))
274- }
275-
276277 // Create vm-operator Secret in K8s
277278 // This secret contains credentials to access vCenter the vm-operator acts on.
278279 secret := & corev1.Secret {
0 commit comments