Skip to content

Commit

Permalink
verify if collector mode is compatible with ingress settings
Browse files Browse the repository at this point in the history
Signed-off-by: Benedikt Bongartz <[email protected]>
  • Loading branch information
frzifus committed Oct 10, 2022
1 parent d045899 commit 25792a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apis/v1alpha1/opentelemetrycollector_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package v1alpha1

import (
"fmt"
"strings"

"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation"
Expand Down Expand Up @@ -166,5 +167,12 @@ func (r *OpenTelemetryCollector) validateCRDSpec() error {

}

mode := strings.ToLower(string(r.Spec.Mode))
if r.Spec.Ingress.Type != "" && (mode != "deployment" || mode != "daemonset" || mode != "statefulset") {
return fmt.Errorf("the OptenTelemetry Spec Ingress configuiration is incorrect. Ingress can only be used in combination with the modes: %s, %s, %s",
"deployment", "daemenset", "statefulset",
)
}

return nil
}

0 comments on commit 25792a5

Please sign in to comment.