Skip to content

Commit c73e5b1

Browse files
author
Joshua Reed
committed
Basic fd controller test runs now.
1 parent 26692a0 commit c73e5b1

8 files changed

+4
-29
lines changed

controllers/cloudstackaffinitygroup_controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package controllers
1818

1919
import (
20-
"github.com/onsi/ginkgo/v2"
2120
"context"
2221

2322
ctrl "sigs.k8s.io/controller-runtime"
@@ -55,7 +54,6 @@ func NewCSAGReconciliationRunner() *CloudStackAGReconciliationRunner {
5554
}
5655

5756
func (reconciler *CloudStackAffinityGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
58-
defer ginkgo.GinkgoRecover()
5957
return NewCSAGReconciliationRunner().
6058
UsingBaseReconciler(reconciler.ReconcilerBase).
6159
ForRequest(req).
@@ -64,7 +62,6 @@ func (reconciler *CloudStackAffinityGroupReconciler) Reconcile(ctx context.Conte
6462
}
6563

6664
func (r *CloudStackAGReconciliationRunner) Reconcile() (ctrl.Result, error) {
67-
defer ginkgo.GinkgoRecover()
6865
controllerutil.AddFinalizer(r.ReconciliationSubject, infrav1.AffinityGroupFinalizer)
6966
affinityGroup := &cloud.AffinityGroup{Name: r.ReconciliationSubject.Spec.Name, Type: r.ReconciliationSubject.Spec.Type}
7067
if err := r.CSUser.GetOrCreateAffinityGroup(affinityGroup); err != nil {

controllers/cloudstackcluster_controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package controllers
1818

1919
import (
20-
"github.com/onsi/ginkgo/v2"
2120
"context"
2221
"fmt"
2322
"reflect"
@@ -77,7 +76,6 @@ func NewCSClusterReconciliationRunner() *CloudStackClusterReconciliationRunner {
7776

7877
// Reconcile is the method k8s will call upon a reconciliation request.
7978
func (reconciler *CloudStackClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (retRes ctrl.Result, retErr error) {
80-
defer ginkgo.GinkgoRecover()
8179
return NewCSClusterReconciliationRunner().
8280
UsingBaseReconciler(reconciler.ReconcilerBase).
8381
ForRequest(req).
@@ -87,7 +85,6 @@ func (reconciler *CloudStackClusterReconciler) Reconcile(ctx context.Context, re
8785

8886
// Reconcile actually reconciles the CloudStackCluster.
8987
func (r *CloudStackClusterReconciliationRunner) Reconcile() (res ctrl.Result, reterr error) {
90-
defer ginkgo.GinkgoRecover()
9188
return r.RunReconciliationStages(
9289
r.RequeueIfMissingBaseCRs,
9390
r.CreateFailureDomains(r.ReconciliationSubject.Spec.FailureDomains),

controllers/cloudstackfailuredomain_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ package controllers
1919
import (
2020
"context"
2121

22-
"github.com/onsi/ginkgo/v2"
23-
2422
ctrl "sigs.k8s.io/controller-runtime"
2523

2624
infrav1 "sigs.k8s.io/cluster-api-provider-cloudstack/api/v1beta2"
@@ -56,7 +54,6 @@ func NewCSFailureDomainReconciliationRunner() *CloudStackFailureDomainReconcilia
5654

5755
// Reconcile is the method k8s will call upon a reconciliation request.
5856
func (reconciler *CloudStackFailureDomainReconciler) Reconcile(ctx context.Context, req ctrl.Request) (retRes ctrl.Result, retErr error) {
59-
defer ginkgo.GinkgoRecover()
6057
return NewCSFailureDomainReconciliationRunner().
6158
UsingBaseReconciler(reconciler.ReconcilerBase).
6259
ForRequest(req).
@@ -66,7 +63,6 @@ func (reconciler *CloudStackFailureDomainReconciler) Reconcile(ctx context.Conte
6663

6764
// Reconcile on the ReconciliationRunner actually attempts to modify or create the reconciliation subject.
6865
func (r *CloudStackFailureDomainReconciliationRunner) Reconcile() (retRes ctrl.Result, retErr error) {
69-
defer ginkgo.GinkgoRecover()
7066
r.Log.Info("blah2")
7167
r.ReconciliationSubject.Status.Ready = true
7268
return ctrl.Result{}, nil

controllers/cloudstackisolatednetwork_controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package controllers
1818

1919
import (
20-
"github.com/onsi/ginkgo/v2"
2120
"context"
2221
"strings"
2322

@@ -58,7 +57,6 @@ func NewCSIsoNetReconciliationRunner() *CloudStackIsoNetReconciliationRunner {
5857
}
5958

6059
func (reconciler *CloudStackIsoNetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, retErr error) {
61-
defer ginkgo.GinkgoRecover()
6260
return NewCSIsoNetReconciliationRunner().
6361
UsingBaseReconciler(reconciler.ReconcilerBase).
6462
ForRequest(req).
@@ -67,7 +65,6 @@ func (reconciler *CloudStackIsoNetReconciler) Reconcile(ctx context.Context, req
6765
}
6866

6967
func (r *CloudStackIsoNetReconciliationRunner) Reconcile() (retRes ctrl.Result, retErr error) {
70-
defer ginkgo.GinkgoRecover()
7168
if res, err := r.RequeueIfMissingBaseCRs(); r.ShouldReturn(res, err) {
7269
return res, err
7370
}

controllers/cloudstackmachine_controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package controllers
1818

1919
import (
20-
"github.com/onsi/ginkgo/v2"
2120
"context"
2221
"fmt"
2322
"math/rand"
@@ -82,7 +81,6 @@ func NewCSMachineReconciliationRunner() *CloudStackMachineReconciliationRunner {
8281
// Reconcile is part of the main kubernetes reconciliation loop which aims to
8382
// move the current state of the cluster closer to the desired state.
8483
func (reconciler *CloudStackMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, retErr error) {
85-
defer ginkgo.GinkgoRecover()
8684
return NewCSMachineReconciliationRunner().
8785
UsingBaseReconciler(reconciler.ReconcilerBase).
8886
ForRequest(req).
@@ -91,7 +89,6 @@ func (reconciler *CloudStackMachineReconciler) Reconcile(ctx context.Context, re
9189
}
9290

9391
func (r *CloudStackMachineReconciliationRunner) Reconcile() (retRes ctrl.Result, reterr error) {
94-
defer ginkgo.GinkgoRecover()
9592
return r.RunReconciliationStages(
9693
r.GetZonesAndRequeueIfMissing(r.Zones),
9794
r.GetParent(r.ReconciliationSubject, r.CAPIMachine),

controllers/cloudstackmachinestatechecker_controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package controllers
1818

1919
import (
20-
"github.com/onsi/ginkgo/v2"
2120
"context"
2221
"strings"
2322
"time"
@@ -60,7 +59,6 @@ func NewCSMachineStateCheckerReconciliationRunner() *CloudStackMachineStateCheck
6059
}
6160

6261
func (r *CloudStackMachineStateCheckerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
63-
defer ginkgo.GinkgoRecover()
6462
return NewCSMachineStateCheckerReconciliationRunner().
6563
UsingBaseReconciler(r.ReconcilerBase).
6664
ForRequest(req).
@@ -69,7 +67,6 @@ func (r *CloudStackMachineStateCheckerReconciler) Reconcile(ctx context.Context,
6967
}
7068

7169
func (r *CloudStackMachineStateCheckerReconciliationRunner) Reconcile() (ctrl.Result, error) {
72-
defer ginkgo.GinkgoRecover()
7370
if res, err := r.GetParent(r.ReconciliationSubject, r.CSMachine)(); r.ShouldReturn(res, err) {
7471
return res, err
7572
}

controllers/cloudstackzone_controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package controllers
1818

1919
import (
20-
"github.com/onsi/ginkgo/v2"
2120
"context"
2221

2322
ctrl "sigs.k8s.io/controller-runtime"
@@ -58,7 +57,6 @@ func NewCSZoneReconciliationRunner() *CloudStackZoneReconciliationRunner {
5857

5958
// Reconciler Reconcile adapts the runner to the runner to what k8s expects.
6059
func (reconciler *CloudStackZoneReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, retErr error) {
61-
defer ginkgo.GinkgoRecover()
6260
return NewCSZoneReconciliationRunner().
6361
UsingBaseReconciler(reconciler.ReconcilerBase).
6462
ForRequest(req).
@@ -75,7 +73,6 @@ func (reconciler *CloudStackZoneReconciler) SetupWithManager(mgr ctrl.Manager) e
7573

7674
// Reconcile attempts to move the state of CRs to the requested state.
7775
func (r *CloudStackZoneReconciliationRunner) Reconcile() (retRes ctrl.Result, reterr error) {
78-
defer ginkgo.GinkgoRecover()
7976
// Prevent premature deletion.
8077
controllerutil.AddFinalizer(r.ReconciliationSubject, infrav1.ZoneFinalizer)
8178

main.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,6 @@ func main() {
167167

168168
setupReconcilers(base, mgr)
169169

170-
if err = (&controllers.CloudStackFailureDomainReconciler{
171-
Client: mgr.GetClient(),
172-
Scheme: mgr.GetScheme(),
173-
}).SetupWithManager(mgr); err != nil {
174-
setupLog.Error(err, "unable to create controller", "controller", "CloudStackFailureDomain")
175-
os.Exit(1)
176-
}
177170
// +kubebuilder:scaffold:builder
178171

179172
// Add health and ready checks.
@@ -232,4 +225,8 @@ func setupReconcilers(base utils.ReconcilerBase, mgr manager.Manager) {
232225
setupLog.Error(err, "unable to create controller", "controller", "CloudStackAffinityGroup")
233226
os.Exit(1)
234227
}
228+
if err := (&controllers.CloudStackFailureDomainReconciler{ReconcilerBase: base}).SetupWithManager(mgr); err != nil {
229+
setupLog.Error(err, "unable to create controller", "controller", "CloudStackFailureDomain")
230+
os.Exit(1)
231+
}
235232
}

0 commit comments

Comments
 (0)