diff --git a/changelog/CHANGELOG.md b/changelog/CHANGELOG.md index 2a9e8ccd44212..c3b61b2746b0e 100644 --- a/changelog/CHANGELOG.md +++ b/changelog/CHANGELOG.md @@ -1,2 +1,2 @@ ### Features -- feat: manage clusters via proxy \ No newline at end of file +- feat(event-reporter): added warning conditions reporting \ No newline at end of file diff --git a/event_reporter/reporter/application_errors_parser.go b/event_reporter/reporter/application_errors_parser.go index ba678c949385b..9b2ccaf22e4fd 100644 --- a/event_reporter/reporter/application_errors_parser.go +++ b/event_reporter/reporter/application_errors_parser.go @@ -39,31 +39,42 @@ func parseApplicationSyncResultErrorsFromConditions(status appv1.ApplicationStat return errs } for _, cnd := range status.Conditions { - if !strings.Contains(strings.ToLower(cnd.Type), "error") { - continue - } - - lastSeen := metav1.Now() - if cnd.LastTransitionTime != nil { - lastSeen = *cnd.LastTransitionTime - } - if (strings.Contains(cnd.Message, syncTaskUnsuccessfullErrorMessage) || strings.Contains(cnd.Message, syncTaskNotValidErrorMessage)) && status.OperationState != nil && status.OperationState.SyncResult != nil && status.OperationState.SyncResult.Resources != nil { resourcesSyncErrors := parseAggregativeResourcesSyncErrors(status.OperationState.SyncResult.Resources) errs = append(errs, resourcesSyncErrors...) - } else { + continue + } + + if level := getConditionLevel(cnd); level != "" { errs = append(errs, &events.ObjectError{ Type: "sync", - Level: "error", + Level: level, Message: cnd.Message, - LastSeen: lastSeen, + LastSeen: getConditionTime(cnd), }) } } return errs } +func getConditionLevel(cnd appv1.ApplicationCondition) string { + if cnd.IsWarning() { + return "warning" + } + if cnd.IsError() { + return "error" + } + return "" +} + +func getConditionTime(cnd appv1.ApplicationCondition) metav1.Time { + if cnd.LastTransitionTime != nil { + return *cnd.LastTransitionTime + } + return metav1.Now() +} + func parseResourceSyncResultErrors(rs *appv1.ResourceStatus, os *appv1.OperationState) []*events.ObjectError { errors := []*events.ObjectError{} if os.SyncResult == nil { @@ -133,7 +144,7 @@ func parseAggregativeHealthErrors(rs *appv1.ResourceStatus, apptree *appv1.Appli } if addReference { - newErr.SourceReference = events.ErrorSourceReference{ + newErr.SourceReference = &events.ErrorSourceReference{ Group: rs.Group, Version: rs.Version, Kind: rs.Kind, diff --git a/event_reporter/reporter/applications_errors_parser_test.go b/event_reporter/reporter/applications_errors_parser_test.go index 5aea5a3aba7af..bb05f67e04fcc 100644 --- a/event_reporter/reporter/applications_errors_parser_test.go +++ b/event_reporter/reporter/applications_errors_parser_test.go @@ -137,12 +137,41 @@ func TestParseResourceSyncResultErrors(t *testing.T) { }) } +func TestGetConditionLevel(t *testing.T) { + errorsTypes := []v1alpha1.ApplicationCondition{ + {Type: v1alpha1.ApplicationConditionDeletionError}, + {Type: v1alpha1.ApplicationConditionInvalidSpecError}, + {Type: v1alpha1.ApplicationConditionComparisonError}, + {Type: v1alpha1.ApplicationConditionSyncError}, + {Type: v1alpha1.ApplicationConditionUnknownError}, + } + for _, errorAppCondition := range errorsTypes { + t.Run("parses as error "+errorAppCondition.Type, func(t *testing.T) { + level := getConditionLevel(errorAppCondition) + assert.Equal(t, "error", level) + }) + } + + warningTypes := []v1alpha1.ApplicationCondition{ + {Type: v1alpha1.ApplicationConditionSharedResourceWarning}, + {Type: v1alpha1.ApplicationConditionRepeatedResourceWarning}, + {Type: v1alpha1.ApplicationConditionExcludedResourceWarning}, + {Type: v1alpha1.ApplicationConditionOrphanedResourceWarning}, + } + for _, warningAppCondition := range warningTypes { + t.Run("parses as warning "+warningAppCondition.Type, func(t *testing.T) { + level := getConditionLevel(warningAppCondition) + assert.Equal(t, "warning", level) + }) + } +} + func TestParseApplicationSyncResultErrorsFromConditions(t *testing.T) { t.Run("conditions exists", func(t *testing.T) { errors := parseApplicationSyncResultErrorsFromConditions(v1alpha1.ApplicationStatus{ Conditions: []v1alpha1.ApplicationCondition{ { - Type: "error", + Type: v1alpha1.ApplicationConditionSyncError, Message: "error message", }, }, @@ -154,11 +183,27 @@ func TestParseApplicationSyncResultErrorsFromConditions(t *testing.T) { assert.Equal(t, "error", errors[0].Level) }) + t.Run("warning exists", func(t *testing.T) { + errors := parseApplicationSyncResultErrorsFromConditions(v1alpha1.ApplicationStatus{ + Conditions: []v1alpha1.ApplicationCondition{ + { + Type: v1alpha1.ApplicationConditionOrphanedResourceWarning, + Message: "Application has 8 orphaned resources", + }, + }, + }) + + assert.Len(t, errors, 1) + assert.Equal(t, "Application has 8 orphaned resources", errors[0].Message) + assert.Equal(t, "sync", errors[0].Type) + assert.Equal(t, "warning", errors[0].Level) + }) + t.Run("conditions erorr replaced with sync result errors", func(t *testing.T) { errors := parseApplicationSyncResultErrorsFromConditions(v1alpha1.ApplicationStatus{ Conditions: []v1alpha1.ApplicationCondition{ { - Type: "error", + Type: v1alpha1.ApplicationConditionSyncError, Message: syncTaskUnsuccessfullErrorMessage, }, }, diff --git a/pkg/apiclient/events/events.pb.go b/pkg/apiclient/events/events.pb.go index 553024e3a9b74..d484348341781 100644 --- a/pkg/apiclient/events/events.pb.go +++ b/pkg/apiclient/events/events.pb.go @@ -463,14 +463,14 @@ func (m *ObjectSource) GetTrackingMethod() string { // * // Holds error information; present only when error sent with application but not resource itself type ObjectError struct { - Type string `protobuf:"bytes,1,opt,name=type" json:"type"` - Level string `protobuf:"bytes,2,opt,name=level" json:"level"` - Message string `protobuf:"bytes,3,opt,name=message" json:"message"` - LastSeen v1.Time `protobuf:"bytes,4,opt,name=lastSeen" json:"lastSeen"` - SourceReference ErrorSourceReference `protobuf:"bytes,5,opt,name=sourceReference" json:"sourceReference"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Type string `protobuf:"bytes,1,opt,name=type" json:"type"` + Level string `protobuf:"bytes,2,opt,name=level" json:"level"` + Message string `protobuf:"bytes,3,opt,name=message" json:"message"` + LastSeen v1.Time `protobuf:"bytes,4,opt,name=lastSeen" json:"lastSeen"` + SourceReference *ErrorSourceReference `protobuf:"bytes,5,opt,name=sourceReference" json:"sourceReference,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ObjectError) Reset() { *m = ObjectError{} } @@ -534,11 +534,11 @@ func (m *ObjectError) GetLastSeen() v1.Time { return v1.Time{} } -func (m *ObjectError) GetSourceReference() ErrorSourceReference { +func (m *ObjectError) GetSourceReference() *ErrorSourceReference { if m != nil { return m.SourceReference } - return ErrorSourceReference{} + return nil } // * @@ -760,73 +760,72 @@ func init() { func init() { proto.RegisterFile("server/application/events.proto", fileDescriptor_3ad9267ec62b112f) } var fileDescriptor_3ad9267ec62b112f = []byte{ - // 1041 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x6e, 0x1b, 0xb7, - 0x13, 0xff, 0xaf, 0x2c, 0xdb, 0xd1, 0x48, 0x76, 0xf2, 0x67, 0x9c, 0x94, 0x30, 0x52, 0x47, 0x10, - 0x8c, 0x42, 0x08, 0x92, 0x15, 0xec, 0x7e, 0x20, 0x09, 0x8a, 0x02, 0x0e, 0xec, 0xa2, 0x6e, 0xed, - 0xb6, 0x58, 0x37, 0x39, 0xe4, 0x46, 0xef, 0x8e, 0x57, 0x8c, 0x56, 0x24, 0x4b, 0x52, 0x02, 0x74, - 0xeb, 0xa1, 0x4f, 0xd3, 0x27, 0xc9, 0xb1, 0x4f, 0x50, 0x14, 0xbe, 0xf4, 0x35, 0x0a, 0x72, 0x77, - 0x65, 0xae, 0xab, 0x43, 0xd3, 0x1b, 0xf9, 0x9b, 0xdf, 0x0c, 0x39, 0x9f, 0x24, 0x3c, 0x36, 0xa8, - 0xe7, 0xa8, 0x47, 0x4c, 0xa9, 0x82, 0xa7, 0xcc, 0x72, 0x29, 0x46, 0x38, 0x47, 0x61, 0x4d, 0xac, - 0xb4, 0xb4, 0x92, 0x6c, 0xe6, 0x28, 0x50, 0xf3, 0x74, 0xf7, 0x2c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x86, 0x09, 0x00, - 0x00, + // 1038 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x6e, 0x1b, 0x37, + 0x10, 0xee, 0xca, 0xb2, 0x1d, 0x8d, 0x64, 0x27, 0xa5, 0xed, 0x94, 0x30, 0x5c, 0x47, 0x10, 0x8c, + 0x42, 0x08, 0x92, 0x15, 0xec, 0xfe, 0x20, 0x09, 0x8a, 0x02, 0x0e, 0xec, 0xb6, 0x6e, 0xed, 0xb6, + 0x58, 0x37, 0x39, 0xe4, 0x46, 0xef, 0x8e, 0x57, 0x8c, 0x56, 0x24, 0x4b, 0x52, 0x02, 0x74, 0xef, + 0xd3, 0xf4, 0x49, 0x72, 0xec, 0x13, 0x14, 0x85, 0x2f, 0x7d, 0x87, 0x9e, 0x0a, 0x72, 0x57, 0x32, + 0xd7, 0xd5, 0xa1, 0xe9, 0x8d, 0xfc, 0xe6, 0x9b, 0x21, 0xe7, 0x97, 0x84, 0x47, 0x06, 0xf5, 0x14, + 0xf5, 0x80, 0x29, 0x55, 0xf0, 0x94, 0x59, 0x2e, 0xc5, 0x00, 0xa7, 0x28, 0xac, 0x89, 0x95, 0x96, + 0x56, 0x92, 0xf5, 0x1c, 0x05, 0x6a, 0x9e, 0xee, 0x9e, 0xe7, 0xdc, 0x0e, 0x27, 0x57, 0x71, 0x2a, + 0xc7, 0x03, 0xa6, 0x73, 0xa9, 0xb4, 0x7c, 0xeb, 0x17, 0x4f, 0xd3, 0x6c, 0x30, 0x3d, 0x1a, 0xa8, + 0x51, 0x3e, 0x60, 0x8a, 0x9b, 0x9a, 0xa9, 0xe9, 0x21, 0x2b, 0xd4, 0x90, 0x1d, 0x0e, 0xbc, 0x15, + 0x66, 0x31, 0x2b, 0xcd, 0xee, 0x7e, 0x36, 0x7a, 0x66, 0x62, 0x2e, 0x9d, 0xc6, 0x98, 0xa5, 0x43, + 0x2e,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x99, 0xa1, 0x84, 0x7c, 0x01, 0x5b, 0x4c, 0xa9, 0x33, 0x61, 0x2c, 0x13, 0x29, + 0xfa, 0xc4, 0x7f, 0x8f, 0x33, 0xfa, 0x30, 0x50, 0x58, 0x46, 0x70, 0x9d, 0x6d, 0x35, 0x4b, 0x47, + 0x5c, 0xe4, 0x17, 0x68, 0x87, 0x32, 0xa3, 0x1f, 0x85, 0x9d, 0x5d, 0x97, 0xed, 0x7e, 0x09, 0x9b, + 0xf5, 0x62, 0x23, 0x0f, 0x60, 0x65, 0x84, 0xb3, 0x72, 0x7a, 0x24, 0x6e, 0x49, 0xb6, 0x61, 0x75, + 0xca, 0x8a, 0x09, 0x96, 0x23, 0x22, 0x29, 0x37, 0x2f, 0x1a, 0xcf, 0xa2, 0xde, 0xdf, 0x11, 0xb4, + 0x83, 0xf1, 0xe6, 0xfa, 0xdb, 0xce, 0x14, 0xd6, 0x46, 0x8f, 0x47, 0xc8, 0x2e, 0xac, 0x16, 0x38, + 0xc5, 0xa2, 0x36, 0x66, 0x4a, 0xc8, 0x65, 0x6c, 0x5c, 0x65, 0x34, 0x9c, 0x2c, 0x73, 0x90, 0x9c, + 0xc3, 0xbd, 0x82, 0x19, 0x7b, 0x89, 0x28, 0xfc, 0x58, 0xf9, 0x3f, 0x25, 0xbc, 0xb0, 0x40, 0xbe, + 0x81, 0xfb, 0xe5, 0xc8, 0x4e, 0xf0, 0x1a, 0x35, 0x8a, 0x14, 0xab, 0xf1, 0xfb, 0xf1, 0xa2, 0x17, + 0xbd, 0x33, 0x97, 0x75, 0x52, 0x72, 0x57, 0xab, 0xf7, 0x5b, 0x04, 0xdb, 0xcb, 0x98, 0xce, 0xd7, + 0x5c, 0xcb, 0x89, 0xaa, 0x85, 0xa1, 0x84, 0x9c, 0xaf, 0xd3, 0x72, 0x88, 0xd7, 0x22, 0x31, 0x07, + 0x5d, 0x04, 0x47, 0x5c, 0x64, 0xfe, 0xcd, 0x59, 0x44, 0xd0, 0x21, 0x4e, 0xe2, 0x9f, 0xc2, 0x66, + 0x28, 0xf1, 0x0f, 0x62, 0x0f, 0x5a, 0x62, 0x51, 0x50, 0xe1, 0x68, 0xbd, 0x85, 0x7b, 0x6f, 0xa0, + 0x73, 0x82, 0x0a, 0x45, 0x86, 0x22, 0xe5, 0x68, 0xdc, 0xc3, 0x5a, 0xc8, 0x74, 0x54, 0xa5, 0xd9, + 0xaf, 0x1d, 0x96, 0xa1, 0x32, 0x55, 0x9a, 0xfd, 0xda, 0xf5, 0xa5, 0xc6, 0x5f, 0x26, 0x5c, 0xe3, + 0xd8, 0xfd, 0x4d, 0xca, 0x04, 0x25, 0x35, 0xac, 0xa7, 0x60, 0x6b, 0xc9, 0x83, 0x45, 0xf6, 0x01, + 0x6e, 0x9f, 0xac, 0xea, 0xa0, 0x00, 0x21, 0xcf, 0xa1, 0x93, 0x05, 0x57, 0xf2, 0xc7, 0x86, 0xcf, + 0x6c, 0x78, 0xdf, 0xa4, 0x46, 0x7d, 0x79, 0xfc, 0xee, 0x66, 0x3f, 0xfa, 0xfd, 0x66, 0x3f, 0xfa, + 0xf3, 0x66, 0x3f, 0x7a, 0xf3, 0xe9, 0x7f, 0xfb, 0x20, 0xa5, 0x05, 0x47, 0x61, 0xab, 0x4f, 0xd6, + 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd4, 0x18, 0x11, 0xf8, 0x80, 0x09, 0x00, 0x00, } func (m *EventSource) Marshal() (dAtA []byte, err error) { @@ -1215,16 +1214,18 @@ func (m *ObjectError) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - { - size, err := m.SourceReference.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.SourceReference != nil { + { + size, err := m.SourceReference.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintEvents(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a } - i-- - dAtA[i] = 0x2a { size, err := m.LastSeen.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1567,8 +1568,10 @@ func (m *ObjectError) Size() (n int) { n += 1 + l + sovEvents(uint64(l)) l = m.LastSeen.Size() n += 1 + l + sovEvents(uint64(l)) - l = m.SourceReference.Size() - n += 1 + l + sovEvents(uint64(l)) + if m.SourceReference != nil { + l = m.SourceReference.Size() + n += 1 + l + sovEvents(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -3200,6 +3203,9 @@ func (m *ObjectError) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.SourceReference == nil { + m.SourceReference = &ErrorSourceReference{} + } if err := m.SourceReference.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/pkg/apis/application/v1alpha1/types.go b/pkg/apis/application/v1alpha1/types.go index 60674e145bbf4..449e4efaeed2f 100644 --- a/pkg/apis/application/v1alpha1/types.go +++ b/pkg/apis/application/v1alpha1/types.go @@ -2869,6 +2869,11 @@ func (condition *ApplicationCondition) IsError() bool { return strings.HasSuffix(condition.Type, "Error") } +// IsWarning returns true if a condition indicates an warning condition +func (condition *ApplicationCondition) IsWarning() bool { + return strings.HasSuffix(condition.Type, "Warning") +} + // Equals compares two instances of ApplicationSource and return true if instances are equal. func (source *ApplicationSource) Equals(other *ApplicationSource) bool { if source == nil && other == nil { diff --git a/server/application/events.proto b/server/application/events.proto index 0f7e460f75970..f70d522e17a78 100644 --- a/server/application/events.proto +++ b/server/application/events.proto @@ -83,7 +83,7 @@ message ObjectError { optional string level = 2 [(gogoproto.nullable) = false]; optional string message = 3 [(gogoproto.nullable) = false]; optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastSeen = 4 [(gogoproto.nullable) = false]; - optional ErrorSourceReference sourceReference = 5 [(gogoproto.nullable) = false]; + optional ErrorSourceReference sourceReference = 5; } /**