Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Apr 18, 2024
1 parent c9a2fc2 commit 977c855
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,25 +269,25 @@ func main() {
return perrors.Wrapf(err, "unable to create remote cluster cache tracker")
}

govimomiGVR := infrav1.GroupVersion.WithResource(reflect.TypeOf(&infrav1.VSphereCluster{}).Elem().Name())
govmomiGVR := infrav1.GroupVersion.WithResource(reflect.TypeOf(&infrav1.VSphereCluster{}).Elem().Name())
supervisorGVR := vmwarev1.GroupVersion.WithResource(reflect.TypeOf(&vmwarev1.VSphereCluster{}).Elem().Name())

var isSupervisorCRDLoaded, isGovimoniCRDLoaded bool
if err := wait.PollUntilContextTimeout(ctx, 5*time.Second, 30*time.Second, true, func(ctx context.Context) (bool, error) {
if err := wait.PollUntilContextTimeout(ctx, 5*time.Second, 30*time.Second, true, func(_ context.Context) (bool, error) {
var errGovimomi, errSupervisor error

// Check for non-supervisor VSphereCluster and start controller if found
isGovimoniCRDLoaded, errGovimomi = isCRDDeployed(mgr, govimomiGVR)
isGovimoniCRDLoaded, errGovimomi = isCRDDeployed(mgr, govmomiGVR)

// Check for supervisor VSphereCluster and start controller if found
isSupervisorCRDLoaded, errSupervisor = isCRDDeployed(mgr, supervisorGVR)

if errGovimomi != nil || errSupervisor != nil {
return false, nil
if (isGovimoniCRDLoaded && errGovimomi == nil) || (isSupervisorCRDLoaded && errSupervisor == nil) {
return true, nil
}
return true, nil
return false, nil
}); err != nil {
return errors.New("failed to detect CRDs")
return fmt.Errorf("failed to detect CRDs: %w", err)
}

// Continuing startup does not make sense without having managers added.
Expand All @@ -300,7 +300,7 @@ func main() {
return fmt.Errorf("setupVAPIControllers: %w", err)
}
} else {
setupLog.Info(fmt.Sprintf("CRD for %s not loaded, skipping.", govimomiGVR.String()))
setupLog.Info(fmt.Sprintf("CRD for %s not loaded, skipping.", govmomiGVR.String()))
}

if isSupervisorCRDLoaded {
Expand Down

0 comments on commit 977c855

Please sign in to comment.