Skip to content

Commit a9ef071

Browse files
Rakshith-Ropenshift-cherrypick-robot
authored andcommitted
controller: fix reclaimspacejob reason bug
Status.Condition[*].Reason is a required field and it needs a camelCase string to be given. If not given, object Update will fail. Signed-off-by: Rakshith R <rar@redhat.com>
1 parent 8bb48c9 commit a9ef071

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

controllers/reclaimspacejob_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ const (
5151

5252
// failed condition type.
5353
conditionFailed = "Failed"
54+
// failed reason type.
55+
// TODO: add more useful reason types.
56+
reasonFailed = "failed"
5457
)
5558

5659
// ReclaimSpaceJobReconciler reconciles a ReclaimSpaceJob object.
@@ -429,6 +432,7 @@ func setFailedCondition(
429432
ObservedGeneration: observedGeneration,
430433
LastTransitionTime: metav1.NewTime(time.Now()),
431434
Message: message,
435+
Reason: reasonFailed,
432436
}
433437
for i := range *conditions {
434438
if (*conditions)[i].Type == conditionFailed {

controllers/reclaimspacejob_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestSetFailedCondition(t *testing.T) {
4545
Status: v1.ConditionTrue,
4646
ObservedGeneration: 0,
4747
LastTransitionTime: v1.NewTime(time.Now()),
48-
Reason: "",
48+
Reason: reasonFailed,
4949
Message: "err 1",
5050
},
5151
},

0 commit comments

Comments
 (0)