Skip to content

Commit 24e3cde

Browse files
authored
Refactoring controller to check vm state before adding vm to lb rule (#6)
* Refactoring controller to check vm state before adding vm to lb rule * Adding PR template
1 parent feffe87 commit 24e3cde

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*Issue #, if available:*
2+
3+
*Description of changes:*
4+
5+
*Testing performed:*
6+
7+
8+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
9+
10+
<!-- If this is a security issue, please do not discuss on GitHub. Please report any suspected or confirmed security issues to AWS Security https://aws.amazon.com/security/vulnerability-reporting/ -->

controllers/cloudstackmachine_controller.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,6 @@ func (r *CloudStackMachineReconciler) reconcile(
179179
return ctrl.Result{}, err
180180
}
181181

182-
if util.IsControlPlaneMachine(machine) && csCluster.Status.NetworkType != cloud.NetworkTypeShared {
183-
log.Info("Assigning VM to load balancer rule.")
184-
err := r.CS.AssignVMToLoadBalancerRule(csCluster, *csMachine.Spec.InstanceID)
185-
if err != nil {
186-
return ctrl.Result{}, err
187-
}
188-
}
189-
190182
if csMachine.Status.InstanceState == "Running" {
191183
log.Info("Machine instance is Running...")
192184
csMachine.Status.Ready = true
@@ -201,6 +193,14 @@ func (r *CloudStackMachineReconciler) reconcile(
201193
return ctrl.Result{RequeueAfter: RequeueTimeout}, nil
202194
}
203195

196+
if util.IsControlPlaneMachine(machine) && csCluster.Status.NetworkType != cloud.NetworkTypeShared {
197+
log.Info("Assigning VM to load balancer rule.")
198+
err := r.CS.AssignVMToLoadBalancerRule(csCluster, *csMachine.Spec.InstanceID)
199+
if err != nil {
200+
return ctrl.Result{}, err
201+
}
202+
}
203+
204204
return ctrl.Result{}, nil
205205
}
206206

0 commit comments

Comments
 (0)