Skip to content

Commit

Permalink
Fix CPIStatus Phase when ProviderID is not assigned
Browse files Browse the repository at this point in the history
  • Loading branch information
ridaz committed Jan 7, 2022
1 parent 621aa27 commit 216beb9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion controllers/vdoconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,9 @@ nodeloop:
func (r *VDOConfigReconciler) reconcileNodeProviderID(ctx vdocontext.VDOContext, config *vdov1alpha1.VDOConfig, clientset kubernetes.Interface, vsphereCloudConfigs *[]vdov1alpha1.VsphereCloudConfig) (bool, error) {
nodeStatus := make(map[string]vdov1alpha1.NodeStatus)
var updReq bool
allNodesReady := true

cpiStatus := vdov1alpha1.Configured
var cpiStatus vdov1alpha1.VDOConfigPhase
nodes, err := clientset.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
if err != nil {
return updReq, errors.Wrapf(err, "Error reconciling the providerID for CPI, unable to fetch list of nodes")
Expand All @@ -867,6 +868,7 @@ nodeLoop:
continue nodeLoop
}

allNodesReady = false
for _, taint := range node.Spec.Taints {
if taint.Key == CLOUD_PROVIDER_INIT_TAINT_KEY {

Expand Down Expand Up @@ -896,6 +898,14 @@ nodeLoop:

}

if len(nodeStatus) <= 0 {
return false, nil
}

if allNodesReady {
cpiStatus = vdov1alpha1.Configured
}

if config.Status.CPIStatus.Phase != cpiStatus ||
!reflect.DeepEqual(config.Status.CPIStatus.NodeStatus, nodeStatus) {
config.Status.CPIStatus.NodeStatus = nodeStatus
Expand Down

0 comments on commit 216beb9

Please sign in to comment.