From 83b4b00cb6521d2d5817d9cba2b1a1028ea8c99d Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Fri, 20 Dec 2024 20:18:26 +0545 Subject: [PATCH] feat: notification silence CRD --- models/notifications.go | 3 +++ schema/notifications.hcl | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/models/notifications.go b/models/notifications.go index d206d64f..5dca4428 100644 --- a/models/notifications.go +++ b/models/notifications.go @@ -183,6 +183,7 @@ type NotificationSilence struct { ID uuid.UUID `json:"id" gorm:"default:generate_ulid()"` Namespace string `json:"namespace,omitempty"` + Name string `json:"name,omitempty"` Filter types.CelExpression `json:"filter,omitempty"` From time.Time `json:"from"` Until time.Time `json:"until"` @@ -194,6 +195,8 @@ type NotificationSilence struct { UpdatedAt time.Time `json:"updated_at" time_format:"postgres_timestamp" gorm:"<-:false"` DeletedAt *time.Time `json:"deleted_at,omitempty"` + Selectors []types.ResourceSelector `json:"selectors,omitempty"` + // Error contains cel expression error in the filter Error *string `json:"error,omitempty"` } diff --git a/schema/notifications.hcl b/schema/notifications.hcl index 2455c0e8..49eaf68a 100644 --- a/schema/notifications.hcl +++ b/schema/notifications.hcl @@ -233,6 +233,11 @@ table "notification_silences" { null = false type = text } + column "name" { + null = false + type = text + default = sql("generate_ulid()") # temporary default value to make the migration possible. we can remove this later. + } column "description" { null = true type = text @@ -241,6 +246,11 @@ table "notification_silences" { null = true type = text } + column "selectors" { + null = true + type = jsonb + comment = "list of resource selectors" + } column "error" { null = true type = text