@@ -164,11 +164,17 @@ func (rm *resourceManager) updateConditions (
164
164
165
165
// Terminal condition
166
166
var terminalCondition *ackv1alpha1.Condition = nil
167
+ var nonTerminalCondition *ackv1alpha1.Condition = nil
167
168
for _, condition := range ko.Status.Conditions {
169
+ // If terminal condition exists, other errors will
170
+ // will not be reported
168
171
if condition.Type == ackv1alpha1.ConditionTypeTerminal {
169
172
terminalCondition = condition
170
173
break
171
174
}
175
+ if condition.Type == ackv1alpha1.ConditionTypeNonTerminal {
176
+ nonTerminalCondition = condition
177
+ }
172
178
}
173
179
174
180
if rm.terminalAWSError(err) {
@@ -182,19 +188,43 @@ func (rm *resourceManager) updateConditions (
182
188
awsErr, _ := ackerr.AWSError(err)
183
189
errorMessage := awsErr.Message()
184
190
terminalCondition.Message = &errorMessage
185
- } else if terminalCondition != nil {
186
- terminalCondition.Status = corev1.ConditionFalse
187
- terminalCondition.Message = nil
191
+ } else {
192
+ // Clear the terminal condition if no longer present
193
+ if terminalCondition != nil {
194
+ terminalCondition.Status = corev1.ConditionFalse
195
+ terminalCondition.Message = nil
196
+ }
197
+ // Handling NonTerminal Conditions
198
+ if err != nil {
199
+ if nonTerminalCondition == nil {
200
+ // Add a new Condition containing a non-terminal error
201
+ nonTerminalCondition = &ackv1alpha1.Condition{
202
+ Type: ackv1alpha1.ConditionTypeNonTerminal,
203
+ }
204
+ ko.Status.Conditions = append(ko.Status.Conditions, nonTerminalCondition)
205
+ }
206
+ nonTerminalCondition.Status = corev1.ConditionTrue
207
+ awsErr, _ := ackerr.AWSError(err)
208
+ errorMessage := "Unknown Error"
209
+ if awsErr != nil {
210
+ errorMessage = awsErr.Message()
211
+ }
212
+ nonTerminalCondition.Message = &errorMessage
213
+ } else if nonTerminalCondition != nil {
214
+ nonTerminalCondition.Status = corev1.ConditionFalse
215
+ nonTerminalCondition.Message = nil
216
+ }
188
217
}
189
218
219
+
190
220
{ {- if $updateConditionsCustomMethodName := .CRD.UpdateConditionsCustomMethodName } }
191
221
// custom update conditions
192
222
customUpdate := rm.{ { $updateConditionsCustomMethodName } }(ko, r, err)
193
- if terminalCondition != nil || customUpdate {
223
+ if terminalCondition != nil || nonTerminalCondition != nil || customUpdate {
194
224
return &resource{ko} , true // updated
195
225
}
196
226
{ {- else } }
197
- if terminalCondition != nil {
227
+ if terminalCondition != nil || nonTerminalCondition != nil {
198
228
return &resource{ko} , true // updated
199
229
}
200
230
{ {- end } }
0 commit comments