mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-26 19:35:10 +00:00
Preserve conditions in case we are retrying expansion in some cases
When marking pvc expansion for failed condition, we should try and preserve old resizing conditions with different name.
This commit is contained in:
@@ -33,10 +33,11 @@ import (
|
||||
)
|
||||
|
||||
type conditionMergeTestCase struct {
|
||||
description string
|
||||
pvc *v1.PersistentVolumeClaim
|
||||
newConditions []v1.PersistentVolumeClaimCondition
|
||||
finalConditions []v1.PersistentVolumeClaimCondition
|
||||
description string
|
||||
pvc *v1.PersistentVolumeClaim
|
||||
keepOldResizeConditions bool
|
||||
newConditions []v1.PersistentVolumeClaimCondition
|
||||
finalConditions []v1.PersistentVolumeClaimCondition
|
||||
}
|
||||
|
||||
func TestMergeResizeCondition(t *testing.T) {
|
||||
@@ -132,10 +133,34 @@ func TestMergeResizeCondition(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "when adding new condition with existing resize conditions",
|
||||
pvc: pvc.DeepCopy(),
|
||||
keepOldResizeConditions: true,
|
||||
newConditions: []v1.PersistentVolumeClaimCondition{
|
||||
{
|
||||
Type: v1.PersistentVolumeClaimNodeResizeError,
|
||||
Status: v1.ConditionTrue,
|
||||
LastTransitionTime: currentTime,
|
||||
},
|
||||
},
|
||||
finalConditions: []v1.PersistentVolumeClaimCondition{
|
||||
{
|
||||
Type: v1.PersistentVolumeClaimResizing,
|
||||
Status: v1.ConditionTrue,
|
||||
LastTransitionTime: currentTime,
|
||||
},
|
||||
{
|
||||
Type: v1.PersistentVolumeClaimNodeResizeError,
|
||||
Status: v1.ConditionTrue,
|
||||
LastTransitionTime: currentTime,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, testcase := range testCases {
|
||||
updatePVC := MergeResizeConditionOnPVC(testcase.pvc, testcase.newConditions)
|
||||
updatePVC := MergeResizeConditionOnPVC(testcase.pvc, testcase.newConditions, testcase.keepOldResizeConditions)
|
||||
|
||||
updateConditions := updatePVC.Status.Conditions
|
||||
if !reflect.DeepEqual(updateConditions, testcase.finalConditions) {
|
||||
|
||||
Reference in New Issue
Block a user