diff --git a/api/v1alpha1/clusterhealthcheck_type.go b/api/v1alpha1/clusterhealthcheck_type.go index 3221843..94c952d 100644 --- a/api/v1alpha1/clusterhealthcheck_type.go +++ b/api/v1alpha1/clusterhealthcheck_type.go @@ -136,6 +136,32 @@ type Notification struct { NotificationRef *corev1.ObjectReference `json:"notificationRef,omitempty"` } +// NotificationStatus specifies status of notifications +// +kubebuilder:validation:Enum:=Delivered;FailedToDeliver +type NotificationStatus string + +const ( + // NotificationStatusDelivered indicates notification has been delivered + NotificationStatusDelivered = NotificationStatus("Delivered") + + // NotificationStatusFailedToDeliver indicates notification was not delivered + // due to an error + NotificationStatusFailedToDeliver = NotificationStatus("FailedToDeliver") +) + +type NotificationSummary struct { + // Name of the notification check. + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // NotificationStatus specifies the notification status + Status NotificationStatus `json:"status"` + + // FailureMessage is a human consumable message explaining the + // misconfiguration + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` +} + // ClusterHealthCheckSpec defines the desired state of ClusterHealthCheck type ClusterHealthCheckSpec struct { // ClusterSelector identifies clusters to associate to. @@ -162,6 +188,10 @@ type ClusterHealthCheckStatus struct { // ClusterHealthCheck instance // +optional ClusterConditions []ClusterCondition `json:"clusterCondition,omitempty"` + + // NotificationSummaries contains status information on notifications + // +optional + NotificationSummaries []NotificationSummary `json:"notificationSummaries,omitempty"` } //+kubebuilder:object:root=true diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 0385ab4..b7d0274 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -481,6 +481,13 @@ func (in *ClusterHealthCheckStatus) DeepCopyInto(out *ClusterHealthCheckStatus) (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.NotificationSummaries != nil { + in, out := &in.NotificationSummaries, &out.NotificationSummaries + *out = make([]NotificationSummary, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterHealthCheckStatus. @@ -796,6 +803,26 @@ func (in *Notification) DeepCopy() *Notification { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NotificationSummary) DeepCopyInto(out *NotificationSummary) { + *out = *in + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NotificationSummary. +func (in *NotificationSummary) DeepCopy() *NotificationSummary { + if in == nil { + return nil + } + out := new(NotificationSummary) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PolicyRef) DeepCopyInto(out *PolicyRef) { *out = *in diff --git a/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml b/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml index 0e59316..8eb0f12 100644 --- a/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml +++ b/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml @@ -338,6 +338,29 @@ spec: type: string type: object type: array + notificationSummaries: + description: NotificationSummaries contains status information on + notifications + items: + properties: + failureMessage: + description: FailureMessage is a human consumable message explaining + the misconfiguration + type: string + name: + description: Name of the notification check. + type: string + status: + description: NotificationStatus specifies the notification status + enum: + - Delivered + - FailedToDeliver + type: string + required: + - name + - status + type: object + type: array type: object type: object served: true diff --git a/lib/crd/clusterhealthchecks.go b/lib/crd/clusterhealthchecks.go index ba4bb77..df579de 100644 --- a/lib/crd/clusterhealthchecks.go +++ b/lib/crd/clusterhealthchecks.go @@ -357,6 +357,29 @@ spec: type: string type: object type: array + notificationSummaries: + description: NotificationSummaries contains status information on + notifications + items: + properties: + failureMessage: + description: FailureMessage is a human consumable message explaining + the misconfiguration + type: string + name: + description: Name of the notification check. + type: string + status: + description: NotificationStatus specifies the notification status + enum: + - Delivered + - FailedToDeliver + type: string + required: + - name + - status + type: object + type: array type: object type: object served: true