Skip to content

Commit

Permalink
Add .Message to VR conditions
Browse files Browse the repository at this point in the history
Based on the messages addded in
csi-addons/kubernetes-csi-addons#691. We want to
propagate the error messages to the protected pvcs conditions.

Signed-off-by: Nir Soffer <[email protected]>
  • Loading branch information
nirs committed Nov 10, 2024
1 parent 91ebbd2 commit 586281b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/controller/vrg_volrep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2368,7 +2368,7 @@ func (v *vrgTest) promoteVolRepsAndDo(options promoteOptions, do func(int, int))

if options.ValidatedFailed {
volRepStatus.State = volrep.UnknownState
volRepStatus.Message = "precondition failed ..."
volRepStatus.Message = "failed to meet prerequisite: details..."
}

volRep.Status = volRepStatus
Expand Down Expand Up @@ -2411,11 +2411,13 @@ func (v *vrgTest) generateVRConditions(generation int64, options promoteOptions)
ObservedGeneration: generation,
Status: metav1.ConditionTrue,
LastTransitionTime: lastTransitionTime,
Message: "volume is validated",
}

if options.ValidatedFailed {
validated.Status = metav1.ConditionFalse
validated.Reason = volrep.PrerequisiteNotMet
validated.Message = "failed to meet prerequisite: details..."
}

conditions = append(conditions, validated)
Expand All @@ -2427,11 +2429,13 @@ func (v *vrgTest) generateVRConditions(generation int64, options promoteOptions)
ObservedGeneration: generation,
Status: metav1.ConditionTrue,
LastTransitionTime: lastTransitionTime,
Message: "volume is completed",
}

if options.ValidatedFailed {
completed.Status = metav1.ConditionFalse
completed.Reason = volrep.FailedToPromote
completed.Message = "failed to promote"
}

degraded := metav1.Condition{
Expand All @@ -2440,13 +2444,15 @@ func (v *vrgTest) generateVRConditions(generation int64, options promoteOptions)
ObservedGeneration: generation,
Status: metav1.ConditionFalse,
LastTransitionTime: lastTransitionTime,
Message: "volume is healthy",
}
resyncing := metav1.Condition{
Type: volrep.ConditionResyncing,
Reason: volrep.NotResyncing,
ObservedGeneration: generation,
Status: metav1.ConditionFalse,
LastTransitionTime: lastTransitionTime,
Message: "volume is not resyncing",
}

return append(conditions, completed, degraded, resyncing)
Expand Down

0 comments on commit 586281b

Please sign in to comment.