haproxy-ingress
haproxy-ingress copied to clipboard
ExternalName Service without ports no longer works
Description of the problem
HAProxy Ingress no longer supports ExternalName Services that do not include a port. When an Ingress points to an ExternalName Service without a port, the backend is not configured, resulting in an HTTP 404 error. The HA Proxy Ingress logs include the following:
W0713 17:17:03.966403 9 ingress.go:524] skipping backend config of ingress 'default/httpbin': port not found: '80'
In v0.7.6, this config was supported. Support was broken in some later version of HAProxy Ingress (v0.8?).
Expected behavior
Since ExternalName Services do not require a port, I expected this config to create a backend configured using the same port specified on the Ingress. From my observation, this was the behavior in v0.7.6.
Steps to reproduce the problem
- Create an ExternalName Service without
ports
- Create an Ingress pointing to this Service
- Attempt to hit the URL exposed by the Ingress, e.g. https://httpbin.mydomain
Environment information
HAProxy Ingress version: v0.13.8
Command-line options:
--configmap=system/haproxy-ingress
--ingress-class=haproxy
--sort-backends
--default-backend-service=system/haproxy-ingress-default-backend
--rate-limit-update=10
--watch-ingress-without-class=true
Global options:
balance-algorithm: roundrobin
config-frontend: |
maxconn 20000
capture request header Host len 32
capture request header Cookie len 32
capture request header User-Agent len 32
http-request redirect scheme https if !{ ssl_fc }
forwardfor: ifmissing
healthz-port: "10253"
ssl-always-add-https: "true"
ssl-redirect: "false"
stats-port: "1936"
syslog-endpoint: localhost:514
timeout-server: 600s
timeout-server-fin: 600s
Ingress object:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: httpbin
spec:
rules:
- host: httpbin.mydomain
http:
paths:
- backend:
service:
name: httpbin
port:
number: 80
path: /
pathType: ImplementationSpecific
Non-working Service object:
apiVersion: v1
kind: Service
metadata:
name: httpbin
spec:
type: ExternalName
externalName: httpbin.org
Working Service object:
apiVersion: v1
kind: Service
metadata:
name: httpbin
spec:
type: ExternalName
externalName: httpbin.org
ports:
- port: 80
Hi thanks for bringing this missing feature back to our attention.
This is a missing implementation since the v0.8 refactor as stated here:
https://github.com/jcmoraisjr/haproxy-ingress/blob/b5853e1419467cee9873f94b5f4aa1748789f382/pkg/converters/utils/services.go#L117-L122
There are some parts of the code that relies on the port number, making this a bit difficult to be properly fixed. However I'll do my best to add it to the next v0.14 beta and, depending on the amount of code changed, cherry pick as well to the v0.13 branch.
Thanks, @jcmoraisjr! The context you provided is greatly appreciated 😄
Fixed in v0.14.0-beta.2
and merged to v0.13 as well, so next v0.13 will have this same fix. Closing.