From 1abb8b99204c9b4e2441bd9d4b412583e610a7cf 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..39fc792d 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.JSON `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