Skip to content

Commit e4069a0

Browse files
committed
Updated setcondition v1beta2
1 parent 07f50a2 commit e4069a0

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

api/v1beta2/runtimecomponent_types.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1beta2
1818

1919
import (
20+
"sort"
2021
"time"
2122

2223
"github.com/application-stacks/runtime-component-operator/common"
@@ -1026,6 +1027,16 @@ func (s *RuntimeComponentStatus) SetCondition(c common.StatusCondition) {
10261027
if !found {
10271028
s.Conditions = append(s.Conditions, *condition)
10281029
}
1030+
// Re-sort conditions to prioritize 'Ready' condition
1031+
sort.Slice(s.Conditions, func(i, j int) bool {
1032+
if s.Conditions[i].GetType() == common.StatusConditionTypeReady {
1033+
return true
1034+
}
1035+
if s.Conditions[j].GetType() == common.StatusConditionTypeReady {
1036+
return false
1037+
}
1038+
return s.Conditions[i].GetType() < s.Conditions[j].GetType()
1039+
})
10291040
}
10301041

10311042
func convertToCommonStatusConditionType(c StatusConditionType) common.StatusConditionType {

0 commit comments

Comments
 (0)