@@ -19,98 +19,61 @@ package v1beta1
19
19
import (
20
20
appsv1 "k8s.io/api/apps/v1"
21
21
v1 "k8s.io/api/core/v1"
22
- networkingv1 "k8s.io/api/networking/v1"
23
22
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24
23
)
25
24
26
- // Probe defines the OpenTelemetry's pod probe config. Only Liveness probe is supported currently.
27
- type Probe struct {
28
- // Number of seconds after the container has started before liveness probes are initiated.
29
- // Defaults to 0 seconds. Minimum value is 0.
30
- // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
31
- // +optional
32
- InitialDelaySeconds * int32 `json:"initialDelaySeconds,omitempty"`
33
- // Number of seconds after which the probe times out.
34
- // Defaults to 1 second. Minimum value is 1.
35
- // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
36
- // +optional
37
- TimeoutSeconds * int32 `json:"timeoutSeconds,omitempty"`
38
- // How often (in seconds) to perform the probe.
39
- // Default to 10 seconds. Minimum value is 1.
40
- // +optional
41
- PeriodSeconds * int32 `json:"periodSeconds,omitempty"`
42
- // Minimum consecutive successes for the probe to be considered successful after having failed.
43
- // Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.
44
- // +optional
45
- SuccessThreshold * int32 `json:"successThreshold,omitempty"`
46
- // Minimum consecutive failures for the probe to be considered failed after having succeeded.
47
- // Defaults to 3. Minimum value is 1.
48
- // +optional
49
- FailureThreshold * int32 `json:"failureThreshold,omitempty"`
50
- // Optional duration in seconds the pod needs to terminate gracefully upon probe failure.
51
- // The grace period is the duration in seconds after the processes running in the pod are sent
52
- // a termination signal and the time when the processes are forcibly halted with a kill signal.
53
- // Set this value longer than the expected cleanup time for your process.
54
- // If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this
55
- // value overrides the value provided by the pod spec.
56
- // Value must be non-negative integer. The value zero indicates stop immediately via
57
- // the kill signal (no opportunity to shut down).
58
- // This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate.
59
- // Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.
60
- // +optional
61
- TerminationGracePeriodSeconds * int64 `json:"terminationGracePeriodSeconds,omitempty"`
25
+ func init () {
26
+ SchemeBuilder .Register (& OpenTelemetryCollector {}, & OpenTelemetryCollectorList {})
62
27
}
63
28
64
- // Ingress is used to specify how OpenTelemetry Collector is exposed. This
65
- // functionality is only available if one of the valid modes is set.
66
- // Valid modes are: deployment, daemonset and statefulset.
67
- // NOTE: If this feature is activated, all specified receivers are exposed.
68
- // Currently, this has a few limitations. Depending on the ingress controller
69
- // there are problems with TLS and gRPC.
70
- // SEE: https://github.com/open-telemetry/opentelemetry-operator/issues/1306.
71
- // NOTE: As a workaround, port name and appProtocol could be specified directly
72
- // in the CR.
73
- // SEE: OpenTelemetryCollector.spec.ports[index].
74
- type Ingress struct {
75
- // Type default value is: ""
76
- // Supported types are: ingress, route
77
- Type IngressType `json:"type,omitempty"`
29
+ // +kubebuilder:object:root=true
30
+ // +kubebuilder:resource:shortName=otelcol;otelcols
31
+ // +kubebuilder:subresource:status
32
+ // +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.scale.replicas,selectorpath=.status.scale.selector
33
+ // +kubebuilder:printcolumn:name="Mode",type="string",JSONPath=".spec.mode",description="Deployment Mode"
34
+ // +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.version",description="OpenTelemetry Version"
35
+ // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.scale.statusReplicas"
36
+ // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
37
+ // +kubebuilder:printcolumn:name="Image",type="string",JSONPath=".status.image"
38
+ // +kubebuilder:printcolumn:name="Management",type="string",JSONPath=".spec.managementState",description="Management State"
39
+ // +operator-sdk:csv:customresourcedefinitions:displayName="OpenTelemetry Collector"
40
+ // This annotation provides a hint for OLM which resources are managed by OpenTelemetryCollector kind.
41
+ // It's not mandatory to list all resources.
42
+ // +operator-sdk:csv:customresourcedefinitions:resources={{Pod,v1},{Deployment,apps/v1},{DaemonSets,apps/v1},{StatefulSets,apps/v1},{ConfigMaps,v1},{Service,v1}}
43
+
44
+ // OpenTelemetryCollector is the Schema for the opentelemetrycollectors API.
45
+ type OpenTelemetryCollector struct {
46
+ metav1.TypeMeta `json:",inline"`
47
+ metav1.ObjectMeta `json:"metadata,omitempty"`
78
48
79
- // RuleType defines how Ingress exposes collector receivers.
80
- // IngressRuleTypePath ("path") exposes each receiver port on a unique path on single domain defined in Hostname.
81
- // IngressRuleTypeSubdomain ("subdomain") exposes each receiver port on a unique subdomain of Hostname.
82
- // Default is IngressRuleTypePath ("path").
83
- RuleType IngressRuleType `json:"ruleType,omitempty"`
49
+ Spec OpenTelemetryCollectorSpec `json:"spec,omitempty"`
50
+ Status OpenTelemetryCollectorStatus `json:"status,omitempty"`
51
+ }
84
52
85
- // Hostname by which the ingress proxy can be reached.
86
- // +optional
87
- Hostname string `json:"hostname,omitempty"`
53
+ func (* OpenTelemetryCollector ) Hub () {}
88
54
89
- // Annotations to add to ingress.
90
- // e.g. 'cert-manager.io/cluster-issuer: "letsencrypt"'
91
- // +optional
92
- Annotations map [string ]string `json:"annotations,omitempty"`
55
+ //+kubebuilder:object:root=true
93
56
94
- // TLS configuration.
95
- // +optional
96
- TLS []networkingv1.IngressTLS `json:"tls,omitempty"`
57
+ // OpenTelemetryCollectorList contains a list of OpenTelemetryCollector.
58
+ type OpenTelemetryCollectorList struct {
59
+ metav1.TypeMeta `json:",inline"`
60
+ metav1.ListMeta `json:"metadata,omitempty"`
61
+ Items []OpenTelemetryCollector `json:"items"`
62
+ }
97
63
98
- // IngressClassName is the name of an IngressClass cluster resource. Ingress
99
- // controller implementations use this field to know whether they should be
100
- // serving this Ingress resource .
64
+ // OpenTelemetryCollectorStatus defines the observed state of OpenTelemetryCollector.
65
+ type OpenTelemetryCollectorStatus struct {
66
+ // Scale is the OpenTelemetryCollector's scale subresource status .
101
67
// +optional
102
- IngressClassName * string `json:"ingressClassName ,omitempty"`
68
+ Scale ScaleSubresourceStatus `json:"scale ,omitempty"`
103
69
104
- // Route is an OpenShift specific section that is only considered when
105
- // type "route" is used.
70
+ // Version of the managed OpenTelemetry Collector (operand)
106
71
// +optional
107
- Route OpenShiftRoute `json:"route,omitempty"`
108
- }
72
+ Version string `json:"version,omitempty"`
109
73
110
- // OpenShiftRoute defines openshift route specific settings.
111
- type OpenShiftRoute struct {
112
- // Termination indicates termination type. By default "edge" is used.
113
- Termination TLSRouteTerminationType `json:"termination,omitempty"`
74
+ // Image indicates the container image to use for the OpenTelemetry Collector.
75
+ // +optional
76
+ Image string `json:"image,omitempty"`
114
77
}
115
78
116
79
// OpenTelemetryCollectorSpec defines the desired state of OpenTelemetryCollector.
@@ -242,19 +205,42 @@ type TargetAllocatorEmbedded struct {
242
205
PodDisruptionBudget * PodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
243
206
}
244
207
245
- // OpenTelemetryCollectorStatus defines the observed state of OpenTelemetryCollector.
246
- type OpenTelemetryCollectorStatus struct {
247
- // Scale is the OpenTelemetryCollector's scale subresource status.
208
+ // Probe defines the OpenTelemetry's pod probe config. Only Liveness probe is supported currently.
209
+ type Probe struct {
210
+ // Number of seconds after the container has started before liveness probes are initiated.
211
+ // Defaults to 0 seconds. Minimum value is 0.
212
+ // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
248
213
// +optional
249
- Scale ScaleSubresourceStatus `json:"scale,omitempty"`
250
-
251
- // Version of the managed OpenTelemetry Collector (operand)
214
+ InitialDelaySeconds * int32 `json:"initialDelaySeconds,omitempty"`
215
+ // Number of seconds after which the probe times out.
216
+ // Defaults to 1 second. Minimum value is 1.
217
+ // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
252
218
// +optional
253
- Version string `json:"version ,omitempty"`
254
-
255
- // Image indicates the container image to use for the OpenTelemetry Collector .
219
+ TimeoutSeconds * int32 `json:"timeoutSeconds ,omitempty"`
220
+ // How often (in seconds) to perform the probe.
221
+ // Default to 10 seconds. Minimum value is 1 .
256
222
// +optional
257
- Image string `json:"image,omitempty"`
223
+ PeriodSeconds * int32 `json:"periodSeconds,omitempty"`
224
+ // Minimum consecutive successes for the probe to be considered successful after having failed.
225
+ // Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.
226
+ // +optional
227
+ SuccessThreshold * int32 `json:"successThreshold,omitempty"`
228
+ // Minimum consecutive failures for the probe to be considered failed after having succeeded.
229
+ // Defaults to 3. Minimum value is 1.
230
+ // +optional
231
+ FailureThreshold * int32 `json:"failureThreshold,omitempty"`
232
+ // Optional duration in seconds the pod needs to terminate gracefully upon probe failure.
233
+ // The grace period is the duration in seconds after the processes running in the pod are sent
234
+ // a termination signal and the time when the processes are forcibly halted with a kill signal.
235
+ // Set this value longer than the expected cleanup time for your process.
236
+ // If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this
237
+ // value overrides the value provided by the pod spec.
238
+ // Value must be non-negative integer. The value zero indicates stop immediately via
239
+ // the kill signal (no opportunity to shut down).
240
+ // This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate.
241
+ // Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.
242
+ // +optional
243
+ TerminationGracePeriodSeconds * int64 `json:"terminationGracePeriodSeconds,omitempty"`
258
244
}
259
245
260
246
// ObservabilitySpec defines how telemetry data gets handled.
@@ -309,42 +295,3 @@ type ConfigMapsSpec struct {
309
295
Name string `json:"name"`
310
296
MountPath string `json:"mountpath"`
311
297
}
312
-
313
- // +kubebuilder:object:root=true
314
- // +kubebuilder:resource:shortName=otelcol;otelcols
315
- // +kubebuilder:subresource:status
316
- // +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.scale.replicas,selectorpath=.status.scale.selector
317
- // +kubebuilder:printcolumn:name="Mode",type="string",JSONPath=".spec.mode",description="Deployment Mode"
318
- // +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.version",description="OpenTelemetry Version"
319
- // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.scale.statusReplicas"
320
- // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
321
- // +kubebuilder:printcolumn:name="Image",type="string",JSONPath=".status.image"
322
- // +kubebuilder:printcolumn:name="Management",type="string",JSONPath=".spec.managementState",description="Management State"
323
- // +operator-sdk:csv:customresourcedefinitions:displayName="OpenTelemetry Collector"
324
- // This annotation provides a hint for OLM which resources are managed by OpenTelemetryCollector kind.
325
- // It's not mandatory to list all resources.
326
- // +operator-sdk:csv:customresourcedefinitions:resources={{Pod,v1},{Deployment,apps/v1},{DaemonSets,apps/v1},{StatefulSets,apps/v1},{ConfigMaps,v1},{Service,v1}}
327
-
328
- // OpenTelemetryCollector is the Schema for the opentelemetrycollectors API.
329
- type OpenTelemetryCollector struct {
330
- metav1.TypeMeta `json:",inline"`
331
- metav1.ObjectMeta `json:"metadata,omitempty"`
332
-
333
- Spec OpenTelemetryCollectorSpec `json:"spec,omitempty"`
334
- Status OpenTelemetryCollectorStatus `json:"status,omitempty"`
335
- }
336
-
337
- func (* OpenTelemetryCollector ) Hub () {}
338
-
339
- //+kubebuilder:object:root=true
340
-
341
- // OpenTelemetryCollectorList contains a list of OpenTelemetryCollector.
342
- type OpenTelemetryCollectorList struct {
343
- metav1.TypeMeta `json:",inline"`
344
- metav1.ListMeta `json:"metadata,omitempty"`
345
- Items []OpenTelemetryCollector `json:"items"`
346
- }
347
-
348
- func init () {
349
- SchemeBuilder .Register (& OpenTelemetryCollector {}, & OpenTelemetryCollectorList {})
350
- }
0 commit comments