/
multiclusterobservability_types.go
296 lines (262 loc) · 11 KB
/
multiclusterobservability_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
// Copyright (c) Red Hat, Inc.
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0
package v1beta2
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
observabilityshared "github.com/stolostron/multicluster-observability-operator/operators/multiclusterobservability/api/shared"
)
// MultiClusterObservabilitySpec defines the desired state of MultiClusterObservability.
type MultiClusterObservabilitySpec struct {
// Advanced configurations for observability
// +optional
AdvancedConfig *AdvancedConfig `json:"advanced,omitempty"`
// Enable or disable the downsample.
// +optional
// +kubebuilder:default:=true
EnableDownsampling bool `json:"enableDownsampling"`
// Pull policy of the MultiClusterObservability images
// +optional
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
// Pull secret of the MultiClusterObservability images
// +optional
ImagePullSecret string `json:"imagePullSecret,omitempty"`
// Spec of NodeSelector
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// Tolerations causes all components to tolerate any taints.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// Specifies the storage to be used by Observability
// +required
StorageConfig *StorageConfig `json:"storageConfig"`
// The ObservabilityAddonSpec defines the global settings for all managed
// clusters which have observability add-on enabled.
// +required
ObservabilityAddonSpec *observabilityshared.ObservabilityAddonSpec `json:"observabilityAddonSpec"`
}
type AdvancedConfig struct {
// The spec of the data retention configurations
// +optional
RetentionConfig *RetentionConfig `json:"retentionConfig,omitempty"`
// The spec of rbac-query-proxy
// +optional
RBACQueryProxy *CommonSpec `json:"rbacQueryProxy,omitempty"`
// The spec of grafana
// +optional
Grafana *CommonSpec `json:"grafana,omitempty"`
// The spec of alertmanager
// +optional
Alertmanager *CommonSpec `json:"alertmanager,omitempty"`
// Specifies the store memcached
// +optional
StoreMemcached *CacheConfig `json:"storeMemcached,omitempty"`
// Specifies the store memcached
// +optional
QueryFrontendMemcached *CacheConfig `json:"queryFrontendMemcached,omitempty"`
// Spec of observatorium api
// +optional
ObservatoriumAPI *CommonSpec `json:"observatoriumAPI,omitempty"`
// spec for thanos-query-frontend
// +optional
QueryFrontend *QueryFrontendSpec `json:"queryFrontend,omitempty"`
// spec for thanos-query
// +optional
Query *QuerySpec `json:"query,omitempty"`
// spec for thanos-compact
// +optional
Compact *CompactSpec `json:"compact,omitempty"`
// spec for thanos-receiver
// +optional
Receive *ReceiveSpec `json:"receive,omitempty"`
// spec for thanos-rule
// +optional
Rule *RuleSpec `json:"rule,omitempty"`
// spec for thanos-store-shard
// +optional
Store *StoreSpec `json:"store,omitempty"`
}
type CommonSpec struct {
// Compute Resources required by this component.
// +optional
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// Replicas for this component.
// +optional
Replicas *int32 `json:"replicas,omitempty"`
}
// Thanos Query Spec.
type QuerySpec struct {
// Annotations is an unstructured key value map stored with a service account
// +optional
ServiceAccountAnnotations map[string]string `json:"serviceAccountAnnotations,omitempty"`
// WARNING: Use only with guidance from Red Hat Support. Using this feature incorrectly can
// lead to an unrecoverable state, data loss, or both, which is not covered by Red Hat Support.
// +optional
Containers []corev1.Container `json:"containers,omitempty"`
CommonSpec `json:",inline"`
}
// Thanos Receive Spec.
type ReceiveSpec struct {
// Annotations is an unstructured key value map stored with a service account
// +optional
ServiceAccountAnnotations map[string]string `json:"serviceAccountAnnotations,omitempty"`
// WARNING: Use only with guidance from Red Hat Support. Using this feature incorrectly can
// lead to an unrecoverable state, data loss, or both, which is not covered by Red Hat Support.
// +optional
Containers []corev1.Container `json:"containers,omitempty"`
CommonSpec `json:",inline"`
}
// Thanos Store Spec.
type StoreSpec struct {
// Annotations is an unstructured key value map stored with a service account
// +optional
ServiceAccountAnnotations map[string]string `json:"serviceAccountAnnotations,omitempty"`
CommonSpec `json:",inline"`
// WARNING: Use only with guidance from Red Hat Support. Using this feature incorrectly can
// lead to an unrecoverable state, data loss, or both, which is not covered by Red Hat Support.
// +optional
Containers []corev1.Container `json:"containers,omitempty"`
}
// Thanos Rule Spec.
type RuleSpec struct {
// Evaluation interval
// +optional
EvalInterval string `json:"evalInterval,omitempty"`
// Annotations is an unstructured key value map stored with a service account
// +optional
ServiceAccountAnnotations map[string]string `json:"serviceAccountAnnotations,omitempty"`
// WARNING: Use only with guidance from Red Hat Support. Using this feature incorrectly can
// lead to an unrecoverable state, data loss, or both, which is not covered by Red Hat Support.
// +optional
Containers []corev1.Container `json:"containers,omitempty"`
CommonSpec `json:",inline"`
}
// Thanos Compact Spec.
type CompactSpec struct {
// Compute Resources required by the compact.
// +optional
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// Annotations is an unstructured key value map stored with a service account
// +optional
ServiceAccountAnnotations map[string]string `json:"serviceAccountAnnotations,omitempty"`
// WARNING: Use only with guidance from Red Hat Support. Using this feature incorrectly can
// lead to an unrecoverable state, data loss, or both, which is not covered by Red Hat Support.
// +optional
Containers []corev1.Container `json:"containers,omitempty"`
}
// CacheConfig is the spec of memcached.
type CacheConfig struct {
// Memory limit of Memcached in megabytes.
// +optional
MemoryLimitMB *int32 `json:"memoryLimitMb,omitempty"`
// Max item size of Memcached (default: 1m, min: 1k, max: 1024m).
// +optional
MaxItemSize string `json:"maxItemSize,omitempty"`
// Max simultaneous connections of Memcached.
// +optional
ConnectionLimit *int32 `json:"connectionLimit,omitempty"`
CommonSpec `json:",inline"`
}
// Thanos QueryFrontend Spec.
type QueryFrontendSpec struct {
// WARNING: Use only with guidance from Red Hat Support. Using this feature incorrectly can
// lead to an unrecoverable state, data loss, or both, which is not covered by Red Hat Support.
// +optional
Containers []corev1.Container `json:"containers,omitempty"`
CommonSpec `json:",inline"`
}
// RetentionConfig is the spec of retention configurations.
type RetentionConfig struct {
// How long to retain raw samples in a bucket.
// It applies to --retention.resolution-raw in compact.
// +optional
RetentionResolutionRaw string `json:"retentionResolutionRaw,omitempty"`
// How long to retain samples of resolution 1 (5 minutes) in bucket.
// It applies to --retention.resolution-5m in compact.
// +optional
RetentionResolution5m string `json:"retentionResolution5m,omitempty"`
// How long to retain samples of resolution 2 (1 hour) in bucket.
// It applies to --retention.resolution-1h in compact.
// +optional
RetentionResolution1h string `json:"retentionResolution1h,omitempty"`
// How long to retain raw samples in a local disk. It applies to rule/receive:
// --tsdb.retention in receive
// --tsdb.retention in rule
// +optional
RetentionInLocal string `json:"retentionInLocal,omitempty"`
// configure --delete-delay in compact
// Time before a block marked for deletion is deleted from bucket.
// +optional
DeleteDelay string `json:"deleteDelay,omitempty"`
// configure --tsdb.block-duration in rule (Block duration for TSDB block)
// +optional
BlockDuration string `json:"blockDuration,omitempty"`
}
// StorageConfig is the spec of object storage.
type StorageConfig struct {
// Object store config secret for metrics
// +required
MetricObjectStorage *observabilityshared.PreConfiguredStorage `json:"metricObjectStorage"`
// WriteStorage storage config secret list for metrics
// +optional
WriteStorage []*observabilityshared.PreConfiguredStorage `json:"writeStorage,omitempty"`
// Specify the storageClass Stateful Sets. This storage class will also
// be used for Object Storage if MetricObjectStorage was configured for
// the system to create the storage.
// +optional
// +kubebuilder:default:=gp2
StorageClass string `json:"storageClass,omitempty"`
// The amount of storage applied to alertmanager stateful sets,
// +optional
// +kubebuilder:default:="1Gi"
AlertmanagerStorageSize string `json:"alertmanagerStorageSize,omitempty"`
// The amount of storage applied to thanos rule stateful sets,
// +optional
// +kubebuilder:default:="1Gi"
RuleStorageSize string `json:"ruleStorageSize,omitempty"`
// The amount of storage applied to thanos compact stateful sets,
// +optional
// +kubebuilder:default:="100Gi"
CompactStorageSize string `json:"compactStorageSize,omitempty"`
// The amount of storage applied to thanos receive stateful sets,
// +optional
// +kubebuilder:default:="100Gi"
ReceiveStorageSize string `json:"receiveStorageSize,omitempty"`
// The amount of storage applied to thanos store stateful sets,
// +optional
// +kubebuilder:default:="10Gi"
StoreStorageSize string `json:"storeStorageSize,omitempty"`
}
// MultiClusterObservabilityStatus defines the observed state of MultiClusterObservability.
type MultiClusterObservabilityStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Represents the status of each deployment
// +optional
Conditions []observabilityshared.Condition `json:"conditions,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// MultiClusterObservability defines the configuration for the Observability installation on
// Hub and Managed Clusters all through this one custom resource.
// +kubebuilder:pruning:PreserveUnknownFields
// +kubebuilder:resource:path=multiclusterobservabilities,scope=Cluster,shortName=mco
// +operator-sdk:csv:customresourcedefinitions:displayName="MultiClusterObservability"
type MultiClusterObservability struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec MultiClusterObservabilitySpec `json:"spec,omitempty"`
Status MultiClusterObservabilityStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// MultiClusterObservabilityList contains a list of MultiClusterObservability
type MultiClusterObservabilityList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MultiClusterObservability `json:"items"`
}
func init() {
SchemeBuilder.Register(&MultiClusterObservability{}, &MultiClusterObservabilityList{})
}