diff --git a/.chloggen/1967-ingress-path.yaml b/.chloggen/1967-ingress-path.yaml
index 21c4ba9bd4..9bb3456296 100755
--- a/.chloggen/1967-ingress-path.yaml
+++ b/.chloggen/1967-ingress-path.yaml
@@ -14,5 +14,6 @@ issues: [1967]
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
- The ingress and route now uses only root path `/` for all exposed collector receivers.
- Each receiver is exposed on a subdomain that matches the port name of the receiver.
+ The ingress can be configured to create a single host with multiple paths or
+ multiple hosts with subdomains (one per receiver port).
+ The path from OpenShift route was removed.
diff --git a/apis/v1alpha1/opentelemetrycollector_types.go b/apis/v1alpha1/opentelemetrycollector_types.go
index 2d599eb675..d4cdc85158 100644
--- a/apis/v1alpha1/opentelemetrycollector_types.go
+++ b/apis/v1alpha1/opentelemetrycollector_types.go
@@ -36,6 +36,21 @@ const (
ManagementStateUnmanaged ManagementStateType = "Unmanaged"
)
+// IngressRuleType defines how the collector receivers will be exposed in the Ingress.
+//
+// +kubebuilder:validation:Enum=path;subdomain
+type IngressRuleType string
+
+const (
+ // IngressRuleTypePath configures Ingress to use single host with multiple paths.
+ // This configuration might require additional ingress setting to rewrite paths.
+ IngressRuleTypePath IngressRuleType = "path"
+
+ // IngressRuleTypeSubdomain configures Ingress to use multiple hosts - one for each exposed
+ // receiver port. The port name is used as a subdomain for the host defined in the Ingress e.g. otlp-http.example.com.
+ IngressRuleTypeSubdomain IngressRuleType = "subdomain"
+)
+
// Ingress is used to specify how OpenTelemetry Collector is exposed. This
// functionality is only available if one of the valid modes is set.
// Valid modes are: deployment, daemonset and statefulset.
@@ -48,9 +63,15 @@ const (
// SEE: OpenTelemetryCollector.spec.ports[index].
type Ingress struct {
// Type default value is: ""
- // Supported types are: ingress
+ // Supported types are: ingress, route
Type IngressType `json:"type,omitempty"`
+ // RuleType defines how Ingress exposes collector receivers.
+ // Either multiple hosts with subdomain per receiver port are created or
+ // a single host with multiple paths.
+ // Default is path.
+ RuleType IngressRuleType `json:"ruleType,omitempty"`
+
// Hostname by which the ingress proxy can be reached.
// +optional
Hostname string `json:"hostname,omitempty"`
diff --git a/apis/v1alpha1/opentelemetrycollector_webhook.go b/apis/v1alpha1/opentelemetrycollector_webhook.go
index bff4099c7a..8cbca98cd6 100644
--- a/apis/v1alpha1/opentelemetrycollector_webhook.go
+++ b/apis/v1alpha1/opentelemetrycollector_webhook.go
@@ -109,6 +109,9 @@ func (r *OpenTelemetryCollector) Default() {
if r.Spec.Ingress.Type == IngressTypeRoute && r.Spec.Ingress.Route.Termination == "" {
r.Spec.Ingress.Route.Termination = TLSRouteTerminationTypeEdge
}
+ if r.Spec.Ingress.Type == IngressTypeNginx && r.Spec.Ingress.RuleType == "" {
+ r.Spec.Ingress.RuleType = IngressRuleTypePath
+ }
}
// +kubebuilder:webhook:verbs=create;update,path=/validate-opentelemetry-io-v1alpha1-opentelemetrycollector,mutating=false,failurePolicy=fail,groups=opentelemetry.io,resources=opentelemetrycollectors,versions=v1alpha1,name=vopentelemetrycollectorcreateupdate.kb.io,sideEffects=none,admissionReviewVersions=v1
diff --git a/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml b/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml
index 6357ffd4dc..a2396954ee 100644
--- a/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml
+++ b/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml
@@ -1373,6 +1373,14 @@ spec:
- reencrypt
type: string
type: object
+ ruleType:
+ description: RuleType defines how Ingress exposes collector receivers.
+ Either multiple hosts with subdomain per receiver port are created
+ or a single host with multiple paths. Default is path.
+ enum:
+ - path
+ - subdomain
+ type: string
tls:
description: TLS configuration.
items:
@@ -1401,7 +1409,8 @@ spec:
type: object
type: array
type:
- description: 'Type default value is: "" Supported types are: ingress'
+ description: 'Type default value is: "" Supported types are: ingress,
+ route'
enum:
- ingress
- route
diff --git a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml
index f1a732b9e9..3c6c780994 100644
--- a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml
+++ b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml
@@ -1370,6 +1370,14 @@ spec:
- reencrypt
type: string
type: object
+ ruleType:
+ description: RuleType defines how Ingress exposes collector receivers.
+ Either multiple hosts with subdomain per receiver port are created
+ or a single host with multiple paths. Default is path.
+ enum:
+ - path
+ - subdomain
+ type: string
tls:
description: TLS configuration.
items:
@@ -1398,7 +1406,8 @@ spec:
type: object
type: array
type:
- description: 'Type default value is: "" Supported types are: ingress'
+ description: 'Type default value is: "" Supported types are: ingress,
+ route'
enum:
- ingress
- route
diff --git a/docs/api.md b/docs/api.md
index 9a0fe3bbfa..670452cd07 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -6083,6 +6083,15 @@ Ingress is used to specify how OpenTelemetry Collector is exposed. This function
Route is an OpenShift specific section that is only considered when type "route" is used.