@@ -40,32 +40,44 @@ import (
40
40
// Message: error string value is used as message
41
41
//
42
42
// 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 {
44
44
conditionType := typePrefix + operatorsv1 .OperatorStatusTypeDegraded
45
45
condition := handleCondition (conditionType , reason , err )
46
- return v1helpers .UpdateConditionFn (condition )
46
+ return ConditionUpdate {
47
+ ConditionType : conditionType ,
48
+ StatusUpdateFn : v1helpers .UpdateConditionFn (condition ),
49
+ }
47
50
}
48
51
49
- func HandleProgressing (typePrefix string , reason string , err error ) v1helpers. UpdateStatusFunc {
52
+ func HandleProgressing (typePrefix string , reason string , err error ) ConditionUpdate {
50
53
conditionType := typePrefix + operatorsv1 .OperatorStatusTypeProgressing
51
54
condition := handleCondition (conditionType , reason , err )
52
- return v1helpers .UpdateConditionFn (condition )
55
+ return ConditionUpdate {
56
+ ConditionType : conditionType ,
57
+ StatusUpdateFn : v1helpers .UpdateConditionFn (condition ),
58
+ }
53
59
}
54
60
55
- func HandleAvailable (typePrefix string , reason string , err error ) v1helpers. UpdateStatusFunc {
61
+ func HandleAvailable (typePrefix string , reason string , err error ) ConditionUpdate {
56
62
conditionType := typePrefix + operatorsv1 .OperatorStatusTypeAvailable
57
63
condition := handleCondition (conditionType , reason , err )
58
- return v1helpers .UpdateConditionFn (condition )
64
+ return ConditionUpdate {
65
+ ConditionType : conditionType ,
66
+ StatusUpdateFn : v1helpers .UpdateConditionFn (condition ),
67
+ }
59
68
}
60
69
61
- func HandleUpgradable (typePrefix string , reason string , err error ) v1helpers. UpdateStatusFunc {
70
+ func HandleUpgradable (typePrefix string , reason string , err error ) ConditionUpdate {
62
71
conditionType := typePrefix + operatorsv1 .OperatorStatusTypeUpgradeable
63
72
condition := handleCondition (conditionType , reason , err )
64
- return v1helpers .UpdateConditionFn (condition )
73
+ return ConditionUpdate {
74
+ ConditionType : conditionType ,
75
+ StatusUpdateFn : v1helpers .UpdateConditionFn (condition ),
76
+ }
65
77
}
66
78
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 {}
69
81
for _ , condition := range conditions {
70
82
klog .V (2 ).Info ("\n resetting condition: " , condition .Type )
71
83
if strings .HasSuffix (condition .Type , operatorsv1 .OperatorStatusTypeDegraded ) {
@@ -101,8 +113,8 @@ func (c *StatusHandler) ResetConditions(conditions []operatorsv1.OperatorConditi
101
113
// - Type suffix will be set to Degraded
102
114
// TODO: when we eliminate the special case SyncError, this helper can go away.
103
115
// 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 {}
106
118
if errors .IsSyncError (err ) {
107
119
updateStatusFuncs = append (updateStatusFuncs , HandleDegraded (typePrefix , reason , nil ))
108
120
updateStatusFuncs = append (updateStatusFuncs , HandleProgressing (typePrefix , reason , err ))
0 commit comments