Skip to content

Commit e40a2e5

Browse files
authored
dv, conditions: AnnPodSchedulable should overwrite AnnRunningCondition (#3799)
With #3753 a new annotation AnnPodSchedulable was introduced to allow updating the running condition of an importer Pod that was unschedulable. This commit makes it so the unschedulable condition takes precedence over AnnRunningCondition otherwise a race can occur where initial Pod creation failure sets the running condition to an erroneous one indefinitely as the Pod never finishes scheduling and thus never updates. Signed-off-by: Adi Aloni <[email protected]>
1 parent b6b7468 commit e40a2e5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/controller/datavolume/conditions.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ func updateCondition(conditions []cdiv1.DataVolumeCondition, conditionType cdiv1
6666
}
6767

6868
func updateRunningCondition(conditions []cdiv1.DataVolumeCondition, anno map[string]string) []cdiv1.DataVolumeCondition {
69-
if val, ok := anno[cc.AnnRunningCondition]; ok {
69+
if schedulable, ok := anno[cc.AnnPodSchedulable]; ok && schedulable == "false" {
70+
conditions = updateCondition(conditions, cdiv1.DataVolumeRunning, corev1.ConditionFalse, "Importer pod cannot be scheduled", "Unschedulable")
71+
} else if val, ok := anno[cc.AnnRunningCondition]; ok {
7072
switch strings.ToLower(val) {
7173
case "true":
7274
conditions = updateWithTargetRunning(conditions, anno)
@@ -75,8 +77,6 @@ func updateRunningCondition(conditions []cdiv1.DataVolumeCondition, anno map[str
7577
default:
7678
conditions = updateCondition(conditions, cdiv1.DataVolumeRunning, corev1.ConditionUnknown, anno[cc.AnnRunningConditionMessage], anno[cc.AnnRunningConditionReason])
7779
}
78-
} else if schedulable, ok := anno[cc.AnnPodSchedulable]; ok && schedulable == "false" {
79-
conditions = updateCondition(conditions, cdiv1.DataVolumeRunning, corev1.ConditionFalse, "Importer pod cannot be scheduled", "Unschedulable")
8080
} else {
8181
conditions = updateCondition(conditions, cdiv1.DataVolumeRunning, corev1.ConditionFalse, anno[cc.AnnRunningConditionMessage], anno[cc.AnnRunningConditionReason])
8282
}

0 commit comments

Comments
 (0)