diff --git a/api/v1beta1/clusterhealthcheck_type.go b/api/v1beta1/clusterhealthcheck_type.go index e2a4e84..82815b2 100644 --- a/api/v1beta1/clusterhealthcheck_type.go +++ b/api/v1beta1/clusterhealthcheck_type.go @@ -293,6 +293,11 @@ type ClusterHealthCheckSpec struct { // +optional ClusterSelector Selector `json:"clusterSelector,omitempty"` + // ClusterRefs identifies clusters to associate to. + // These are added to the clusters matched by ClusterSelector. + // +optional + ClusterRefs []corev1.ObjectReference `json:"clusterRefs,omitempty"` + // LivenessChecks is a list of source of liveness checks to evaluate. // Anytime one of those changes, notifications will be sent // +patchMergeKey=name diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 1756c7a..c7790bd 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -560,6 +560,11 @@ func (in *ClusterHealthCheckList) DeepCopyObject() runtime.Object { func (in *ClusterHealthCheckSpec) DeepCopyInto(out *ClusterHealthCheckSpec) { *out = *in in.ClusterSelector.DeepCopyInto(&out.ClusterSelector) + if in.ClusterRefs != nil { + in, out := &in.ClusterRefs, &out.ClusterRefs + *out = make([]v1.ObjectReference, len(*in)) + copy(*out, *in) + } if in.LivenessChecks != nil { in, out := &in.LivenessChecks, &out.LivenessChecks *out = make([]LivenessCheck, len(*in)) diff --git a/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml b/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml index f9528cb..0275ef5 100644 --- a/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml +++ b/config/crd/bases/lib.projectsveltos.io_clusterhealthchecks.yaml @@ -40,6 +40,55 @@ spec: spec: description: ClusterHealthCheckSpec defines the desired state of ClusterHealthCheck properties: + clusterRefs: + description: |- + ClusterRefs identifies clusters to associate to. + These are added to the clusters matched by ClusterSelector. + items: + description: ObjectReference contains enough information to let + you inspect or modify the referred object. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + type: string + kind: + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + namespace: + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + type: string + resourceVersion: + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + type: string + uid: + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids + type: string + type: object + x-kubernetes-map-type: atomic + type: array clusterSelector: description: Selector identifies clusters to associate to. properties: diff --git a/lib/crd/clusterhealthchecks.go b/lib/crd/clusterhealthchecks.go index 36f31f5..400fe77 100644 --- a/lib/crd/clusterhealthchecks.go +++ b/lib/crd/clusterhealthchecks.go @@ -58,6 +58,55 @@ spec: spec: description: ClusterHealthCheckSpec defines the desired state of ClusterHealthCheck properties: + clusterRefs: + description: |- + ClusterRefs identifies clusters to associate to. + These are added to the clusters matched by ClusterSelector. + items: + description: ObjectReference contains enough information to let + you inspect or modify the referred object. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + type: string + kind: + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + namespace: + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + type: string + resourceVersion: + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + type: string + uid: + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids + type: string + type: object + x-kubernetes-map-type: atomic + type: array clusterSelector: description: Selector identifies clusters to associate to. properties: diff --git a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_clusterhealthchecks.lib.projectsveltos.io.yaml b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_clusterhealthchecks.lib.projectsveltos.io.yaml index f8509a0..e43d8fb 100644 --- a/manifests/apiextensions.k8s.io_v1_customresourcedefinition_clusterhealthchecks.lib.projectsveltos.io.yaml +++ b/manifests/apiextensions.k8s.io_v1_customresourcedefinition_clusterhealthchecks.lib.projectsveltos.io.yaml @@ -39,6 +39,55 @@ spec: spec: description: ClusterHealthCheckSpec defines the desired state of ClusterHealthCheck properties: + clusterRefs: + description: |- + ClusterRefs identifies clusters to associate to. + These are added to the clusters matched by ClusterSelector. + items: + description: ObjectReference contains enough information to let + you inspect or modify the referred object. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: |- + If referring to a piece of an object instead of an entire object, this string + should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within a pod, this would take on a value like: + "spec.containers{name}" (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" (container with + index 2 in this pod). This syntax is chosen only to have some well-defined way of + referencing a part of an object. + type: string + kind: + description: |- + Kind of the referent. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + type: string + namespace: + description: |- + Namespace of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ + type: string + resourceVersion: + description: |- + Specific resourceVersion to which this reference is made, if any. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + type: string + uid: + description: |- + UID of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids + type: string + type: object + x-kubernetes-map-type: atomic + type: array clusterSelector: description: Selector identifies clusters to associate to. properties: