File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed
resource_customizations/k8s.keycloak.org/Keycloak Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,18 @@ if obj.status == nil or obj.status.conditions == nil then
77end
88
99-- Sort conditions by lastTransitionTime, from old to new.
10+ -- Ensure that conditions with nil lastTransitionTime are always sorted after those with non-nil values.
1011table.sort (obj .status .conditions , function (a , b )
11- return a .lastTransitionTime < b .lastTransitionTime
12+ -- Nil values are considered "less than" non-nil values.
13+ -- This means that conditions with nil lastTransitionTime will be sorted to the end.
14+ if a .lastTransitionTime == nil then
15+ return false
16+ elseif b .lastTransitionTime == nil then
17+ return true
18+ else
19+ -- If both have non-nil lastTransitionTime, compare them normally.
20+ return a .lastTransitionTime < b .lastTransitionTime
21+ end
1222end )
1323
1424for _ , condition in ipairs (obj .status .conditions ) do
Original file line number Diff line number Diff line change 1414- healthStatus :
1515 status : Degraded
1616 message : " Has Errors: Waiting for foo/keycloak-1 due to CrashLoopBackOff: back-off 10s"
17- inputPath : testdata/degraded.yaml
17+ inputPath : testdata/degraded.yaml
18+ - healthStatus :
19+ status : Healthy
20+ message : " "
21+ inputPath : testdata/nil_last_transition_time.yaml
Original file line number Diff line number Diff line change 1+ apiVersion : k8s.keycloak.org/v1alpha1
2+ kind : Keycloak
3+ metadata :
4+ name : keycloak-23
5+ namespace : keycloak
6+ status :
7+ conditions :
8+ - type : Ready
9+ status : " True"
10+ lastTransitionTime : " 2025-05-06T12:00:00Z" # Non-nil lastTransitionTime
11+ - type : HasErrors
12+ status : " False"
13+ lastTransitionTime : null # Nil lastTransitionTime
You can’t perform that action at this time.
0 commit comments