Documentation
¶
Overview ¶
Package ingress provides conversion from Gateway API HTTPRoute resources to Cloudflare Tunnel ingress configuration.
Overview ¶
The Builder type converts a list of HTTPRoute resources into Cloudflare tunnel ingress rules. It handles:
- Hostname extraction from HTTPRoute.spec.hostnames
- Path matching (Exact and PathPrefix types)
- Backend service resolution to cluster-internal URLs
- Rule ordering by priority and path specificity
Path Matching ¶
The builder supports two path match types as defined by Gateway API:
- PathMatchExact: Matches the path exactly (priority 1)
- PathMatchPathPrefix: Matches paths with the given prefix (priority 0)
Rules are sorted by hostname, then by priority (exact matches first), then by path length (longer paths first for prefix matches).
Service Resolution ¶
Backend references are resolved to fully-qualified cluster DNS names:
http://<service>.<namespace>.svc.<cluster-domain>:<port>
Port 443 automatically uses HTTPS scheme.
Catch-All Rule ¶
A catch-all rule returning HTTP 404 is always appended as the last rule, as required by Cloudflare Tunnel configuration.
Index ¶
Constants ¶
const ( // CatchAllService is the Cloudflare Tunnel service that returns HTTP 404. // It is always added as the last rule in the ingress configuration. CatchAllService = "http_status:404" // DefaultHTTPPort is the default port for HTTP backend services. DefaultHTTPPort = 80 // DefaultHTTPSPort is the default port for HTTPS backend services. DefaultHTTPSPort = 443 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// ClusterDomain is the Kubernetes cluster domain suffix for service DNS.
// Typically "cluster.local".
ClusterDomain string
}
Builder converts Gateway API HTTPRoute resources to Cloudflare Tunnel ingress configuration rules.
func NewBuilder ¶
NewBuilder creates a new Builder with the specified cluster domain.
func (*Builder) Build ¶
func (b *Builder) Build(routes []gatewayv1.HTTPRoute) []zero_trust.TunnelCloudflaredConfigurationUpdateParamsConfigIngress
Build converts a list of HTTPRoute resources to Cloudflare Tunnel ingress rules.
Rules are sorted by:
- Hostname (alphabetically)
- Priority (exact matches before prefix matches)
- Path length (longer paths first for specificity)
A catch-all rule returning HTTP 404 is always appended as the last rule.