Skip to content

[Gateway API 1.2.0] Add gateway name label#4333

Closed
zhaohuabing wants to merge 8 commits intoenvoyproxy:mainfrom
zhaohuabing:gateway-label
Closed

[Gateway API 1.2.0] Add gateway name label#4333
zhaohuabing wants to merge 8 commits intoenvoyproxy:mainfrom
zhaohuabing:gateway-label

Conversation

@zhaohuabing
Copy link
Copy Markdown
Member

@zhaohuabing zhaohuabing commented Sep 25, 2024

Implement the Gateway name label pfart of GEP-1762: In Cluster Gateway Deployments

MUST label all generated resources (Service, Deployment, etc) with gateway.networking.k8s.io/gateway-name: my-gateway (where my-gateway is the name of the Gateway resource).

This PR only covers the gateway name label requirement in the GEP-1762.

Please note that this label has not been added to the generated resources of the merged gateway.

Implement: #4330

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing requested a review from a team as a code owner September 25, 2024 13:45
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing marked this pull request as draft September 25, 2024 13:48
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.98%. Comparing base (14830c7) to head (f9a6381).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4333      +/-   ##
==========================================
+ Coverage   65.96%   65.98%   +0.01%     
==========================================
  Files         197      197              
  Lines       23959    23971      +12     
==========================================
+ Hits        15805    15817      +12     
  Misses       7027     7027              
  Partials     1127     1127              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

labels:
gateway.envoyproxy.io/owning-gateway-name: eg
gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway-system
gateway.networking.k8s.io/gateway-name: eg
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EG differs from the GEP in two ways

  • label name gateway.envoyproxy.io/owning-gateway-name
  • generated resource is in the same ns as the Gateway

this warrants a bigger discussion, lets bring this up in the community meeting next week

Copy link
Copy Markdown
Member Author

@zhaohuabing zhaohuabing Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR only adds the required label gateway.envoyproxy.io/owning-gateway-name. It's compatible with the current EG implementation.

The existing gateway.envoyproxy.io/owning-gateway-name is reserved for compatibility reasons. This label has been used as a selector to filter out services and deployments related to a Gateway.

metadata:
labels:
gateway.envoyproxy.io/owning-gatewayclass: envoy-gateway-class
gateway.networking.k8s.io/gateway-name: gateway-1,gateway-2
Copy link
Copy Markdown
Member Author

@zhaohuabing zhaohuabing Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All gateway names are concatenated and stored in a single label if mergeGateways is enabled.
Probably not the best way to do this, should revisit this and come up with a better solution upstream.

This is tracked in kubernetes-sigs/gateway-api#3365

@zhaohuabing zhaohuabing marked this pull request as ready for review September 27, 2024 03:46
@zhaohuabing zhaohuabing requested a review from arkodg September 27, 2024 03:48
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Sep 27, 2024

Apart from passing the conformance test, how does the end user benefit from this change ?

@zhaohuabing
Copy link
Copy Markdown
Member Author

Apart from passing the conformance test, how does the end user benefit from this change ?

No, but we could replace the existing gateway.envoyproxy.io/owning-gateway-name with this one in the next release.

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Sep 27, 2024

I suggest waiting until kubernetes-sigs/gateway-api#3366 is resolved which in indirectly related to the name of the label

@zhaohuabing zhaohuabing marked this pull request as draft September 27, 2024 06:14
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
@adrianmace
Copy link
Copy Markdown

Hello folks 👋🏻 It looks like kubernetes-sigs/gateway-api#3366 is closed now, so I'd like this to be re-visited.

how does the end user benefit from this change ?

I currently run multiple Gateway API implementations (Cilium & Envoy Gateway). I would like to select Service resources that are associated with any gateway. Per the Gateway API specification, I should be able to get resources using the following:

kubectl get --all-namespaces service --selector 'gateway.networking.k8s.io/gateway-name'

But currently, this only returns Service resources associated with Cilium.

The real-world impact of this is I cannot configure a serviceMutatorWebhookConfig.objectSelector.matchExpressions value in the AWS Load Balancer Controller, where my goal is for this controller to only handle Gateway-related Services.

Q: Can this PR as currently defined be revisited?

cc: @arkodg @zhaohuabing

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Jul 3, 2025

@adrianmace this label will be available in v1.5 (end July) only for gateway namespace mode https://gateway.envoyproxy.io/docs/tasks/operations/gateway-namespace-mode/

for the default mode you'd have to use --selector=gateway.envoyproxy.io/owning-gateway-namespace=<>,gateway.envoyproxy.io/owning-gateway-name=<>

@adrianmace
Copy link
Copy Markdown

@arkodg thank you for the fast response.

Unfortunately we do not want to use Gateway Namespace Mode (due to us wanting to provide a centralised gateway capability for a multi-tenant cluster, and since that feature is in Alpha).

Do you have plans to bring this label to the default mode in order to fully conform to GEP-1762?

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Jul 3, 2025

@adrianmace EG conforms to GEP-1762 only in gateway namespace mode, in the default mode all proxy fleets run in the controller namespace envoy-gateway-system , so name is not enough, we also need the namespace label

@adrianmace
Copy link
Copy Markdown

With this in mind, I would love for at least this label to be merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants