@@ -1955,6 +1955,8 @@ func (s *PowerVSClusterScope) ReconcileLoadBalancers() (bool, error) {
1955
1955
loadBalancers = append (loadBalancers , s .IBMPowerVSCluster .Spec .LoadBalancers ... )
1956
1956
}
1957
1957
1958
+ isAnyLoadBalancerNotReady := false
1959
+
1958
1960
for index , loadBalancer := range loadBalancers {
1959
1961
var loadBalancerID * string
1960
1962
if loadBalancer .ID != nil {
@@ -1974,8 +1976,9 @@ func (s *PowerVSClusterScope) ReconcileLoadBalancers() (bool, error) {
1974
1976
return false , err
1975
1977
}
1976
1978
1977
- if requeue := s .checkLoadBalancerStatus (* loadBalancer ); requeue {
1978
- return requeue , nil
1979
+ if isReady := s .checkLoadBalancerStatus (* loadBalancer ); ! isReady {
1980
+ s .V (3 ).Info ("LoadBalancer is still not Active" , "name" , * loadBalancer .Name , "state" , * loadBalancer .ProvisioningStatus )
1981
+ isAnyLoadBalancerNotReady = true
1979
1982
}
1980
1983
1981
1984
loadBalancerStatus := infrav1beta2.VPCLoadBalancerStatus {
@@ -2012,25 +2015,26 @@ func (s *PowerVSClusterScope) ReconcileLoadBalancers() (bool, error) {
2012
2015
}
2013
2016
s .Info ("Created VPC load balancer" , "loadBalancerID" , loadBalancerStatus .ID )
2014
2017
s .SetLoadBalancerStatus (loadBalancer .Name , * loadBalancerStatus )
2018
+ isAnyLoadBalancerNotReady = true
2019
+ }
2020
+ if isAnyLoadBalancerNotReady {
2015
2021
return false , nil
2016
2022
}
2017
2023
return true , nil
2018
2024
}
2019
2025
2020
2026
// checkLoadBalancerStatus checks the state of a VPC load balancer.
2021
- // If state is pending, true is returned indicating a requeue for reconciliation.
2022
- // In all other cases, it returns false.
2027
+ // If state is active, true is returned, in all other cases, it returns false indicating that load balancer is still not ready.
2023
2028
func (s * PowerVSClusterScope ) checkLoadBalancerStatus (lb vpcv1.LoadBalancer ) bool {
2024
2029
s .V (3 ).Info ("Checking the status of VPC load balancer" , "name" , * lb .Name )
2025
2030
switch * lb .ProvisioningStatus {
2026
2031
case string (infrav1beta2 .VPCLoadBalancerStateActive ):
2027
2032
s .V (3 ).Info ("VPC load balancer is in active state" )
2033
+ return true
2028
2034
case string (infrav1beta2 .VPCLoadBalancerStateCreatePending ):
2029
2035
s .V (3 ).Info ("VPC load balancer creation is in pending state" )
2030
- return true
2031
2036
case string (infrav1beta2 .VPCLoadBalancerStateUpdatePending ):
2032
2037
s .V (3 ).Info ("VPC load balancer is in updating state" )
2033
- return true
2034
2038
}
2035
2039
return false
2036
2040
}
0 commit comments