diff --git a/api/v1beta2/alert_types.go b/api/v1beta2/alert_types.go index b6531cf11..3a9e2f7c3 100644 --- a/api/v1beta2/alert_types.go +++ b/api/v1beta2/alert_types.go @@ -50,6 +50,13 @@ type AlertSpec struct { // +optional InclusionList []string `json:"inclusionList,omitempty"` + // EventMetadata is an optional field for adding metadata to events emitted by the + // controller. Metadata fields added by the controller have priority over the fields + // added here, and the fields added here have priority over fields originally present + // in the event. + // +optional + EventMetadata map[string]string `json:"eventMetadata,omitempty"` + // ExclusionList specifies a list of Golang regular expressions // to be used for excluding messages. // +optional diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index cdbd33f57..78dd00068 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -103,6 +103,13 @@ func (in *AlertSpec) DeepCopyInto(out *AlertSpec) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.EventMetadata != nil { + in, out := &in.EventMetadata, &out.EventMetadata + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } if in.ExclusionList != nil { in, out := &in.ExclusionList, &out.ExclusionList *out = make([]string, len(*in)) diff --git a/config/crd/bases/notification.toolkit.fluxcd.io_alerts.yaml b/config/crd/bases/notification.toolkit.fluxcd.io_alerts.yaml index 23b9142b4..121e6ddd1 100644 --- a/config/crd/bases/notification.toolkit.fluxcd.io_alerts.yaml +++ b/config/crd/bases/notification.toolkit.fluxcd.io_alerts.yaml @@ -240,6 +240,14 @@ spec: description: AlertSpec defines an alerting rule for events involving a list of objects. properties: + eventMetadata: + additionalProperties: + type: string + description: EventMetadata is an optional field for adding metadata + to events emitted by the controller. Metadata fields added by the + controller have priority over the fields added here, and the fields + added here have priority over fields originally present in the event. + type: object eventSeverity: default: info description: EventSeverity specifies how to filter events based on diff --git a/docs/api/v1beta2/notification.md b/docs/api/v1beta2/notification.md index 0672eaf27..d097025a5 100644 --- a/docs/api/v1beta2/notification.md +++ b/docs/api/v1beta2/notification.md @@ -127,6 +127,21 @@ to be used for including messages.
eventMetadata
EventMetadata is an optional field for adding metadata to events emitted by the +controller. Metadata fields added by the controller have priority over the fields +added here, and the fields added here have priority over fields originally present +in the event.
+exclusionList
eventMetadata
EventMetadata is an optional field for adding metadata to events emitted by the +controller. Metadata fields added by the controller have priority over the fields +added here, and the fields added here have priority over fields originally present +in the event.
+exclusionList