From 0e289df5b037ddbf67fc422bd355e2f8a69aa4f6 Mon Sep 17 00:00:00 2001 From: gianlucm76 Date: Wed, 15 Feb 2023 10:33:10 -0800 Subject: [PATCH] Make NotificationSummaries per cluster --- api/v1alpha1/clusterhealthcheck_type.go | 12 ++--- api/v1alpha1/zz_generated.deepcopy.go | 14 ++--- ...projectsveltos.io_clusterhealthchecks.yaml | 51 ++++++++++--------- lib/crd/clusterhealthchecks.go | 51 ++++++++++--------- 4 files changed, 65 insertions(+), 63 deletions(-) diff --git a/api/v1alpha1/clusterhealthcheck_type.go b/api/v1alpha1/clusterhealthcheck_type.go index 94c952d..bdd98dd 100644 --- a/api/v1alpha1/clusterhealthcheck_type.go +++ b/api/v1alpha1/clusterhealthcheck_type.go @@ -88,6 +88,10 @@ type ClusterCondition struct { // Cluster conditions. // +optional Conditions []Condition `json:"conditions,omitempty"` + + // NotificationSummaries contains status information on notifications + // +optional + NotificationSummaries []NotificationSummary `json:"notificationSummaries,omitempty"` } // Event specifies different type of liveness checks @@ -184,14 +188,10 @@ type ClusterHealthCheckStatus struct { // ClusterHealthCheck ClusterSelector MatchingClusterRefs []corev1.ObjectReference `json:"matchingClusters,omitempty"` - // ClusterConditions contains conditions for all clusters matching - // ClusterHealthCheck instance + // ClusterConditions contains conditions and notification status for all clusters + // matching 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 b7d0274..eb15c5d 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -366,6 +366,13 @@ func (in *ClusterCondition) DeepCopyInto(out *ClusterCondition) { (*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 ClusterCondition. @@ -481,13 +488,6 @@ 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. diff --git a/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml b/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml index 8eb0f12..ed8356e 100644 --- a/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml +++ b/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml @@ -161,8 +161,8 @@ spec: status: properties: clusterCondition: - description: ClusterConditions contains conditions for all clusters - matching ClusterHealthCheck instance + description: ClusterConditions contains conditions and notification + status for all clusters matching ClusterHealthCheck instance items: properties: clusterInfo: @@ -270,6 +270,30 @@ spec: - type 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 required: - clusterInfo type: object @@ -338,29 +362,6 @@ 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 df579de..1b1d15a 100644 --- a/lib/crd/clusterhealthchecks.go +++ b/lib/crd/clusterhealthchecks.go @@ -180,8 +180,8 @@ spec: status: properties: clusterCondition: - description: ClusterConditions contains conditions for all clusters - matching ClusterHealthCheck instance + description: ClusterConditions contains conditions and notification + status for all clusters matching ClusterHealthCheck instance items: properties: clusterInfo: @@ -289,6 +289,30 @@ spec: - type 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 required: - clusterInfo type: object @@ -357,29 +381,6 @@ 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