opentelemetry-operator icon indicating copy to clipboard operation
opentelemetry-operator copied to clipboard

OpenShift route must be no more than 63 characters

Open seb2020 opened this issue 9 months ago • 3 comments

Component(s)

collector

What happened?

Description

When using this snippet for the CRD OpenTelemetryCollector, the generated route is too long for OpenShift:

apiVersion: opentelemetry.io/v1beta1
kind: OpenTelemetryCollector
...
spec:
  ingress:
    type: route
    route:
      termination: "passthrough"

Output -> route must be no more than 63 characters

Actual Result

The route is not created

Questions

The generated route is something like <otelname>-route-<namespace>.apps.<openshift-cluster>.<domain>.<tld>. Is there a way to customize the route with something smaller ?

I have seen a "hostname" key in the "ingress" spec but it constructed the url like <port-name>.<hostname-from-yaml-key>. So if you have multiple deployment, it's not working because every url will be the same

Kubernetes Version

OpenShift 4.16.28

Operator version

0.113.0-2 provided by Red Hat

Collector version

Environment information

Openshift operator but I guess there is the same issue with the "standard" operator

Log output

more than 63 characters\nRoute.route.openshift.io \"port-6832-otel-projet1-dev-route\" is invalid: spec.host: Invalid value: \"port-6832-otel-projet1-dev-route-openshift-opentelemetry-operator.apps.ocp-hub.mydomain.ch\": must be no more than 63 characters","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:316\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:263\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func2.2\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:224"}

Additional context

No response

seb2020 avatar Mar 18 '25 14:03 seb2020

We rely on the route controller, which sets the host and path. So, if you want to customize it, you should use the spec.ingress.hostname. Regarding your assumption of duplication, we can distinguish that through the different paths.

yuriolisa avatar Apr 07 '25 07:04 yuriolisa

Hi,

I can use something like this :

ingress:
    hostname: otel1.domain.ch
    route:
      termination: passthrough

Generated route will be "port-xxx.otel1.domain.ch". If I have many deployments, I need to create a new ssl wildcard for each deployment (like *.otel1.domain.ch, *.otel2.domain.ch). If I set the hostname only to "domain.ch" it will not work because all route will have the same name (like port-xxx.domain.ch)

What is the correct way to handle this kink of situation ?

seb2020 avatar Apr 09 '25 14:04 seb2020

@seb2020, in that case, are the collectors spread in different namespaces? If so, you could use the same name or trying to use the namespace in the URL.

yuriolisa avatar Apr 11 '25 10:04 yuriolisa