Skip to content

Commit e1177ba

Browse files
committed
feat: add controller for clusterobservability
Signed-off-by: Pavol Loffay <[email protected]>
1 parent 84abac4 commit e1177ba

22 files changed

+1419
-139
lines changed

bundle/manifests/observability-operator.clusterserviceversion.yaml

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ metadata:
4242
categories: Monitoring
4343
certified: "false"
4444
containerImage: observability-operator:1.2.0
45-
createdAt: "2025-05-26T07:04:40Z"
45+
createdAt: "2025-06-20T11:57:18Z"
4646
description: A Go based Kubernetes operator to setup and manage highly available
4747
Monitoring Stack using Prometheus, Alertmanager and Thanos Querier.
4848
operatorframework.io/cluster-monitoring: "true"
@@ -293,6 +293,7 @@ spec:
293293
- ""
294294
resources:
295295
- configmaps
296+
- namespaces
296297
- secrets
297298
- serviceaccounts
298299
- services
@@ -309,7 +310,6 @@ spec:
309310
resources:
310311
- endpoints
311312
- events
312-
- namespaces
313313
- nodes
314314
- persistentvolumeclaims
315315
- persistentvolumes
@@ -511,25 +511,38 @@ spec:
511511
- apiGroups:
512512
- observability.openshift.io
513513
resources:
514-
- clusterobservability
514+
- clusterobservabilities
515+
- uiplugins
515516
verbs:
517+
- create
518+
- delete
516519
- get
517520
- list
521+
- patch
522+
- update
518523
- watch
519524
- apiGroups:
520525
- observability.openshift.io
521526
resources:
522-
- clusterobservability/finalizers
523-
- clusterobservability/status
527+
- clusterobservabilities/finalizers
528+
- clusterobservabilities/status
529+
verbs:
530+
- delete
531+
- get
532+
- patch
533+
- update
534+
- apiGroups:
535+
- observability.openshift.io
536+
resources:
524537
- uiplugins/finalizers
525538
- uiplugins/status
526539
verbs:
527540
- get
528541
- update
529542
- apiGroups:
530-
- observability.openshift.io
543+
- opentelemetry.io
531544
resources:
532-
- uiplugins
545+
- opentelemetrycollectors
533546
verbs:
534547
- create
535548
- delete
@@ -538,6 +551,14 @@ spec:
538551
- patch
539552
- update
540553
- watch
554+
- apiGroups:
555+
- opentelemetry.io
556+
resources:
557+
- opentelemetrycollectors/status
558+
verbs:
559+
- get
560+
- list
561+
- watch
541562
- apiGroups:
542563
- operator.openshift.io
543564
resources:
@@ -547,6 +568,19 @@ spec:
547568
- list
548569
- patch
549570
- watch
571+
- apiGroups:
572+
- operators.coreos.com
573+
resources:
574+
- clusterserviceversions
575+
- subscriptions
576+
verbs:
577+
- create
578+
- delete
579+
- get
580+
- list
581+
- patch
582+
- update
583+
- watch
550584
- apiGroups:
551585
- perses.dev
552586
resources:
@@ -624,13 +658,40 @@ spec:
624658
- get
625659
- list
626660
- watch
661+
- apiGroups:
662+
- tempo.grafana.com
663+
resourceNames:
664+
- traces
665+
resources:
666+
- prod
667+
verbs:
668+
- create
627669
- apiGroups:
628670
- tempo.grafana.com
629671
resources:
630672
- tempomonolithics
673+
verbs:
674+
- list
675+
- apiGroups:
676+
- tempo.grafana.com
677+
resources:
631678
- tempostacks
632679
verbs:
680+
- create
681+
- delete
682+
- get
683+
- list
684+
- patch
685+
- update
686+
- watch
687+
- apiGroups:
688+
- tempo.grafana.com
689+
resources:
690+
- tempostacks/status
691+
verbs:
692+
- get
633693
- list
694+
- watch
634695
serviceAccountName: observability-operator-sa
635696
- rules:
636697
- apiGroups:

cmd/operator/main.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ import (
3232
"github.com/rhobs/observability-operator/pkg/operator"
3333
)
3434

35+
const (
36+
opentelemetryCSV = "opentelemetry-operator.v0.127.0-1"
37+
tempoCSV = "tempo-operator.v0.16.0-1"
38+
)
39+
3540
// The default values we use. Prometheus and Alertmanager are handled by
3641
// prometheus-operator. For thanos we use the default version from
3742
// prometheus-operator.
@@ -88,6 +93,8 @@ func main() {
8893
metricsAddr string
8994
healthProbeAddr string
9095
openShiftEnabled bool
96+
otelCSVName string
97+
tempoCSVName string
9198

9299
setupLog = ctrl.Log.WithName("setup")
93100
)
@@ -98,6 +105,8 @@ func main() {
98105
flag.StringVar(&healthProbeAddr, "health-probe-bind-address", ":8081", "The address the health probe endpoint binds to.")
99106
flag.Var(images, "images", fmt.Sprintf("Full images refs to use for containers managed by the operator. E.g thanos=quay.io/thanos/thanos:v0.33.0. Images used are %v", imagesUsed()))
100107
flag.BoolVar(&openShiftEnabled, "openshift.enabled", false, "Enable OpenShift specific features such as Console Plugins.")
108+
flag.StringVar(&otelCSVName, "opentelemetry-csv", opentelemetryCSV, "OpenTelemetry Operator starting CSV name. This is used to install the OpenTelemetry Operator in the cluster.")
109+
flag.StringVar(&tempoCSVName, "tempo-csv", tempoCSV, "Tempo Operator starting CSV name. This is used to install the Tempo Operator in the cluster.")
101110

102111
opts := zap.Options{
103112
Development: true,
@@ -134,6 +143,11 @@ func main() {
134143
operator.WithThanosSidecarImage(imgMap["thanos"]),
135144
operator.WithThanosQuerierImage(imgMap["thanos"]),
136145
operator.WithUIPluginImages(imgMap),
146+
operator.WithClusterObservability(operator.ClusterObservabilityConfiguration{
147+
COONamespace: os.Getenv("NAMESPACE"),
148+
OpenTelemetryCSV: otelCSVName,
149+
TempoCSV: tempoCSVName,
150+
}),
137151
operator.WithFeatureGates(operator.FeatureGates{
138152
OpenShift: operator.OpenShiftFeatureGates{
139153
Enabled: openShiftEnabled,

deploy/crds/common/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ resources:
55
- monitoring.rhobs_monitoringstacks.yaml
66
- monitoring.rhobs_thanosqueriers.yaml
77
- observability.openshift.io_uiplugins.yaml
8+
# - observability.openshift.io_clusterobservabilities.yaml

deploy/crds/common/observability.openshift.io_clusterobservabilities.yaml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ spec:
1414
singular: clusterobservability
1515
scope: Cluster
1616
versions:
17-
- name: v1alpha1
17+
- additionalPrinterColumns:
18+
- jsonPath: .status.opentelemetry
19+
name: OpenTelemetry
20+
type: string
21+
- jsonPath: .status.tempo
22+
name: Tempo
23+
type: string
24+
name: v1alpha1
1825
schema:
1926
openAPIV3Schema:
2027
description: ClusterObservability defines the desired state of the observability
@@ -49,9 +56,8 @@ spec:
4956
description: OpenTelemetry defines the OpenTelemetry capabilities.
5057
properties:
5158
enabled:
52-
default: false
5359
description: |-
54-
Enabled indicates whether the capability is enabled and it operator should deploy an instance.
60+
Enabled indicates whether the capability is enabled and whether the operator should deploy an instance.
5561
By default, it is set to false.
5662
type: boolean
5763
exporter:
@@ -78,9 +84,8 @@ spec:
7884
description: Tracing defines the tracing capabilities.
7985
properties:
8086
enabled:
81-
default: false
8287
description: |-
83-
Enabled indicates whether the capability is enabled and it operator should deploy an instance.
88+
Enabled indicates whether the capability is enabled and whether the operator should deploy an instance.
8489
By default, it is set to false.
8590
type: boolean
8691
operators:
@@ -105,11 +110,31 @@ spec:
105110
name:
106111
description: Name is the name of the secret for the storage.
107112
type: string
113+
type:
114+
description: Type is the type of the secret for the storage.
115+
type: string
108116
type: object
109117
type: object
110118
type: object
111119
status:
112120
description: Status of the signal manager.
121+
properties:
122+
conditions:
123+
description: Conditions provide status information about the instance.
124+
items:
125+
properties:
126+
message:
127+
type: string
128+
type: object
129+
type: array
130+
x-kubernetes-list-type: atomic
131+
opentelemetry:
132+
description: OpenTelemetry defines the status of the OpenTelemetry
133+
capability.
134+
type: string
135+
tempo:
136+
description: Tempo defines the status of the Tempo capability.
137+
type: string
113138
type: object
114139
type: object
115140
served: true

deploy/operator/observability-operator-cluster-role.yaml

Lines changed: 67 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ rules:
88
- ""
99
resources:
1010
- configmaps
11+
- namespaces
1112
- secrets
1213
- serviceaccounts
1314
- services
@@ -24,7 +25,6 @@ rules:
2425
resources:
2526
- endpoints
2627
- events
27-
- namespaces
2828
- nodes
2929
- persistentvolumeclaims
3030
- persistentvolumes
@@ -226,25 +226,38 @@ rules:
226226
- apiGroups:
227227
- observability.openshift.io
228228
resources:
229-
- clusterobservability
229+
- clusterobservabilities
230+
- uiplugins
230231
verbs:
232+
- create
233+
- delete
231234
- get
232235
- list
236+
- patch
237+
- update
233238
- watch
234239
- apiGroups:
235240
- observability.openshift.io
236241
resources:
237-
- clusterobservability/finalizers
238-
- clusterobservability/status
242+
- clusterobservabilities/finalizers
243+
- clusterobservabilities/status
244+
verbs:
245+
- delete
246+
- get
247+
- patch
248+
- update
249+
- apiGroups:
250+
- observability.openshift.io
251+
resources:
239252
- uiplugins/finalizers
240253
- uiplugins/status
241254
verbs:
242255
- get
243256
- update
244257
- apiGroups:
245-
- observability.openshift.io
258+
- opentelemetry.io
246259
resources:
247-
- uiplugins
260+
- opentelemetrycollectors
248261
verbs:
249262
- create
250263
- delete
@@ -253,6 +266,14 @@ rules:
253266
- patch
254267
- update
255268
- watch
269+
- apiGroups:
270+
- opentelemetry.io
271+
resources:
272+
- opentelemetrycollectors/status
273+
verbs:
274+
- get
275+
- list
276+
- watch
256277
- apiGroups:
257278
- operator.openshift.io
258279
resources:
@@ -262,6 +283,19 @@ rules:
262283
- list
263284
- patch
264285
- watch
286+
- apiGroups:
287+
- operators.coreos.com
288+
resources:
289+
- clusterserviceversions
290+
- subscriptions
291+
verbs:
292+
- create
293+
- delete
294+
- get
295+
- list
296+
- patch
297+
- update
298+
- watch
265299
- apiGroups:
266300
- perses.dev
267301
resources:
@@ -339,10 +373,37 @@ rules:
339373
- get
340374
- list
341375
- watch
376+
- apiGroups:
377+
- tempo.grafana.com
378+
resourceNames:
379+
- traces
380+
resources:
381+
- prod
382+
verbs:
383+
- create
342384
- apiGroups:
343385
- tempo.grafana.com
344386
resources:
345387
- tempomonolithics
388+
verbs:
389+
- list
390+
- apiGroups:
391+
- tempo.grafana.com
392+
resources:
346393
- tempostacks
347394
verbs:
395+
- create
396+
- delete
397+
- get
398+
- list
399+
- patch
400+
- update
401+
- watch
402+
- apiGroups:
403+
- tempo.grafana.com
404+
resources:
405+
- tempostacks/status
406+
verbs:
407+
- get
348408
- list
409+
- watch

0 commit comments

Comments
 (0)