Skip to content

Commit

Permalink
fix(vd): add condition message
Browse files Browse the repository at this point in the history
Signed-off-by: Isteb4k <dmitry.rakitin@flant.com>
  • Loading branch information
Isteb4k committed Jun 27, 2024
1 parent 0bad9f3 commit 32193d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package internal
import (
"context"
"errors"
"fmt"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down Expand Up @@ -92,7 +93,7 @@ func (h ResizingHandler) Handle(ctx context.Context, vd *virtv2.VirtualDisk) (re
case -1:
condition.Status = metav1.ConditionFalse
condition.Reason = vdcondition.NotRequested
condition.Message = ""
condition.Message = fmt.Sprintf("The virtual disk size is too low: should be >= %s.", pvcSpecSize.String())
return reconcile.Result{}, nil
// Expected disk size is GREATER THAN expected pvc size: resize needed, resizing to a larger size.
case 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,9 @@ var _ = Describe("Resizing handler Run", func() {

_, err := h.Handle(context.Background(), vd)
Expect(err).To(BeNil())
Expect(vd.Status.Conditions).To(ContainElement(metav1.Condition{
Type: vdcondition.ResizedType,
Status: metav1.ConditionFalse,
Reason: vdcondition.NotRequested,
}))
resized, _ := service.GetCondition(vdcondition.ResizedType, vd.Status.Conditions)
Expect(resized.Status).To(Equal(metav1.ConditionFalse))
Expect(resized.Reason).To(Equal(vdcondition.NotRequested))
})

It("Resize has started (vd.spec.size > pvc.spec.size)", func() {
Expand Down

0 comments on commit 32193d6

Please sign in to comment.