Skip to content

Commit

Permalink
feat: add config-validation
Browse files Browse the repository at this point in the history
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
  • Loading branch information
csatib02 committed Nov 11, 2024
1 parent cd831c3 commit 1dd5b5a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/controller/telemetry/collector_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ func (r *CollectorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
return ctrl.Result{}, err
}

// NOTE: Might also be a good place to add a validation webhook to validate the config input
if err := otelConfigInput.ValidateConfig(); isNoResourcesError(err) != nil {
collector.Status.State = v1alpha1.StateFailed
logger.Error(errors.WithStack(err), "invalid otel config input")
Expand Down Expand Up @@ -567,3 +566,11 @@ func isNoResourcesError(err error) error {

return err
}

func isNoResourcesError(err error) error {

Check failure on line 570 in internal/controller/telemetry/collector_controller.go

View workflow job for this annotation

GitHub Actions / Lint

isNoResourcesError redeclared in this block

Check failure on line 570 in internal/controller/telemetry/collector_controller.go

View workflow job for this annotation

GitHub Actions / Lint

isNoResourcesError redeclared in this block

Check failure on line 570 in internal/controller/telemetry/collector_controller.go

View workflow job for this annotation

GitHub Actions / Test

isNoResourcesError redeclared in this block
if err == otelcolconfgen.ErrNoResources {
return nil
}

return err
}

0 comments on commit 1dd5b5a

Please sign in to comment.