@@ -90,14 +90,17 @@ type OpenTelemetryCollectorSpec struct {
90
90
// +optional
91
91
TargetAllocator TargetAllocatorEmbedded `json:"targetAllocator,omitempty"`
92
92
// Mode represents how the collector should be deployed (deployment, daemonset, statefulset or sidecar)
93
- // +kubebuilder:validation:Enum=ModeDeployment;ModeDaemonSet;ModeStatefulSet;ModeSidecar
93
+ // +kubebuilder:default=deployment
94
+ // +kubebuilder:validation:Enum=deployment;daemonset;statefulset;sidecar
94
95
Mode Mode `json:"mode,omitempty"`
95
96
// UpgradeStrategy represents how the operator will handle upgrades to the CR when a newer version of the operator is deployed
96
- // +kubebuilder:validation:Enum=UpgradeStrategyAutomatic
97
+ // +kubebuilder:default=automatic
98
+ // +kubebuilder:validation:Enum=automatic;manual
97
99
UpgradeStrategy UpgradeStrategy `json:"upgradeStrategy"`
98
100
// Config is the raw JSON to be used as the collector's configuration. Refer to the OpenTelemetry Collector documentation for details.
99
101
// The empty objects e.g. batch: should be written as batch: {} otherwise they won't work with kustomize or kubectl edit.
100
102
// +required
103
+ // +kubebuilder:validation:required
101
104
// +kubebuilder:pruning:PreserveUnknownFields
102
105
Config Config `json:"config"`
103
106
// ConfigVersions defines the number versions to keep for the collector config. Each config version is stored in a separate ConfigMap.
@@ -110,17 +113,15 @@ type OpenTelemetryCollectorSpec struct {
110
113
// functionality is only available if one of the valid modes is set.
111
114
// Valid modes are: deployment, daemonset and statefulset.
112
115
// +optional
113
- // +kubebuilder:validation:Enum=ModeDeployment;ModeDaemonSet;ModeStatefulSet ;
116
+ // +kubebuilder:validation:Enum=deployment;daemonSet;statefulSet ;
114
117
Ingress Ingress `json:"ingress,omitempty"`
115
118
// Liveness config for the OpenTelemetry Collector except the probe handler which is auto generated from the health extension of the collector.
116
119
// It is only effective when healthcheckextension is configured in the OpenTelemetry Collector pipeline.
117
120
// +optional
118
- // +kubebuilder:validation:Required
119
121
LivenessProbe * Probe `json:"livenessProbe,omitempty"`
120
122
// Readiness config for the OpenTelemetry Collector except the probe handler which is auto generated from the health extension of the collector.
121
123
// It is only effective when healthcheckextension is configured in the OpenTelemetry Collector pipeline.
122
124
// +optional
123
- // +kubebuilder:validation:Required
124
125
ReadinessProbe * Probe `json:"readinessProbe,omitempty"`
125
126
126
127
// ObservabilitySpec defines how telemetry data gets handled.
@@ -138,13 +139,13 @@ type OpenTelemetryCollectorSpec struct {
138
139
// https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec
139
140
// This is only applicable to Daemonset mode.
140
141
// +optional
141
- // +kubebuilder:validation:Enum=ModeDaemonset
142
+ // +kubebuilder:validation:Enum=daemonset
142
143
DaemonSetUpdateStrategy appsv1.DaemonSetUpdateStrategy `json:"daemonSetUpdateStrategy,omitempty"`
143
144
// UpdateStrategy represents the strategy the operator will take replacing existing Deployment pods with new pods
144
145
// https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/deployment-v1/#DeploymentSpec
145
146
// This is only applicable to Deployment mode.
146
147
// +optional
147
- // +kubebuilder:validation:Enum=ModeDeployment
148
+ // +kubebuilder:validation:Enum=deployment
148
149
DeploymentUpdateStrategy appsv1.DeploymentStrategy `json:"deploymentUpdateStrategy,omitempty"`
149
150
}
150
151
@@ -155,6 +156,7 @@ type TargetAllocatorEmbedded struct {
155
156
// other than 1 if a strategy that allows for high availability is chosen. Currently, the only allocation strategy
156
157
// that can be run in a high availability mode is consistent-hashing.
157
158
// +optional
159
+ // +kubebuilder:validation:Minimum=1
158
160
Replicas * int32 `json:"replicas,omitempty"`
159
161
// NodeSelector to schedule OpenTelemetry TargetAllocator pods.
160
162
// +optional
@@ -168,12 +170,14 @@ type TargetAllocatorEmbedded struct {
168
170
// WARNING: The per-node strategy currently ignores targets without a Node, like control plane components.
169
171
// +optional
170
172
// +kubebuilder:default:=consistent-hashing
173
+ // +kubebuilder:validation:Enum=consistent-hashing;least-weighted;per-node
171
174
AllocationStrategy TargetAllocatorAllocationStrategy `json:"allocationStrategy,omitempty"`
172
175
// FilterStrategy determines how to filter targets before allocating them among the collectors.
173
176
// The only current option is relabel-config (drops targets based on prom relabel_config).
174
177
// The default is relabel-config.
175
178
// +optional
176
179
// +kubebuilder:default:=relabel-config
180
+ // +kubebuilder:validation:Enum=relabel-config
177
181
FilterStrategy TargetAllocatorFilterStrategy `json:"filterStrategy,omitempty"`
178
182
// ServiceAccount indicates the name of an existing service account to use with this instance. When set,
179
183
// the operator will not automatically create a ServiceAccount for the TargetAllocator.
@@ -234,23 +238,33 @@ type Probe struct {
234
238
// Defaults to 0 seconds. Minimum value is 0.
235
239
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
236
240
// +optional
241
+ // +kubebuilder:default=0
242
+ // +kubebuilder:validation:Minimum=0
237
243
InitialDelaySeconds * int32 `json:"initialDelaySeconds,omitempty"`
238
244
// Number of seconds after which the probe times out.
239
245
// Defaults to 1 second. Minimum value is 1.
240
246
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
241
247
// +optional
248
+ // // +kubebuilder:default=1
249
+ // +kubebuilder:validation:Minimum=1
242
250
TimeoutSeconds * int32 `json:"timeoutSeconds,omitempty"`
243
251
// How often (in seconds) to perform the probe.
244
252
// Default to 10 seconds. Minimum value is 1.
245
253
// +optional
254
+ // +kubebuilder:default=10
255
+ // +kubebuilder:validation:Minimum=1
246
256
PeriodSeconds * int32 `json:"periodSeconds,omitempty"`
247
257
// Minimum consecutive successes for the probe to be considered successful after having failed.
248
258
// Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.
249
259
// +optional
260
+ // +kubebuilder:default=1
261
+ // +kubebuilder:validation:Minimum=1
250
262
SuccessThreshold * int32 `json:"successThreshold,omitempty"`
251
263
// Minimum consecutive failures for the probe to be considered failed after having succeeded.
252
264
// Defaults to 3. Minimum value is 1.
253
265
// +optional
266
+ // +kubebuilder:default=3
267
+ // +kubebuilder:validation:Minimum=1
254
268
FailureThreshold * int32 `json:"failureThreshold,omitempty"`
255
269
// Optional duration in seconds the pod needs to terminate gracefully upon probe failure.
256
270
// The grace period is the duration in seconds after the processes running in the pod are sent
@@ -263,6 +277,7 @@ type Probe struct {
263
277
// This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate.
264
278
// Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.
265
279
// +optional
280
+ // +kubebuilder:validation:Minimum=1
266
281
TerminationGracePeriodSeconds * int64 `json:"terminationGracePeriodSeconds,omitempty"`
267
282
}
268
283
@@ -299,11 +314,13 @@ type ScaleSubresourceStatus struct {
299
314
// The selector used to match the OpenTelemetryCollector's
300
315
// deployment or statefulSet pods.
301
316
// +optional
317
+ // +kubebuilder:validation:Enum=deployment;statefulset
302
318
Selector string `json:"selector,omitempty"`
303
319
304
320
// The total number non-terminated pods targeted by this
305
321
// OpenTelemetryCollector's deployment or statefulSet.
306
322
// +optional
323
+ // +kubebuilder:validation:Minimum=0
307
324
Replicas int32 `json:"replicas,omitempty"`
308
325
309
326
// StatusReplicas is the number of pods targeted by this OpenTelemetryCollector's with a Ready Condition /
@@ -315,6 +332,8 @@ type ScaleSubresourceStatus struct {
315
332
316
333
type ConfigMapsSpec struct {
317
334
// Configmap defines name and path where the configMaps should be mounted.
335
+ // +kubebuilder:validation:Required
336
+ // +kubebuilder:validation:MinLength=3
318
337
Name string `json:"name"`
319
338
MountPath string `json:"mountpath"`
320
339
}
0 commit comments