@@ -156,10 +156,15 @@ func tov1beta1TA(in OpenTelemetryTargetAllocator) v1beta1.TargetAllocatorEmbedde
156
156
Enabled : in .Enabled ,
157
157
Affinity : in .Affinity ,
158
158
PrometheusCR : v1beta1.TargetAllocatorPrometheusCR {
159
- Enabled : in .PrometheusCR .Enabled ,
160
- ScrapeInterval : in .PrometheusCR .ScrapeInterval ,
161
- PodMonitorSelector : toLabelSelector (in .PrometheusCR .PodMonitorSelector ),
162
- ServiceMonitorSelector : toLabelSelector (in .PrometheusCR .ServiceMonitorSelector ),
159
+ Enabled : in .PrometheusCR .Enabled ,
160
+ ScrapeInterval : in .PrometheusCR .ScrapeInterval ,
161
+ // prometheus_cr.pod_monitor_selector shouldn't be nil when selector is empty
162
+ PodMonitorSelector : & metav1.LabelSelector {
163
+ MatchLabels : in .PrometheusCR .PodMonitorSelector ,
164
+ },
165
+ ServiceMonitorSelector : & metav1.LabelSelector {
166
+ MatchLabels : in .PrometheusCR .ServiceMonitorSelector ,
167
+ },
163
168
},
164
169
SecurityContext : in .SecurityContext ,
165
170
PodSecurityContext : in .PodSecurityContext ,
@@ -176,15 +181,6 @@ func tov1beta1TA(in OpenTelemetryTargetAllocator) v1beta1.TargetAllocatorEmbedde
176
181
}
177
182
}
178
183
179
- func toLabelSelector (selector map [string ]string ) * metav1.LabelSelector {
180
- if selector == nil {
181
- return nil
182
- }
183
- return & metav1.LabelSelector {
184
- MatchLabels : selector ,
185
- }
186
- }
187
-
188
184
func tov1beta1Autoscaler (in * AutoscalerSpec , minReplicas , maxReplicas * int32 ) * v1beta1.AutoscalerSpec {
189
185
if in == nil {
190
186
return nil
@@ -279,7 +275,7 @@ func tov1alpha1(in v1beta1.OpenTelemetryCollector) (*OpenTelemetryCollector, err
279
275
SecurityContext : copy .Spec .SecurityContext ,
280
276
PodSecurityContext : copy .Spec .PodSecurityContext ,
281
277
PodAnnotations : copy .Spec .PodAnnotations ,
282
- TargetAllocator : tov1alpha1TA (in .Spec .TargetAllocator ),
278
+ TargetAllocator : tov1alpha1TA (copy .Spec .TargetAllocator ),
283
279
Mode : Mode (copy .Spec .Mode ),
284
280
ServiceAccount : copy .Spec .ServiceAccount ,
285
281
Image : copy .Spec .Image ,
0 commit comments