Backend FQDN hostname pattern rejects trailing dot
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
- 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.addressonly enforcesmin_len: 1andSTRICT_DNSclusters 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. - 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! - As a workaround today, are folks overriding
dnsConfig.options.ndotson the envoy-proxy pod via anEnvoyProxyresource? Or is there a more idiomatic approach I'm missing?
Environment
- Envoy Gateway: 1.7.3
- Kubernetes: 1.35.0
cc @guydc
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
This issue has been automatically marked as stale because it has not had activity in the last 30 days.