Repository navigation
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
I'm trying to create a Gateway that combines both HTTPS and TLS listeners to proxy external services, but I'm met with
Skipped a listener block: [spec.listeners[1].tls.certificateRef: Required value: listener has no certificateRefs, spec.listeners[1].tls.mode: Unsupported value: "Passthrough": supported values: "Terminate"]
from the Gateway resource when trying to add a TLS listener. From what I gather from the Gateway API documentation I should be able to combine these two listener types.
The Gateway I'm trying to create is
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: gateway
namespace: gateway
annotations:
cert-manager.io/issuer: cloudflare-issuer
spec:
gatewayClassName: cilium
infrastructure:
annotations:
io.cilium/lb-ipam-ips: 192.168.1.221
listeners:
- name: https-gateway
protocol: HTTPS
port: 443
hostname: "*.<DOMAIN>"
tls:
certificateRefs:
- kind: Secret
name: cert-stonegarden
allowedRoutes:
namespaces:
from: All
- name: proxmox-tls-passthrough
protocol: TLS
port: 443
hostname: "proxmox.<DOMAIN>"
tls:
mode: Passthrough
allowedRoutes:
namespaces:
from: All
with the following Routes
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: home-assistant
namespace: home-assistant
spec:
parentRefs:
- name: gateway
namespace: gateway
hostnames:
- "home-assistant.<DOMAIN>"
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: home-assistant
port: 80
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: TLSRoute
metadata:
name: proxmox
namespace: proxmox
spec:
parentRefs:
- name: gateway
namespace: gateway
hostnames:
- "proxmox.<DOMAIN>"
rules:
- backendRefs:
- name: proxmox
port: 443
each having their own Service and EndpointSlice resources.
As a workaround I'm able to create two separate Gateways, one with each listener. This works, but I then have two different Gateways and consequently two IPs to maintain.
Cilium Version
1.51.1
Kernel Version
6.1.0-20-amd64
Kubernetes Version
v1.29.3
Regression
No response
Sysdump
No response
Relevant log output
No response
Anything else?
I encountered this issue trying to proxy both Home Assistant OS and Proxmox as external services through a Gateway.
If it's any help I've described it further in a blog post here.
Cilium Users Document
- Are you a user of Cilium? Please add yourself to the Users doc
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
[-]Gateway: Combining listeners with HTTPS and TLS listeners[/-][+]Gateway: Combining listeners with HTTPS and TLS protocol[/+]youngnick commentedon May 3, 2024
HI @vehagn, can you give some more info about where you got that initial error from? I had a look at this and couldn't reproduce it with Cilium 1.15.1 and either Kubernetes 1.24 or 1.29. I created a similar Gateway and it was accepted by Cilium okay:
vehagn commentedon May 3, 2024
Thank you for looking into this @youngnick!
Seeing that you couldn't reproduce the error made me investigate further.
I now think the issue lies with Cert-manager and not Cilium.
I tried to create the same
Gatewayas you did and did not experience any issues before I addedI got the error from the events for the Gateway. I initially only looked at them in the Argo CD Web GUI, but looking again now using
kubectl describeI see that the source iscert-manager-gateway-shim.I'll report the issue over at the Cert-manager repo and think this issue can be closed.
vehagn commentedon May 4, 2024
I did some further digging and it appears that I'm able to connect a
TLSRouteto aGatewaywhich only supportsHTTPRoutekinds. I would expect this to throw some kind of error.The involved resources are
(Notice I've removed the TLS-listener)
Looking at the status of both they appear to have successfully linked
❯ kubectl -n test get tlsroute test -oyaml | yq '.status'❯ kubectl -n gateway get gateway test -oyaml | yq '.status'Ignoring the
Invalid CertificateRefmessages theTLSRouteappears to have been successfully accepted by the Gateway.Is this the intended behaviour, or should I open a new issue?
youngnick commentedon May 6, 2024
Thanks for the follow-up @vehagn. Yeah, we shouldn't really support this by the Gateway API spec, although it will work in Cilium's implementation now.
We actually configure all the TLS or HTTPS rules on a single Listener with SNI matching first, then HTTP termination if it's a terminated HTTP connection (which TLSRoute is not). Because of this, the config you've given will actually work with Cilium, even though by the Gateway API spec it should not be allowed.
If you could open another issue and mention me, I would really appreciate it. I suspect we may need to add some upstream conformance tests of the Protocol -> Route type mappings visible on https://gateway-api.sigs.k8s.io/guides/tls/ (although I don't know if we've documented that requirement anywhere else, sigh).
But all of that is for me to worry about upstream - having a clear issue here will help me discuss this with the upstream community.
Thanks again for your follow-up!
(Once you've created the new issue, I can link it here and close this one out.)
youngnick commentedon Jun 18, 2024
Covered by #32371.