Skip to content

Commit 9baad93

Browse files
committed
add comments
1 parent df7cfa3 commit 9baad93

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cloud/scope/machine.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ func (m *MachineScope) GetOrCreateMachine(ctx context.Context) (*core.Instance,
294294
launchDetails.PreemptibleInstanceConfig = m.getPreemptibleInstanceConfig()
295295
launchDetails.PlatformConfig = m.getPlatformConfig()
296296
launchDetails.LaunchVolumeAttachments = m.getLaunchVolumeAttachments()
297+
// Build the list of availability/fault domain combinations we will try
298+
// when launching the instance (primary FD first, then fallbacks).
297299
faultDomains := m.buildFaultDomainLaunchAttempts(availabilityDomain, faultDomain)
298300
return m.launchInstanceWithFaultDomainRetry(ctx, launchDetails, faultDomains)
299301
}
@@ -360,6 +362,8 @@ func (m *MachineScope) buildFaultDomainLaunchAttempts(availabilityDomain, initia
360362
return attempts
361363
}
362364

365+
// Prefer fault domains exposed via the Cluster status. This respects
366+
// Cluster API's scheduling decisions before falling back to raw OCI data.
363367
failureDomains := m.OCIClusterAccessor.GetFailureDomains()
364368
if len(failureDomains) > 0 {
365369
keys := make([]string, 0, len(failureDomains))
@@ -384,6 +388,9 @@ func (m *MachineScope) buildFaultDomainLaunchAttempts(availabilityDomain, initia
384388
return attempts
385389
}
386390

391+
// If the cluster status didn't enumerate any additional fault domains,
392+
// fall back to the cached availability-domain data gathered from OCI so we
393+
// can still iterate through every physical fault domain in that AD.
387394
if adMap := m.OCIClusterAccessor.GetAvailabilityDomains(); adMap != nil {
388395
if adEntry, ok := adMap[availabilityDomain]; ok {
389396
for _, fd := range adEntry.FaultDomains {

0 commit comments

Comments
 (0)