Skip to content

Commit 4b07487

Browse files
author
Joshua Reed
committed
Cleanup.
1 parent be17fe0 commit 4b07487

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

controllers/cloudstackcluster_controller.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,10 @@ func (reconciler *CloudStackClusterReconciler) Reconcile(ctx context.Context, re
8787
// Reconcile actually reconciles the CloudStackCluster.
8888
func (r *CloudStackClusterReconciliationRunner) Reconcile() (res ctrl.Result, reterr error) {
8989
return r.RunReconciliationStages(
90+
r.SetFailureDomainsStatusMap,
9091
r.CreateFailureDomains(r.ReconciliationSubject.Spec.FailureDomains),
91-
r.CheckOwnedCRDsForReadiness(infrav1.GroupVersion.WithKind("CloudStackFailureDomain")),
9292
r.GetFailureDomains(r.FailureDomains),
9393
r.VerifyFailureDomainCRDs,
94-
r.SetFailureDomains,
9594
r.SetReady)
9695
}
9796

@@ -117,10 +116,10 @@ func (r *CloudStackClusterReconciliationRunner) VerifyFailureDomainCRDs() (ctrl.
117116
return ctrl.Result{}, nil
118117
}
119118

120-
// SetFailureDomains sets failure domains to be used for CAPI machine placement.
121-
func (r *CloudStackClusterReconciliationRunner) SetFailureDomains() (ctrl.Result, error) {
119+
// SetFailureDomainsStatusMap sets failure domains in CloudStackCluster status to be used for CAPI machine placement.
120+
func (r *CloudStackClusterReconciliationRunner) SetFailureDomainsStatusMap() (ctrl.Result, error) {
122121
r.ReconciliationSubject.Status.FailureDomains = clusterv1.FailureDomains{}
123-
for _, fdSpec := range r.FailureDomains.Items {
122+
for _, fdSpec := range r.ReconciliationSubject.Spec.FailureDomains {
124123
if !strings.HasSuffix(fdSpec.Name, "-"+r.CAPICluster.Name) { // Add cluster name suffix if missing.
125124
fdSpec.Name = fdSpec.Name + "-" + r.CAPICluster.Name
126125
}

controllers/cloudstackfailuredomain_controller.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package controllers
1919
import (
2020
"context"
2121

22-
2322
"github.com/pkg/errors"
2423
ctrl "sigs.k8s.io/controller-runtime"
2524
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
@@ -105,7 +104,7 @@ func (r *CloudStackFailureDomainReconciliationRunner) Reconcile() (retRes ctrl.R
105104
return ctrl.Result{}, nil
106105
}
107106

108-
// ReconcileDelete on the ReconciliationRunner actually attempts to delete the reconciliation subject.
107+
// ReconcileDelete on the ReconciliationRunner attempts to delete the reconciliation subject.
109108
func (r *CloudStackFailureDomainReconciliationRunner) ReconcileDelete() (retRes ctrl.Result, retErr error) {
110109
r.Log.Info("Deleting CloudStackFailureDomain")
111110
// Address Isolated Networks.

controllers/cloudstackisolatednetwork_controller.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,6 @@ func (r *CloudStackIsoNetReconciliationRunner) ReconcileDelete() (retRes ctrl.Re
9696
if res, err := r.GetParent(r.ReconciliationSubject, r.FailureDomain)(); r.ShouldReturn(res, err) {
9797
return res, err
9898
}
99-
if r.FailureDomain.Spec.Name == "" {
100-
return ctrl.Result{}, errors.New("couldn't get parent Failure Domain for placement")
101-
}
102-
res, err := r.AsFailureDomainUser(&r.FailureDomain.Spec)()
103-
if r.ShouldReturn(res, err) {
104-
return res, err
105-
}
10699
r.Log.Info("Deleting IsolatedNetwork.")
107100
if err := r.CSUser.DisposeIsoNetResources(r.FailureDomain, r.ReconciliationSubject, r.CSCluster); err != nil {
108101
if !strings.Contains(strings.ToLower(err.Error()), "no match found") {

0 commit comments

Comments
 (0)