Skip to content

Commit d266e59

Browse files
committed
update the condition handle functions to expose type
1 parent b9801e6 commit d266e59

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

pkg/console/status/status.go

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,44 @@ import (
4040
// Message: error string value is used as message
4141
//
4242
// all degraded suffix conditions will be aggregated into a final "Degraded" status that will be set on the console ClusterOperator
43-
func HandleDegraded(typePrefix string, reason string, err error) v1helpers.UpdateStatusFunc {
43+
func HandleDegraded(typePrefix string, reason string, err error) ConditionUpdate {
4444
conditionType := typePrefix + operatorsv1.OperatorStatusTypeDegraded
4545
condition := handleCondition(conditionType, reason, err)
46-
return v1helpers.UpdateConditionFn(condition)
46+
return ConditionUpdate{
47+
ConditionType: conditionType,
48+
StatusUpdateFn: v1helpers.UpdateConditionFn(condition),
49+
}
4750
}
4851

49-
func HandleProgressing(typePrefix string, reason string, err error) v1helpers.UpdateStatusFunc {
52+
func HandleProgressing(typePrefix string, reason string, err error) ConditionUpdate {
5053
conditionType := typePrefix + operatorsv1.OperatorStatusTypeProgressing
5154
condition := handleCondition(conditionType, reason, err)
52-
return v1helpers.UpdateConditionFn(condition)
55+
return ConditionUpdate{
56+
ConditionType: conditionType,
57+
StatusUpdateFn: v1helpers.UpdateConditionFn(condition),
58+
}
5359
}
5460

55-
func HandleAvailable(typePrefix string, reason string, err error) v1helpers.UpdateStatusFunc {
61+
func HandleAvailable(typePrefix string, reason string, err error) ConditionUpdate {
5662
conditionType := typePrefix + operatorsv1.OperatorStatusTypeAvailable
5763
condition := handleCondition(conditionType, reason, err)
58-
return v1helpers.UpdateConditionFn(condition)
64+
return ConditionUpdate{
65+
ConditionType: conditionType,
66+
StatusUpdateFn: v1helpers.UpdateConditionFn(condition),
67+
}
5968
}
6069

61-
func HandleUpgradable(typePrefix string, reason string, err error) v1helpers.UpdateStatusFunc {
70+
func HandleUpgradable(typePrefix string, reason string, err error) ConditionUpdate {
6271
conditionType := typePrefix + operatorsv1.OperatorStatusTypeUpgradeable
6372
condition := handleCondition(conditionType, reason, err)
64-
return v1helpers.UpdateConditionFn(condition)
73+
return ConditionUpdate{
74+
ConditionType: conditionType,
75+
StatusUpdateFn: v1helpers.UpdateConditionFn(condition),
76+
}
6577
}
6678

67-
func (c *StatusHandler) ResetConditions(conditions []operatorsv1.OperatorCondition) []v1helpers.UpdateStatusFunc {
68-
updateStatusFuncs := []v1helpers.UpdateStatusFunc{}
79+
func (c *StatusHandler) ResetConditions(conditions []operatorsv1.OperatorCondition) []ConditionUpdate {
80+
updateStatusFuncs := []ConditionUpdate{}
6981
for _, condition := range conditions {
7082
klog.V(2).Info("\nresetting condition: ", condition.Type)
7183
if strings.HasSuffix(condition.Type, operatorsv1.OperatorStatusTypeDegraded) {
@@ -101,8 +113,8 @@ func (c *StatusHandler) ResetConditions(conditions []operatorsv1.OperatorConditi
101113
// - Type suffix will be set to Degraded
102114
// TODO: when we eliminate the special case SyncError, this helper can go away.
103115
// When we do that, however, we must make sure to register deprecated conditions with NewRemoveStaleConditions()
104-
func HandleProgressingOrDegraded(typePrefix string, reason string, err error) []v1helpers.UpdateStatusFunc {
105-
updateStatusFuncs := []v1helpers.UpdateStatusFunc{}
116+
func HandleProgressingOrDegraded(typePrefix string, reason string, err error) []ConditionUpdate {
117+
updateStatusFuncs := []ConditionUpdate{}
106118
if errors.IsSyncError(err) {
107119
updateStatusFuncs = append(updateStatusFuncs, HandleDegraded(typePrefix, reason, nil))
108120
updateStatusFuncs = append(updateStatusFuncs, HandleProgressing(typePrefix, reason, err))

0 commit comments

Comments
 (0)