gateway icon indicating copy to clipboard operation
gateway copied to clipboard

Backend FQDN hostname pattern rejects trailing dot

Open johnke opened this issue 6 months ago • 3 comments

Description

The FQDNEndpoint.Hostname field on the Backend resource has this validation:

// api/v1alpha1/backend_types.go
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
Hostname string `json:"hostname"`

The pattern requires every label (including the last) to end in [a-z0-9], so a trailing-dot absolute form (foo.s3.eu-west-1.amazonaws.com.) is rejected by the apiserver at admission. When that happens via an HTTPRoute backendRef, the surface error is Backend <ns>/<name> not found on the parent gateway, which made the root cause non-obvious for us.

Why it matters

The trailing-dot form is the RFC 1034 §3.1 "absolute domain name" representation. We relied on that under ingress-nginx to help with the load on our CoreDNS and we want to keep it on Backend.

Specifically, our S3 endpoints render with 4 dots in their hostname, under the default ndots: 5, so it gets walked through the cluster search domains on every Strict-DNS refresh before the absolute lookup wins.

Questions

  1. Was the pattern deliberately written to reject the trailing dot, or did it just inherit the standard RFC-1123-style label regex? Afaics Envoy's own SocketAddress.address only enforces min_len: 1 and STRICT_DNS clusters pass the string straight to c-ares which handles the trailing-dot form natively so the CRD looks stricter than the runtime it's fronting.
  2. If the latter, would a PR relaxing the last group to (\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\.?$ (or equivalent) be in scope? Happy to open one!
  3. As a workaround today, are folks overriding dnsConfig.options.ndots on the envoy-proxy pod via an EnvoyProxy resource? Or is there a more idiomatic approach I'm missing?

Environment

  • Envoy Gateway: 1.7.3
  • Kubernetes: 1.35.0

johnke avatar May 22 '26 14:05 johnke

cc @guydc

zirain avatar May 22 '26 23:05 zirain

Hi! I’d like to work on this one

From a first look, this seems to be limited to relaxing the FQDNEndpoint.Hostname kubebuilder validation pattern in api/v1alpha1/backend_types.go to allow an optional trailing dot

NeddM avatar May 27 '26 21:05 NeddM

This issue has been automatically marked as stale because it has not had activity in the last 30 days.

github-actions[bot] avatar Jun 27 '26 00:06 github-actions[bot]