Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gateway-api: Filter routes based on Section Name and port #27309

Merged
merged 2 commits into from Aug 15, 2023

Conversation

sayboras
Copy link
Member

@sayboras sayboras commented Aug 7, 2023

Description

Please refer to individual commit for more details.

This is to make sure that we are having a correct attached routes in gateway
status. The translation logic is already implemented such filters, but it
was overlooked in Gateway status.

For the below spec, the attached routes for both listeners was showing as 1,
the expected behavior should be 0 for http-non-attached listener, and 1 for
http listener. Similar scenario should be applied for port number.

```yaml
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
  name: sample
spec:
  gatewayClassName: cilium
  listeners:
    - name: http-unattached
      port: 8080
      protocol: HTTP
      allowedRoutes:
        kinds:
          - kind: HTTPRoute
        namespaces:
          from: All
    - name: http
      port: 80
      protocol: HTTP
      allowedRoutes:
        kinds:
          - kind: HTTPRoute
        namespaces:
          from: All
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: http-route-4
spec:
  parentRefs:
    - kind: Gateway
      name: sample
      sectionName: http
  rules:
    - backendRefs:
        - name: infra-backend-v1
          port: 8080
```

Signed-off-by: Tam Mach <tam.mach@cilium.io>
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Aug 7, 2023
@sayboras sayboras added release-note/bug This PR fixes an issue in a previous release of Cilium. area/servicemesh GH issues or PRs regarding servicemesh feature/k8s-gateway-api needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch and removed dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Aug 7, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in 1.14.1 Aug 7, 2023
@sayboras sayboras marked this pull request as ready for review August 7, 2023 05:15
@sayboras sayboras requested a review from a team as a code owner August 7, 2023 05:15
@sayboras sayboras requested a review from meyskens August 7, 2023 05:15
@sayboras
Copy link
Member Author

sayboras commented Aug 7, 2023

/test

Resource name in k8s cannot be longer than 63 character, so this commit
is to make sure that we don't have longer name due to cilium gateway prefix
(e.g. cilium-gateway-) for related resources.

```
2023-08-07T03:23:44.780547229Z level=error msg="Unable to create Service" controller=gateway error="Service \"cilium-gateway-gateway-with-two-listeners-and-one-attached-route\" is invalid: metadata.name: Invalid value: \"cilium-gateway-gateway-with-two-listeners-and-one-attached-route\": must be no more than 63 characters" resource=gateway-conformance-infra/gateway-with-two-listeners-and-one-attached-route subsys=gateway-controller
```

Signed-off-by: Tam Mach <tam.mach@cilium.io>
@sayboras sayboras force-pushed the tam/gateway-api-listener-matching branch from c0520bd to e4c4156 Compare August 9, 2023 13:08
@sayboras sayboras requested a review from aanm August 9, 2023 13:12
@sayboras
Copy link
Member Author

sayboras commented Aug 9, 2023

/test

@nebril nebril added this to Needs backport from main in 1.14.2 Aug 10, 2023
@nebril nebril removed this from Needs backport from main in 1.14.1 Aug 10, 2023
@sayboras
Copy link
Member Author

Reviews from required teams are in, merging this in.

@sayboras sayboras merged commit f70b7ed into cilium:main Aug 15, 2023
59 checks passed
@sayboras sayboras deleted the tam/gateway-api-listener-matching branch August 15, 2023 11:45
@tklauser tklauser mentioned this pull request Aug 22, 2023
22 tasks
@tklauser tklauser added backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. and removed needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch labels Aug 22, 2023
@joestringer joestringer added backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. and removed backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. labels Aug 25, 2023
@joestringer joestringer moved this from Needs backport from main to Backport done to v1.14 in 1.14.2 Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/servicemesh GH issues or PRs regarding servicemesh backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. feature/k8s-gateway-api release-note/bug This PR fixes an issue in a previous release of Cilium.
Projects
No open projects
1.14.2
Backport done to v1.14
Development

Successfully merging this pull request may close these issues.

None yet

5 participants