From 851df4cda096fb58b2fe6bba413adeed6665cce3 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Tue, 27 May 2025 15:00:49 +0200 Subject: [PATCH 1/5] feat: add clusterobservability spec for tracing and opentelemetry Signed-off-by: Pavol Loffay --- ...y.openshift.io_clusterobservabilities.yaml | 28 +++ docs/api.md | 212 +++++++++++++++++- docs/clusterobservability.md | 67 ++++++ .../observability/v1alpha1/opentelemetry.go | 11 + pkg/apis/observability/v1alpha1/tracing.go | 5 + pkg/apis/observability/v1alpha1/types.go | 23 ++ .../v1alpha1/zz_generated.deepcopy.go | 102 ++++++++- 7 files changed, 446 insertions(+), 2 deletions(-) create mode 100644 docs/clusterobservability.md create mode 100644 pkg/apis/observability/v1alpha1/opentelemetry.go create mode 100644 pkg/apis/observability/v1alpha1/tracing.go diff --git a/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml b/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml index 26c3542eb..0c41febd4 100644 --- a/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml +++ b/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml @@ -39,6 +39,34 @@ spec: type: object spec: description: Spec defines the desired state of the cluster observability. + properties: + capabilities: + description: CapabilitiesSpec defines the observability capabilities. + properties: + opentelemetry: + properties: + enabled: + type: boolean + exporter: + properties: + endpoint: + type: string + type: object + type: object + tracing: + properties: + enabled: + type: boolean + type: object + type: object + storage: + properties: + secret: + properties: + name: + type: string + type: object + type: object type: object status: description: Status of the signal manager. diff --git a/docs/api.md b/docs/api.md index 3997c7e10..158d52e19 100644 --- a/docs/api.md +++ b/docs/api.md @@ -4028,7 +4028,7 @@ ClusterObservability defines the desired state of the observability stack. Refer to the Kubernetes API documentation for the fields of the `metadata` field. true - spec + spec object Spec defines the desired state of the cluster observability.
@@ -4044,6 +4044,216 @@ ClusterObservability defines the desired state of the observability stack. + +### ClusterObservability.spec +[↩ Parent](#clusterobservability) + + + +Spec defines the desired state of the cluster observability. + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
capabilitiesobject + CapabilitiesSpec defines the observability capabilities.
+
false
storageobject +
+
false
+ + +### ClusterObservability.spec.capabilities +[↩ Parent](#clusterobservabilityspec) + + + +CapabilitiesSpec defines the observability capabilities. + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
opentelemetryobject +
+
false
tracingobject +
+
false
+ + +### ClusterObservability.spec.capabilities.opentelemetry +[↩ Parent](#clusterobservabilityspeccapabilities) + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
enabledboolean +
+
false
exporterobject +
+
false
+ + +### ClusterObservability.spec.capabilities.opentelemetry.exporter +[↩ Parent](#clusterobservabilityspeccapabilitiesopentelemetry) + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
endpointstring +
+
false
+ + +### ClusterObservability.spec.capabilities.tracing +[↩ Parent](#clusterobservabilityspeccapabilities) + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
enabledboolean +
+
false
+ + +### ClusterObservability.spec.storage +[↩ Parent](#clusterobservabilityspec) + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
secretobject +
+
false
+ + +### ClusterObservability.spec.storage.secret +[↩ Parent](#clusterobservabilityspecstorage) + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
namestring +
+
false
+ ## UIPlugin [↩ Parent](#observabilityopenshiftiov1alpha1 ) diff --git a/docs/clusterobservability.md b/docs/clusterobservability.md new file mode 100644 index 000000000..0ba3a5d44 --- /dev/null +++ b/docs/clusterobservability.md @@ -0,0 +1,67 @@ +# ClusterObservability CRD + +## Examples + +### Logging and tracing + +```yaml +apiVersion: observability.openshift.io/v1alpha1 +kind: ClusterObservability +metadata: + name: logging-tracing +spec: + storage: + secret: + name: minio + type: s3 + capabilities: + logging: + enabled: true + tracing: + enabled: true + opentelemetry: + enabled: true + exporter: + endpoint: http://dynatrace:4317 + headers: + x-dynatrace: "true" +``` + +Notes: +* installs the Loki, ClusterLogForwarder, Tempo and opentelemetry operators +* creates storage secret for `LokiStack` and `TempoStack` from the secret `minio` which is reconciled by the `ClusterObservability` +* deploys logging stack with `ClusterLogForwarder` and `LokiStack` in the `openshift-logging` namespace +* deploys tracing stack with `OpenTelemetryCollector` and `TempoStack` in the `openshift-distributed-tracing` namespace +* Installs the UI plugins for Loki and Tempo +* The appropriate operators are installed only when given capability is enabled + +### OpenTelemetry with tracing and Dynatrace + +```yaml +apiVersion: observability.openshift.io/v1alpha1 +kind: ClusterObservability +metadata: + name: logging-tracing +spec: + storage: + secret: + name: minio + type: s3 + capabilities: + tracing: + enabled: true + opentelemetry: + enabled: true + tracesincluster: true + exporter: + endpoint: http://dynatrace:4317 + headers: + x-dynatrace: "token..." +``` + +Notes: +* installs the opentelemetry and tempo operators +* deploys tracing stack with `OpenTelemetryCollector` and `TempoStack` in the `openshift-distributed-tracing` namespace +* deploys `OpenTelemetryCollector` in the `openshift-opentelemetry` +* configures OTLP exporter on the collector to send traces to Dynatrace +* configures collector to export trace data to Tempo deployed by the `ClusterObservability` CR diff --git a/pkg/apis/observability/v1alpha1/opentelemetry.go b/pkg/apis/observability/v1alpha1/opentelemetry.go new file mode 100644 index 000000000..cd4e7d9d4 --- /dev/null +++ b/pkg/apis/observability/v1alpha1/opentelemetry.go @@ -0,0 +1,11 @@ +package v1alpha1 + +type OpenTelemetrySpec struct { + Enabled bool `json:"enabled,omitempty"` + + Exporter OTLPExporter `json:"exporter,omitempty"` +} + +type OTLPExporter struct { + Endpoint string `json:"endpoint,omitempty"` +} diff --git a/pkg/apis/observability/v1alpha1/tracing.go b/pkg/apis/observability/v1alpha1/tracing.go new file mode 100644 index 000000000..03cccffa4 --- /dev/null +++ b/pkg/apis/observability/v1alpha1/tracing.go @@ -0,0 +1,5 @@ +package v1alpha1 + +type TracingSpec struct { + Enabled bool `json:"enabled,omitempty"` +} diff --git a/pkg/apis/observability/v1alpha1/types.go b/pkg/apis/observability/v1alpha1/types.go index d641c3110..82234e73a 100644 --- a/pkg/apis/observability/v1alpha1/types.go +++ b/pkg/apis/observability/v1alpha1/types.go @@ -37,7 +37,30 @@ type ClusterObservabilityList struct { } type ClusterObservabilitySpec struct { + Storage StorageSpec `json:"storage,omitempty"` + + Capabilities *CapabilitiesSpec `json:"capabilities,omitempty"` } // ClusterObservabilityStatus defines the observed state of ClusterObservability. type ClusterObservabilityStatus struct{} + +type StorageSpec struct { + Secret SecretSpec `json:"secret,omitempty"` +} + +type SecretSpec struct { + Name string `json:"name,omitempty"` +} + +// CapabilitiesSpec defines the observability capabilities. +type CapabilitiesSpec struct { + + // +optional + // +kubebuilder:validation:Optional + Tracing TracingSpec `json:"tracing,omitempty"` + + // +optional + // +kubebuilder:validation:Optional + OpenTelemetry OpenTelemetrySpec `json:"opentelemetry,omitempty"` +} diff --git a/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go index 18a20869a..3f3c412d7 100644 --- a/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go @@ -24,12 +24,29 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CapabilitiesSpec) DeepCopyInto(out *CapabilitiesSpec) { + *out = *in + out.Tracing = in.Tracing + out.OpenTelemetry = in.OpenTelemetry +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CapabilitiesSpec. +func (in *CapabilitiesSpec) DeepCopy() *CapabilitiesSpec { + if in == nil { + return nil + } + out := new(CapabilitiesSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterObservability) DeepCopyInto(out *ClusterObservability) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) out.Status = in.Status } @@ -86,6 +103,12 @@ func (in *ClusterObservabilityList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterObservabilitySpec) DeepCopyInto(out *ClusterObservabilitySpec) { *out = *in + out.Storage = in.Storage + if in.Capabilities != nil { + in, out := &in.Capabilities, &out.Capabilities + *out = new(CapabilitiesSpec) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterObservabilitySpec. @@ -112,3 +135,80 @@ func (in *ClusterObservabilityStatus) DeepCopy() *ClusterObservabilityStatus { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OTLPExporter) DeepCopyInto(out *OTLPExporter) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OTLPExporter. +func (in *OTLPExporter) DeepCopy() *OTLPExporter { + if in == nil { + return nil + } + out := new(OTLPExporter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OpenTelemetrySpec) DeepCopyInto(out *OpenTelemetrySpec) { + *out = *in + out.Exporter = in.Exporter +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenTelemetrySpec. +func (in *OpenTelemetrySpec) DeepCopy() *OpenTelemetrySpec { + if in == nil { + return nil + } + out := new(OpenTelemetrySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretSpec) DeepCopyInto(out *SecretSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretSpec. +func (in *SecretSpec) DeepCopy() *SecretSpec { + if in == nil { + return nil + } + out := new(SecretSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StorageSpec) DeepCopyInto(out *StorageSpec) { + *out = *in + out.Secret = in.Secret +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageSpec. +func (in *StorageSpec) DeepCopy() *StorageSpec { + if in == nil { + return nil + } + out := new(StorageSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TracingSpec) DeepCopyInto(out *TracingSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TracingSpec. +func (in *TracingSpec) DeepCopy() *TracingSpec { + if in == nil { + return nil + } + out := new(TracingSpec) + in.DeepCopyInto(out) + return out +} From 51388410990ce89f82b9e623881fe53c6659cc60 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Tue, 27 May 2025 15:11:41 +0200 Subject: [PATCH 2/5] feat: add clusterobservability spec for tracing and opentelemetry Signed-off-by: Pavol Loffay --- docs/clusterobservability.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/clusterobservability.md b/docs/clusterobservability.md index 0ba3a5d44..104a4138b 100644 --- a/docs/clusterobservability.md +++ b/docs/clusterobservability.md @@ -19,12 +19,6 @@ spec: enabled: true tracing: enabled: true - opentelemetry: - enabled: true - exporter: - endpoint: http://dynatrace:4317 - headers: - x-dynatrace: "true" ``` Notes: From 3deee55d18332bab259e30441e324b212e215655 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Wed, 28 May 2025 09:51:49 +0200 Subject: [PATCH 3/5] feat: add clusterobservability spec for tracing and opentelemetry Signed-off-by: Pavol Loffay --- ...y.openshift.io_clusterobservabilities.yaml | 34 ++++++++++- docs/api.md | 56 ++++++++++++++----- docs/clusterobservability.md | 49 +++++++++++++++- .../observability/v1alpha1/opentelemetry.go | 9 ++- pkg/apis/observability/v1alpha1/tracing.go | 3 +- pkg/apis/observability/v1alpha1/types.go | 24 ++++++++ .../v1alpha1/zz_generated.deepcopy.go | 27 ++++++++- 7 files changed, 180 insertions(+), 22 deletions(-) diff --git a/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml b/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml index 0c41febd4..7f74f9a3b 100644 --- a/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml +++ b/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml @@ -41,29 +41,61 @@ spec: description: Spec defines the desired state of the cluster observability. properties: capabilities: - description: CapabilitiesSpec defines the observability capabilities. + description: |- + Capabilities defines the observability capabilities. + Each capability has to be enabled explicitly. properties: opentelemetry: + description: OpenTelemetry defines the OpenTelemetry capabilities. properties: enabled: + default: false + description: |- + Enabled indicates whether the capability is enabled and it operator should deploy an instance. + By default, it is set to false. type: boolean exporter: + description: |- + Exporter defines the OpenTelemetry exporter configuration. + When defined the collector will export telemetry data to the specified endpoint. properties: endpoint: + description: Endpoint is the OTLP endpoint. type: string type: object + olm: + default: false + description: |- + OLM indicates whether the operators used by the capability should be deployed via OLM. + When the capability is enabled, the OLM is set to true, otherwise it is set to false. + type: boolean type: object tracing: + description: Tracing defines the tracing capabilities. properties: enabled: + default: false + description: |- + Enabled indicates whether the capability is enabled and it operator should deploy an instance. + By default, it is set to false. + type: boolean + olm: + default: false + description: |- + OLM indicates whether the operators used by the capability should be deployed via OLM. + When the capability is enabled, the OLM is set to true, otherwise it is set to false. type: boolean type: object type: object storage: + description: Storage defines the storage for the capabilities that + require a storage. properties: secret: + description: SecretSpec defines the secret for the storage. properties: name: + description: Name is the name of the secret for the storage. type: string type: object type: object diff --git a/docs/api.md b/docs/api.md index 158d52e19..3bc6a579c 100644 --- a/docs/api.md +++ b/docs/api.md @@ -4065,14 +4065,15 @@ Spec defines the desired state of the cluster observability. capabilities object - CapabilitiesSpec defines the observability capabilities.
+ Capabilities defines the observability capabilities. +Each capability has to be enabled explicitly.
false storage object -
+ Storage defines the storage for the capabilities that require a storage.
false @@ -4084,7 +4085,8 @@ Spec defines the desired state of the cluster observability. -CapabilitiesSpec defines the observability capabilities. +Capabilities defines the observability capabilities. +Each capability has to be enabled explicitly. @@ -4099,14 +4101,14 @@ CapabilitiesSpec defines the observability capabilities. @@ -4118,7 +4120,7 @@ CapabilitiesSpec defines the observability capabilities. - +OpenTelemetry defines the OpenTelemetry capabilities.
opentelemetry object -
+ OpenTelemetry defines the OpenTelemetry capabilities.
false
tracing object -
+ Tracing defines the tracing capabilities.
false
@@ -4133,14 +4135,28 @@ CapabilitiesSpec defines the observability capabilities. + + + + + @@ -4152,7 +4168,8 @@ CapabilitiesSpec defines the observability capabilities. - +Exporter defines the OpenTelemetry exporter configuration. +When defined the collector will export telemetry data to the specified endpoint.
enabled boolean + Enabled indicates whether the capability is enabled and it operator should deploy an instance. +By default, it is set to false.

+ Default: false
false
exporter object + Exporter defines the OpenTelemetry exporter configuration. +When defined the collector will export telemetry data to the specified endpoint.
+
false
olmboolean + OLM indicates whether the operators used by the capability should be deployed via OLM. +When the capability is enabled, the OLM is set to true, otherwise it is set to false.

+ Default: false
false
@@ -4167,7 +4184,7 @@ CapabilitiesSpec defines the observability capabilities. @@ -4179,7 +4196,7 @@ CapabilitiesSpec defines the observability capabilities. - +Tracing defines the tracing capabilities.
endpoint string -
+ Endpoint is the OTLP endpoint.
false
@@ -4194,7 +4211,20 @@ CapabilitiesSpec defines the observability capabilities. + + + + + @@ -4206,7 +4236,7 @@ CapabilitiesSpec defines the observability capabilities. - +Storage defines the storage for the capabilities that require a storage.
enabled boolean + Enabled indicates whether the capability is enabled and it operator should deploy an instance. +By default, it is set to false.

+ Default: false
+
false
olmboolean + OLM indicates whether the operators used by the capability should be deployed via OLM. +When the capability is enabled, the OLM is set to true, otherwise it is set to false.
+
+ Default: false
false
@@ -4221,7 +4251,7 @@ CapabilitiesSpec defines the observability capabilities. @@ -4233,7 +4263,7 @@ CapabilitiesSpec defines the observability capabilities. - +SecretSpec defines the secret for the storage.
secret object -
+ SecretSpec defines the secret for the storage.
false
@@ -4248,7 +4278,7 @@ CapabilitiesSpec defines the observability capabilities. diff --git a/docs/clusterobservability.md b/docs/clusterobservability.md index 104a4138b..ab1852bd3 100644 --- a/docs/clusterobservability.md +++ b/docs/clusterobservability.md @@ -16,9 +16,9 @@ spec: type: s3 capabilities: logging: - enabled: true + deploy: true tracing: - enabled: true + deploy: true ``` Notes: @@ -59,3 +59,48 @@ Notes: * deploys `OpenTelemetryCollector` in the `openshift-opentelemetry` * configures OTLP exporter on the collector to send traces to Dynatrace * configures collector to export trace data to Tempo deployed by the `ClusterObservability` CR + +### Install only operators for a given capability + +```yaml +apiVersion: observability.openshift.io/v1alpha1 +kind: ClusterObservability +metadata: + name: logging-tracing +spec: + storage: + secret: + name: minio + type: s3 + capabilities: + tracing: + enabled: false + olm: true +``` + +Notes: +* The tracing instance is not deployed, but the operators are installed + +### Deploy capability but don't deploy the operators. + +```yaml +apiVersion: observability.openshift.io/v1alpha1 +kind: ClusterObservability +metadata: + name: logging-tracing +spec: + storage: + secret: + name: minio + type: s3 + capabilities: + tracing: + enabled: true + olm: false +``` + +Notes: +* The tracing instance is deployed, but the operators are not installed via COO. +* In this case, the user is responsible for installing the operators + +In this case the COO cannot guarantee that installed operator versions are compatible therefore we could forbit this configuration or show a warning/unmanaged state. diff --git a/pkg/apis/observability/v1alpha1/opentelemetry.go b/pkg/apis/observability/v1alpha1/opentelemetry.go index cd4e7d9d4..9d795e7c8 100644 --- a/pkg/apis/observability/v1alpha1/opentelemetry.go +++ b/pkg/apis/observability/v1alpha1/opentelemetry.go @@ -1,11 +1,16 @@ package v1alpha1 +// OpenTelemetrySpec defines the desired state of OpenTelemetry capability. type OpenTelemetrySpec struct { - Enabled bool `json:"enabled,omitempty"` + CommonCapabilitiesSpec CommonCapabilitiesSpec `json:",inline"` - Exporter OTLPExporter `json:"exporter,omitempty"` + // Exporter defines the OpenTelemetry exporter configuration. + // When defined the collector will export telemetry data to the specified endpoint. + Exporter *OTLPExporter `json:"exporter,omitempty"` } +// OTLPExporter defines the OpenTelemetry Protocol (OTLP) exporter configuration. type OTLPExporter struct { + // Endpoint is the OTLP endpoint. Endpoint string `json:"endpoint,omitempty"` } diff --git a/pkg/apis/observability/v1alpha1/tracing.go b/pkg/apis/observability/v1alpha1/tracing.go index 03cccffa4..57fe54729 100644 --- a/pkg/apis/observability/v1alpha1/tracing.go +++ b/pkg/apis/observability/v1alpha1/tracing.go @@ -1,5 +1,6 @@ package v1alpha1 +// TracingSpec defines the desired state of the tracing capability. type TracingSpec struct { - Enabled bool `json:"enabled,omitempty"` + CommonCapabilitiesSpec CommonCapabilitiesSpec `json:",inline"` } diff --git a/pkg/apis/observability/v1alpha1/types.go b/pkg/apis/observability/v1alpha1/types.go index 82234e73a..0ca0c8d35 100644 --- a/pkg/apis/observability/v1alpha1/types.go +++ b/pkg/apis/observability/v1alpha1/types.go @@ -37,30 +37,54 @@ type ClusterObservabilityList struct { } type ClusterObservabilitySpec struct { + // Storage defines the storage for the capabilities that require a storage. Storage StorageSpec `json:"storage,omitempty"` + // Capabilities defines the observability capabilities. + // Each capability has to be enabled explicitly. Capabilities *CapabilitiesSpec `json:"capabilities,omitempty"` } // ClusterObservabilityStatus defines the observed state of ClusterObservability. type ClusterObservabilityStatus struct{} +// StorageSpec defines the storage. type StorageSpec struct { Secret SecretSpec `json:"secret,omitempty"` } +// SecretSpec defines the secret for the storage. type SecretSpec struct { + // Name is the name of the secret for the storage. Name string `json:"name,omitempty"` } // CapabilitiesSpec defines the observability capabilities. type CapabilitiesSpec struct { + // Tracing defines the tracing capabilities. // +optional // +kubebuilder:validation:Optional Tracing TracingSpec `json:"tracing,omitempty"` + // OpenTelemetry defines the OpenTelemetry capabilities. // +optional // +kubebuilder:validation:Optional OpenTelemetry OpenTelemetrySpec `json:"opentelemetry,omitempty"` } + +// CommonCapabilitiesSpec defines the common capabilities. +type CommonCapabilitiesSpec struct { + // Enabled indicates whether the capability is enabled and it operator should deploy an instance. + // By default, it is set to false. + // +optional + // +kubebuilder:validation:Optional + // +kubebuilder:default=false + Enabled bool `json:"enabled,omitempty"` + // OLM indicates whether the operators used by the capability should be deployed via OLM. + // When the capability is enabled, the OLM is set to true, otherwise it is set to false. + // +optional + // +kubebuilder:validation:Optional + // +kubebuilder:default=false + OLM bool `json:"olm,omitempty"` +} diff --git a/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go index 3f3c412d7..bf5239eed 100644 --- a/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go @@ -28,7 +28,7 @@ import ( func (in *CapabilitiesSpec) DeepCopyInto(out *CapabilitiesSpec) { *out = *in out.Tracing = in.Tracing - out.OpenTelemetry = in.OpenTelemetry + in.OpenTelemetry.DeepCopyInto(&out.OpenTelemetry) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CapabilitiesSpec. @@ -107,7 +107,7 @@ func (in *ClusterObservabilitySpec) DeepCopyInto(out *ClusterObservabilitySpec) if in.Capabilities != nil { in, out := &in.Capabilities, &out.Capabilities *out = new(CapabilitiesSpec) - **out = **in + (*in).DeepCopyInto(*out) } } @@ -136,6 +136,21 @@ func (in *ClusterObservabilityStatus) DeepCopy() *ClusterObservabilityStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonCapabilitiesSpec) DeepCopyInto(out *CommonCapabilitiesSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonCapabilitiesSpec. +func (in *CommonCapabilitiesSpec) DeepCopy() *CommonCapabilitiesSpec { + if in == nil { + return nil + } + out := new(CommonCapabilitiesSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OTLPExporter) DeepCopyInto(out *OTLPExporter) { *out = *in @@ -154,7 +169,12 @@ func (in *OTLPExporter) DeepCopy() *OTLPExporter { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OpenTelemetrySpec) DeepCopyInto(out *OpenTelemetrySpec) { *out = *in - out.Exporter = in.Exporter + out.CommonCapabilitiesSpec = in.CommonCapabilitiesSpec + if in.Exporter != nil { + in, out := &in.Exporter, &out.Exporter + *out = new(OTLPExporter) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenTelemetrySpec. @@ -201,6 +221,7 @@ func (in *StorageSpec) DeepCopy() *StorageSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TracingSpec) DeepCopyInto(out *TracingSpec) { *out = *in + out.CommonCapabilitiesSpec = in.CommonCapabilitiesSpec } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TracingSpec. From e82783f60f786f52e2e0abb07e6481f0843bf9aa Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Wed, 28 May 2025 14:46:10 +0200 Subject: [PATCH 4/5] feat: add clusterobservability spec for tracing and opentelemetry Signed-off-by: Pavol Loffay --- docs/clusterobservability.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/clusterobservability.md b/docs/clusterobservability.md index ab1852bd3..6cbde0f6d 100644 --- a/docs/clusterobservability.md +++ b/docs/clusterobservability.md @@ -16,9 +16,9 @@ spec: type: s3 capabilities: logging: - deploy: true + enabled: true tracing: - deploy: true + enabled: true ``` Notes: From 163047a6087cd83338734dcc0192de91809d1aa8 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Thu, 29 May 2025 13:17:01 +0200 Subject: [PATCH 5/5] feat: add clusterobservability spec for tracing and opentelemetry Signed-off-by: Pavol Loffay --- ...y.openshift.io_clusterobservabilities.yaml | 32 +++++---- docs/api.md | 72 ++++++++++++++++--- docs/clusterobservability.md | 10 ++- pkg/apis/observability/v1alpha1/types.go | 16 +++-- .../v1alpha1/zz_generated.deepcopy.go | 16 +++++ 5 files changed, 117 insertions(+), 29 deletions(-) diff --git a/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml b/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml index 7f74f9a3b..a36c246a5 100644 --- a/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml +++ b/deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml @@ -63,12 +63,16 @@ spec: description: Endpoint is the OTLP endpoint. type: string type: object - olm: - default: false - description: |- - OLM indicates whether the operators used by the capability should be deployed via OLM. - When the capability is enabled, the OLM is set to true, otherwise it is set to false. - type: boolean + operators: + description: Operators defines the operators installation + for the capability. + properties: + install: + description: |- + Install indicates whether the operator(s) used by the capability should be installed via OLM. + When the capability is enabled, the install is set to true, otherwise it is set to false. + type: boolean + type: object type: object tracing: description: Tracing defines the tracing capabilities. @@ -79,12 +83,16 @@ spec: Enabled indicates whether the capability is enabled and it operator should deploy an instance. By default, it is set to false. type: boolean - olm: - default: false - description: |- - OLM indicates whether the operators used by the capability should be deployed via OLM. - When the capability is enabled, the OLM is set to true, otherwise it is set to false. - type: boolean + operators: + description: Operators defines the operators installation + for the capability. + properties: + install: + description: |- + Install indicates whether the operator(s) used by the capability should be installed via OLM. + When the capability is enabled, the install is set to true, otherwise it is set to false. + type: boolean + type: object type: object type: object storage: diff --git a/docs/api.md b/docs/api.md index 3bc6a579c..c3f30e018 100644 --- a/docs/api.md +++ b/docs/api.md @@ -4150,13 +4150,10 @@ When defined the collector will export telemetry data to the specified endpoint. - - + + @@ -4191,6 +4188,34 @@ When defined the collector will export telemetry data to the specified endpoint.
name string -
+ Name is the name of the secret for the storage.
false
false
olmbooleanoperatorsobject - OLM indicates whether the operators used by the capability should be deployed via OLM. -When the capability is enabled, the OLM is set to true, otherwise it is set to false.
-
- Default: false
+ Operators defines the operators installation for the capability.
false
+### ClusterObservability.spec.capabilities.opentelemetry.operators +[↩ Parent](#clusterobservabilityspeccapabilitiesopentelemetry) + + + +Operators defines the operators installation for the capability. + + + + + + + + + + + + + + + + +
NameTypeDescriptionRequired
installboolean + Install indicates whether the operator(s) used by the capability should be installed via OLM. +When the capability is enabled, the install is set to true, otherwise it is set to false.
+
false
+ + ### ClusterObservability.spec.capabilities.tracing [↩ Parent](#clusterobservabilityspeccapabilities) @@ -4218,13 +4243,38 @@ By default, it is set to false.
false - olm + operators + object + + Operators defines the operators installation for the capability.
+ + false + + + + +### ClusterObservability.spec.capabilities.tracing.operators +[↩ Parent](#clusterobservabilityspeccapabilitiestracing) + + + +Operators defines the operators installation for the capability. + + + + + + + + + + + + diff --git a/docs/clusterobservability.md b/docs/clusterobservability.md index 6cbde0f6d..e18f43120 100644 --- a/docs/clusterobservability.md +++ b/docs/clusterobservability.md @@ -1,5 +1,9 @@ # ClusterObservability CRD +This document describes the `ClusterObservability` Custom Resource Definition (CRD). +The goal of this CRD is to provide end-to-end observability capabilities with minimal configuration. +Power users should be able to customize the underlying components via server-side apply. + ## Examples ### Logging and tracing @@ -75,7 +79,8 @@ spec: capabilities: tracing: enabled: false - olm: true + operators: + install: true ``` Notes: @@ -96,7 +101,8 @@ spec: capabilities: tracing: enabled: true - olm: false + operators: + install: false ``` Notes: diff --git a/pkg/apis/observability/v1alpha1/types.go b/pkg/apis/observability/v1alpha1/types.go index 0ca0c8d35..e7a7ab7b6 100644 --- a/pkg/apis/observability/v1alpha1/types.go +++ b/pkg/apis/observability/v1alpha1/types.go @@ -81,10 +81,18 @@ type CommonCapabilitiesSpec struct { // +kubebuilder:validation:Optional // +kubebuilder:default=false Enabled bool `json:"enabled,omitempty"` - // OLM indicates whether the operators used by the capability should be deployed via OLM. - // When the capability is enabled, the OLM is set to true, otherwise it is set to false. + + // Operators defines the operators installation for the capability. // +optional // +kubebuilder:validation:Optional - // +kubebuilder:default=false - OLM bool `json:"olm,omitempty"` + Operators OperatorsSpec `json:"operators,omitempty"` +} + +// OperatorsSpec defines the operators installation. +type OperatorsSpec struct { + // Install indicates whether the operator(s) used by the capability should be installed via OLM. + // When the capability is enabled, the install is set to true, otherwise it is set to false. + // +optional + // +kubebuilder:validation:Optional + Install bool `json:"install,omitempty"` } diff --git a/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go index bf5239eed..b0f233950 100644 --- a/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/observability/v1alpha1/zz_generated.deepcopy.go @@ -139,6 +139,7 @@ func (in *ClusterObservabilityStatus) DeepCopy() *ClusterObservabilityStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CommonCapabilitiesSpec) DeepCopyInto(out *CommonCapabilitiesSpec) { *out = *in + out.Operators = in.Operators } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonCapabilitiesSpec. @@ -187,6 +188,21 @@ func (in *OpenTelemetrySpec) DeepCopy() *OpenTelemetrySpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorsSpec) DeepCopyInto(out *OperatorsSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorsSpec. +func (in *OperatorsSpec) DeepCopy() *OperatorsSpec { + if in == nil { + return nil + } + out := new(OperatorsSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SecretSpec) DeepCopyInto(out *SecretSpec) { *out = *in
NameTypeDescriptionRequired
install boolean - OLM indicates whether the operators used by the capability should be deployed via OLM. -When the capability is enabled, the OLM is set to true, otherwise it is set to false.
-
- Default: false
+ Install indicates whether the operator(s) used by the capability should be installed via OLM. +When the capability is enabled, the install is set to true, otherwise it is set to false.
false