Skip to content

Commit c08f560

Browse files
committed
Adjust webhook validation
Signed-off-by: Matej Gera <[email protected]>
1 parent 2d29ae6 commit c08f560

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

apis/v1alpha1/collector_webhook.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,14 @@ func (c CollectorWebhook) validate(r *OpenTelemetryCollector) (admission.Warning
180180
}
181181

182182
// validate target allocation
183-
if r.Spec.TargetAllocator.Enabled && r.Spec.Mode != ModeStatefulSet {
183+
if r.Spec.TargetAllocator.Enabled && (r.Spec.Mode != ModeStatefulSet && r.Spec.Mode != ModeDaemonSet) {
184184
return warnings, fmt.Errorf("the OpenTelemetry Collector mode is set to %s, which does not support the target allocation deployment", r.Spec.Mode)
185185
}
186186

187+
if r.Spec.TargetAllocator.AllocationStrategy == OpenTelemetryTargetAllocatorAllocationStrategyPerNode && r.Spec.Mode != ModeDaemonSet {
188+
return warnings, fmt.Errorf("target allocation strategy %s is only supported in OpenTelemetry Collector mode %s", OpenTelemetryTargetAllocatorAllocationStrategyPerNode, ModeDaemonSet)
189+
}
190+
187191
// validate Prometheus config for target allocation
188192
if r.Spec.TargetAllocator.Enabled {
189193
promCfg, err := ta.ConfigToPromConfig(r.Spec.Config)

0 commit comments

Comments
 (0)