/
tempomonolithic_types.go
434 lines (374 loc) · 18.7 KB
/
tempomonolithic_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// TempoMonolithicSpec defines the desired state of TempoMonolithic.
type TempoMonolithicSpec struct {
// Storage defines the storage configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Storage",order=1
Storage *MonolithicStorageSpec `json:"storage,omitempty"`
// Ingestion defines the trace ingestion configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Ingestion",order=2
Ingestion *MonolithicIngestionSpec `json:"ingestion,omitempty"`
// JaegerUI defines the Jaeger UI configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Jaeger UI",order=3
JaegerUI *MonolithicJaegerUISpec `json:"jaegerui,omitempty"`
// Observability defines the observability configuration of the Tempo deployment.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Observability",order=4
Observability *MonolithicObservabilitySpec `json:"observability,omitempty"`
// Resources defines the compute resource requirements of the Tempo container.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resources",order=5,xDescriptors="urn:alm:descriptor:com.tectonic.ui:resourceRequirements"
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// ManagementState defines whether this instance is managed by the operator or self-managed.
// Default: Managed.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Management State",xDescriptors="urn:alm:descriptor:com.tectonic.ui:advanced"
Management ManagementStateType `json:"management,omitempty"`
// ExtraConfig defines any extra (overlay) configuration of components.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Extra Configuration",xDescriptors="urn:alm:descriptor:com.tectonic.ui:advanced"
ExtraConfig *ExtraConfigSpec `json:"extraConfig,omitempty"`
Scheduler *MonolithicSchedulerSpec `json:",inline"`
}
// MonolithicStorageSpec defines the storage for the Tempo deployment.
type MonolithicStorageSpec struct {
// Traces defines the storage configuration for traces.
//
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Traces"
Traces MonolithicTracesStorageSpec `json:"traces"`
}
// MonolithicTracesStorageSpec defines the traces storage for the Tempo deployment.
type MonolithicTracesStorageSpec struct {
// Backend defines the backend for storing traces.
// Default: memory.
//
// +kubebuilder:validation:Required
// +kubebuilder:default=memory
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Storage Backend",order=1
Backend MonolithicTracesStorageBackend `json:"backend"`
// Size defines the size of the volume where traces are stored.
// For in-memory storage, this defines the size of the tmpfs volume.
// For persistent volume storage, this defines the size of the persistent volume.
// For object storage, this defines the size of the persistent volume containing the Write-Ahead Log (WAL) of Tempo.
// Default: 10Gi.
//
// +kubebuilder:validation:Optional
// +kubebuilder:default="10Gi"
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Size",order=2,xDescriptors="urn:alm:descriptor:com.tectonic.ui:text"
Size *resource.Quantity `json:"size,omitempty"`
// S3 defines the configuration for Amazon S3.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Amazon S3"
S3 *MonolithicTracesStorageS3Spec `json:"s3,omitempty"`
// Azure defines the configuration for Azure Storage.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Azure Storage"
Azure *MonolithicTracesObjectStorageSpec `json:"azure,omitempty"`
// GCP defines the configuration for Google Cloud Storage.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Google Cloud Storage"
GCS *MonolithicTracesObjectStorageSpec `json:"gcs,omitempty"`
}
// MonolithicTracesStorageBackend defines the backend storage for traces.
//
// +kubebuilder:validation:Enum=memory;pv;azure;gcs;s3
type MonolithicTracesStorageBackend string
const (
// MonolithicTracesStorageBackendMemory defines storing traces in a tmpfs (in-memory filesystem).
MonolithicTracesStorageBackendMemory MonolithicTracesStorageBackend = "memory"
// MonolithicTracesStorageBackendPV defines storing traces in a Persistent Volume.
MonolithicTracesStorageBackendPV MonolithicTracesStorageBackend = "pv"
// MonolithicTracesStorageBackendAzure defines storing traces in Azure Storage.
MonolithicTracesStorageBackendAzure MonolithicTracesStorageBackend = "azure"
// MonolithicTracesStorageBackendGCS defines storing traces in Google Cloud Storage.
MonolithicTracesStorageBackendGCS MonolithicTracesStorageBackend = "gcs"
// MonolithicTracesStorageBackendS3 defines storing traces in Amazon S3.
MonolithicTracesStorageBackendS3 MonolithicTracesStorageBackend = "s3"
)
// MonolithicTracesObjectStorageSpec defines object storage configuration.
type MonolithicTracesObjectStorageSpec struct {
// Secret is the name of a Secret containing credentials for accessing object storage.
// It needs to be in the same namespace as the TempoMonolithic custom resource.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Storage Secret",xDescriptors="urn:alm:descriptor:io.kubernetes:Secret"
Secret string `json:"secret"`
}
// MonolithicTracesStorageS3Spec defines the Amazon S3 configuration.
type MonolithicTracesStorageS3Spec struct {
MonolithicTracesObjectStorageSpec `json:",inline"`
// TLS defines the TLS configuration for Amazon S3.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="TLS"
TLS *TLSSpec `json:"tls,omitempty"`
}
// MonolithicIngestionSpec defines the ingestion settings.
type MonolithicIngestionSpec struct {
// OTLP defines the ingestion configuration for the OTLP protocol.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="OTLP"
OTLP *MonolithicIngestionOTLPSpec `json:"otlp,omitempty"`
}
// MonolithicIngestionOTLPSpec defines the settings for OTLP ingestion.
type MonolithicIngestionOTLPSpec struct {
// GRPC defines the OTLP over gRPC configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="gRPC"
GRPC *MonolithicIngestionOTLPProtocolsGRPCSpec `json:"grpc,omitempty"`
// HTTP defines the OTLP over HTTP configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="HTTP"
HTTP *MonolithicIngestionOTLPProtocolsHTTPSpec `json:"http,omitempty"`
}
// MonolithicIngestionOTLPProtocolsGRPCSpec defines the settings for OTLP ingestion over GRPC.
type MonolithicIngestionOTLPProtocolsGRPCSpec struct {
// Enabled defines if OTLP over gRPC is enabled.
// Default: enabled.
//
// +kubebuilder:validation:Required
// +kubebuilder:default=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",order=1,xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enabled bool `json:"enabled"`
// TLS defines the TLS configuration for OTLP/gRPC ingestion.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="TLS"
TLS *TLSSpec `json:"tls,omitempty"`
}
// MonolithicIngestionOTLPProtocolsHTTPSpec defines the settings for OTLP ingestion over HTTP.
type MonolithicIngestionOTLPProtocolsHTTPSpec struct {
// Enabled defines if OTLP over HTTP is enabled.
// Default: enabled.
//
// +kubebuilder:validation:Required
// +kubebuilder:default=true
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",order=1,xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enabled bool `json:"enabled"`
// TLS defines the TLS configuration for OTLP/HTTP ingestion.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="TLS"
TLS *TLSSpec `json:"tls,omitempty"`
}
// MonolithicJaegerUISpec defines the settings for the Jaeger UI.
type MonolithicJaegerUISpec struct {
// Enabled defines if the Jaeger UI component should be created.
//
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",order=1,xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enabled bool `json:"enabled"`
// Resources defines the compute resource requirements of the Jaeger UI container.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resources",order=2,xDescriptors="urn:alm:descriptor:com.tectonic.ui:resourceRequirements"
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// Ingress defines the Ingress configuration for the Jaeger UI.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Ingress",order=3
Ingress *MonolithicJaegerUIIngressSpec `json:"ingress,omitempty"`
// Route defines the OpenShift route configuration for the Jaeger UI.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Route",order=4
Route *MonolithicJaegerUIRouteSpec `json:"route,omitempty"`
}
// MonolithicJaegerUIIngressSpec defines the settings for the Jaeger UI ingress.
type MonolithicJaegerUIIngressSpec struct {
// Enabled defines if an Ingress object should be created for Jaeger UI.
//
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",order=1,xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enabled bool `json:"enabled"`
// Annotations defines the annotations of the Ingress object.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Annotations"
Annotations map[string]string `json:"annotations,omitempty"`
// Host defines the hostname of the Ingress object.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Hostname"
Host string `json:"host,omitempty"`
// IngressClassName defines the name of an IngressClass cluster resource.
// Defines which ingress controller serves this ingress resource.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Ingress Class Name"
IngressClassName *string `json:"ingressClassName,omitempty"`
}
// MonolithicJaegerUIRouteSpec defines the settings for the Jaeger UI route.
type MonolithicJaegerUIRouteSpec struct {
// Enabled defines if a Route object should be created for Jaeger UI.
//
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",order=1,xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enabled bool `json:"enabled"`
// Annotations defines the annotations of the Route object.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Annotations"
Annotations map[string]string `json:"annotations,omitempty"`
// Host defines the hostname of the Route object.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Hostname"
Host string `json:"host,omitempty"`
// Termination specifies the termination type.
// Default: edge.
//
// +kubebuilder:validation:Optional
// +kubebuilder:default=edge
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="TLS Termination"
Termination TLSRouteTerminationType `json:"termination,omitempty"`
}
// MonolithicSchedulerSpec defines schedule settings for Tempo.
type MonolithicSchedulerSpec struct {
// NodeSelector defines which labels are required by a node to schedule the pod onto it.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Node Selector",xDescriptors="urn:alm:descriptor:com.tectonic.ui:advanced"
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// Tolerations defines the tolerations of a node to schedule the pod onto it.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Tolerations",xDescriptors="urn:alm:descriptor:com.tectonic.ui:advanced"
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// Affinity defines the Affinity rules for scheduling pods.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Affinity",xDescriptors="urn:alm:descriptor:com.tectonic.ui:advanced"
Affinity *corev1.Affinity `json:"affinity,omitempty"`
}
// MonolithicObservabilitySpec defines the observability configuration of the Tempo deployment.
type MonolithicObservabilitySpec struct {
// Metrics defines the metric configuration of the Tempo deployment.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Metrics"
Metrics *MonolithicObservabilityMetricsSpec `json:"metrics,omitempty"`
// Grafana defines the Grafana configuration of the Tempo deployment.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Grafana"
Grafana *MonolithicObservabilityGrafanaSpec `json:"grafana,omitempty"`
}
// MonolithicObservabilityMetricsSpec defines the metrics settings of the Tempo deployment.
type MonolithicObservabilityMetricsSpec struct {
// ServiceMonitors defines the ServiceMonitor configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Service Monitors"
ServiceMonitors *MonolithicObservabilityMetricsServiceMonitorsSpec `json:"serviceMonitors,omitempty"`
// ServiceMonitors defines the PrometheusRule configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Prometheus Rules"
PrometheusRules *MonolithicObservabilityMetricsPrometheusRulesSpec `json:"prometheusRules,omitempty"`
}
// MonolithicObservabilityMetricsServiceMonitorsSpec defines the ServiceMonitor settings.
type MonolithicObservabilityMetricsServiceMonitorsSpec struct {
// Enabled defines if ServiceMonitor objects should be created for this Tempo deployment.
//
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",order=1,xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enabled bool `json:"enabled"`
}
// MonolithicObservabilityMetricsPrometheusRulesSpec defines the PrometheusRules settings.
type MonolithicObservabilityMetricsPrometheusRulesSpec struct {
// Enabled defines if PrometheusRule objects should be created for this Tempo deployment.
//
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",order=1,xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enabled bool `json:"enabled"`
}
// MonolithicObservabilityGrafanaSpec defines the Grafana configuration of the Tempo deployment.
type MonolithicObservabilityGrafanaSpec struct {
// DataSource defines the Grafana data source configuration.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Grafana data source"
DataSource *MonolithicObservabilityGrafanaDataSourceSpec `json:"dataSource,omitempty"`
}
// MonolithicObservabilityGrafanaDataSourceSpec defines the Grafana data source configuration of the Tempo deployment.
type MonolithicObservabilityGrafanaDataSourceSpec struct {
// Enabled defines if a Grafana data source should be created for this Tempo deployment.
//
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enabled",order=1,xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
Enabled bool `json:"enabled"`
// InstanceSelector defines the Grafana instance where the data source should be created.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Instance Selector",xDescriptors="urn:alm:descriptor:com.tectonic.ui:selector:grafana.integreatly.org:v1beta1:Grafana"
InstanceSelector *metav1.LabelSelector `json:"instanceSelector,omitempty"`
}
// MonolithicComponentStatus defines the status of each component.
type MonolithicComponentStatus struct {
// Tempo is a map of the pod status of the Tempo pods.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Tempo",order=1,xDescriptors="urn:alm:descriptor:com.tectonic.ui:podStatuses"
Tempo PodStatusMap `json:"tempo"`
}
// TempoMonolithicStatus defines the observed state of TempoMonolithic.
type TempoMonolithicStatus struct {
// Components provides summary of all Tempo pod status, grouped per component.
//
// +kubebuilder:validation:Optional
Components MonolithicComponentStatus `json:"components,omitempty"`
// Conditions of the Tempo deployment health.
//
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors="urn:alm:descriptor:io.kubernetes.conditions"
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// TempoMonolithic manages a Tempo deployment in monolithic mode.
//
// +operator-sdk:csv:customresourcedefinitions:displayName="TempoMonolithic",resources={{ConfigMap,v1},{Service,v1},{StatefulSet,v1},{Ingress,v1},{Route,v1}}
//
//nolint:godot
type TempoMonolithic struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec TempoMonolithicSpec `json:"spec,omitempty"`
Status TempoMonolithicStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// TempoMonolithicList contains a list of TempoMonolithic.
type TempoMonolithicList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []TempoMonolithic `json:"items"`
}
func init() {
SchemeBuilder.Register(&TempoMonolithic{}, &TempoMonolithicList{})
}