Skip to content

Interaction between TLS config on HTTPRoute and Gateway #577

@mark-church

Description

@mark-church

After trying to implement TLS in the GKE Gateway controller it raised some questions around what the interaction should be between TLS config in the HTTPRoute and the Gateway. Let's say I have the following Gateway:

kind: Gateway
apiVersion: networking.x-k8s.io/v1alpha1
metadata:
  name: tls-gateway
spec:
  gatewayClassName: acme-lb
  listeners:
  - protocol: HTTPS
    port: 443
    tls:
      certificateRef:
        kind: Secret
        group: core
        name: gateway-cert
      routeOverride:
        certificate: Allow
    routes:
      kind: HTTPRoute
---
kind: HTTPRoute
apiVersion: networking.x-k8s.io/v1alpha1
metadata:
  name: foo1
spec:
  hostnames:
  - "foo.example.com"
  tls:
    certificateRef:
      kind: Secret
      group: core
      name: foo-cert-1
  rules:
  - matches:
    - path:
        type: Prefix
        value: /path1
    forwardTo:
    - serviceName: foo-svc-1
      port: 8080
---
kind: HTTPRoute
apiVersion: networking.x-k8s.io/v1alpha1
metadata:
  name: foo2
spec:
  hostnames:
  - "foo.example.com"
  tls:
    certificateRef:
      kind: Secret
      group: core
      name: foo-cert-2
  rules:
  - matches:
    - path:
        type: Prefix
        value: /path2
    forwardTo:
    - serviceName: foo-svc-2
      port: 8080

This config raises a couple gray areas:

  • How does a Gateway certificate without a hostname specified, interact with HTTPRoutes that have certificates and hostnames? Does it become like a default certificate that terminates any HTTPRoutes on the listener that don't have certificates? Or is TLS only supported on the Gateway OR HTTPRoute but not both?
  • What if the Gateway does have TLS and a hostname specified? Would that TLS config take precedence over a Route with the same hostname and a TLS config? Or would the HTTPRoute take precedence?
  • How should conflicts be handled between two HTTPRoutes with different certificates but overlapping hostname? Is this simply a bad practice and should result in error?
  • If an HTTPRoute does error due to cert conflict, does the HTTPRoute fail-closed and the Route doesn't get applied at all? This is probably implementation specific but just wondering.

cc @hbagdi @robscott @bowei

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions