projectcontour / contour

Contour is a Kubernetes ingress controller using Envoy proxy.
https://projectcontour.io
Apache License 2.0
3.7k stars 671 forks source link

Service AppProtocol should allow IANA standard service names like "http", "https" #6560

Closed kghost closed 2 weeks ago

kghost commented 1 month ago

What steps did you take and what happened:

Create a service with appProtocol:

apiVersion: v1
kind: Service
metadata:
  name: hello-service
spec:
  ports:
  - appProtocol: https
    name: https
    port: 443
    protocol: TCP
    targetPort: https

Create a httproute with pointing to to service:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: hello-route
spec:
  parentRefs:
    - group: gateway.networking.k8s.io
      kind: Gateway
      namespace: projectcontour
      name: contour
      sectionName: https
  hostnames:
    - example.com
  rules:
    - backendRefs:
      - kind: Service
        name: hello-service
        port: 80

What did you expect to happen:

The route is installed successfully, but got an error:

    - lastTransitionTime: "2024-07-17T09:36:00Z"
      message: 'AppProtocol: "http" is unsupported'
      observedGeneration: 3
      reason: UnsupportedProtocol
      status: "False"
      type: ResolvedRefs

According to the spec https://kubernetes.io/docs/concepts/services-networking/service/#application-protocol

appProtocol can be IANA service names listed here: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml

These should be all valid:

Anything else you would like to add:

Environment:

github-actions[bot] commented 1 month ago

Hey @kghost! Thanks for opening your first issue. We appreciate your contribution and welcome you to our community! We are glad to have you here and to have your input on Contour. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

lubronzhan commented 1 month ago

~~Yeah it's not supported yet https://github.com/projectcontour/contour/issues/2431 Working on it~~ Oh this is for gateway api httproute, then it's probably a bug https://github.com/projectcontour/contour/blob/main/changelogs/CHANGELOG-v1.28.0.md#gateway-api-backend-protocol-selection

kghost commented 1 month ago

According to the changelog

The accepted values are kubernetes.io/h2c and kubernetes.io/ws

This is too restrictive and doesn't compliance with the spec.