@@ -21,8 +21,6 @@ import (
21
21
v1 "k8s.io/api/core/v1"
22
22
networkingv1 "k8s.io/api/networking/v1"
23
23
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24
-
25
- "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
26
24
)
27
25
28
26
// Probe defines the OpenTelemetry's pod probe config. Only Liveness probe is supported currently.
@@ -148,12 +146,12 @@ type OpenTelemetryCollectorSpec struct {
148
146
// +optional
149
147
// +kubebuilder:validation:Optional
150
148
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Observability"
151
- Observability v1alpha1. ObservabilitySpec `json:"observability,omitempty"`
149
+ Observability ObservabilitySpec `json:"observability,omitempty"`
152
150
153
151
// ConfigMaps is a list of ConfigMaps in the same namespace as the OpenTelemetryCollector
154
152
// object, which shall be mounted into the Collector Pods.
155
153
// Each ConfigMap will be added to the Collector's Deployments as a volume named `configmap-<configmap-name>`.
156
- ConfigMaps []v1alpha1. ConfigMapsSpec `json:"configmaps,omitempty"`
154
+ ConfigMaps []ConfigMapsSpec `json:"configmaps,omitempty"`
157
155
// UpdateStrategy represents the strategy the operator will take replacing existing DaemonSet pods with new pods
158
156
// https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec
159
157
// This is only applicable to Daemonset mode.
@@ -236,7 +234,7 @@ type TargetAllocatorEmbedded struct {
236
234
// +optional
237
235
// +kubebuilder:validation:Optional
238
236
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Observability"
239
- Observability v1alpha1. ObservabilitySpec `json:"observability,omitempty"`
237
+ Observability ObservabilitySpec `json:"observability,omitempty"`
240
238
// PodDisruptionBudget specifies the pod disruption budget configuration to use
241
239
// for the target allocator workload.
242
240
//
@@ -248,7 +246,7 @@ type TargetAllocatorEmbedded struct {
248
246
type OpenTelemetryCollectorStatus struct {
249
247
// Scale is the OpenTelemetryCollector's scale subresource status.
250
248
// +optional
251
- Scale v1alpha1. ScaleSubresourceStatus `json:"scale,omitempty"`
249
+ Scale ScaleSubresourceStatus `json:"scale,omitempty"`
252
250
253
251
// Version of the managed OpenTelemetry Collector (operand)
254
252
// +optional
@@ -270,6 +268,59 @@ type OpenTelemetryCollectorStatus struct {
270
268
Replicas int32 `json:"replicas,omitempty"`
271
269
}
272
270
271
+ // ObservabilitySpec defines how telemetry data gets handled.
272
+ type ObservabilitySpec struct {
273
+ // Metrics defines the metrics configuration for operands.
274
+ //
275
+ // +optional
276
+ // +kubebuilder:validation:Optional
277
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Metrics Config"
278
+ Metrics MetricsConfigSpec `json:"metrics,omitempty"`
279
+ }
280
+
281
+ // MetricsConfigSpec defines a metrics config.
282
+ type MetricsConfigSpec struct {
283
+ // EnableMetrics specifies if ServiceMonitor or PodMonitor(for sidecar mode) should be created for the service managed by the OpenTelemetry Operator.
284
+ // The operator.observability.prometheus feature gate must be enabled to use this feature.
285
+ //
286
+ // +optional
287
+ // +kubebuilder:validation:Optional
288
+ // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Create ServiceMonitors for OpenTelemetry Collector"
289
+ EnableMetrics bool `json:"enableMetrics,omitempty"`
290
+ // DisablePrometheusAnnotations controls the automatic addition of default Prometheus annotations
291
+ // ('prometheus.io/scrape', 'prometheus.io/port', and 'prometheus.io/path')
292
+ //
293
+ // +optional
294
+ // +kubebuilder:validation:Optional
295
+ DisablePrometheusAnnotations bool `json:"disablePrometheusAnnotations,omitempty"`
296
+ }
297
+
298
+ // ScaleSubresourceStatus defines the observed state of the OpenTelemetryCollector's
299
+ // scale subresource.
300
+ type ScaleSubresourceStatus struct {
301
+ // The selector used to match the OpenTelemetryCollector's
302
+ // deployment or statefulSet pods.
303
+ // +optional
304
+ Selector string `json:"selector,omitempty"`
305
+
306
+ // The total number non-terminated pods targeted by this
307
+ // OpenTelemetryCollector's deployment or statefulSet.
308
+ // +optional
309
+ Replicas int32 `json:"replicas,omitempty"`
310
+
311
+ // StatusReplicas is the number of pods targeted by this OpenTelemetryCollector's with a Ready Condition /
312
+ // Total number of non-terminated pods targeted by this OpenTelemetryCollector's (their labels match the selector).
313
+ // Deployment, Daemonset, StatefulSet.
314
+ // +optional
315
+ StatusReplicas string `json:"statusReplicas,omitempty"`
316
+ }
317
+
318
+ type ConfigMapsSpec struct {
319
+ // Configmap defines name and path where the configMaps should be mounted.
320
+ Name string `json:"name"`
321
+ MountPath string `json:"mountpath"`
322
+ }
323
+
273
324
//+kubebuilder:object:root=true
274
325
//+kubebuilder:subresource:status
275
326
0 commit comments