Skip to content

Commit

Permalink
fix: take tolerations into consideration for readiness check
Browse files Browse the repository at this point in the history
Signed-off-by: Suleyman Akbas <[email protected]>
  • Loading branch information
suleymanakbas91 committed Nov 23, 2023
1 parent 6c1a9fc commit d78e4b0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions controllers/lvmcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,17 +309,17 @@ func (r *LVMClusterReconciler) getExpectedVGCount(ctx context.Context, instance
}

for _, deviceClass := range instance.Spec.Storage.DeviceClasses {
for i := range nodeList.Items {
ignoreDueToNoSchedule := false
for _, taint := range nodeList.Items[i].Spec.Taints {
if taint.Effect == corev1.TaintEffectNoSchedule {
r.Log.V(1).Info("even though node selector matches, NoSchedule forces ignore of the Node",
"node", nodeList.Items[i].GetName())
ignoreDueToNoSchedule = true
for _, node := range nodeList.Items {
ignoreDueToTaint := false
for _, taint := range node.Spec.Taints {
if !corev1helper.TolerationsTolerateTaint(instance.Spec.Tolerations, &taint) {

Check failure on line 315 in controllers/lvmcluster_controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

G601: Implicit memory aliasing in for loop. (gosec)
r.Log.V(1).Info("node is ignored because of the taint",
"node", node.GetName(), "taint", taint)
ignoreDueToTaint = true
break
}
}
if ignoreDueToNoSchedule {
if ignoreDueToTaint {
continue
}

Expand All @@ -328,7 +328,7 @@ func (r *LVMClusterReconciler) getExpectedVGCount(ctx context.Context, instance
continue
}

matches, err := corev1helper.MatchNodeSelectorTerms(&nodeList.Items[i], deviceClass.NodeSelector)
matches, err := corev1helper.MatchNodeSelectorTerms(&node, deviceClass.NodeSelector)

Check failure on line 331 in controllers/lvmcluster_controller.go

View workflow job for this annotation

GitHub Actions / golangci-lint

G601: Implicit memory aliasing in for loop. (gosec)
if err != nil {
r.Log.Error(err, "failed to match node selector")
return 0, err
Expand Down

0 comments on commit d78e4b0

Please sign in to comment.