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

internal/dag: Process HTTPRoute.Spec.Gateways #3618

Merged
merged 7 commits into from
Apr 28, 2021

Conversation

stevesloka
Copy link
Member

Implement support for HTTPRoutes.Spec.Gateways to allow an HTTPRoute to define how it
binds to a Gateway via "All", "SameNamespace", or "FromList".

Fixes #3615

Signed-off-by: Steve Sloka steve@stevesloka.com

@stevesloka stevesloka added this to the 1.15.0 milestone Apr 26, 2021
@stevesloka stevesloka requested a review from a team as a code owner April 26, 2021 20:12
@stevesloka stevesloka requested review from skriss and sunjayBhatia and removed request for a team April 26, 2021 20:12
@codecov
Copy link

codecov bot commented Apr 26, 2021

Codecov Report

Merging #3618 (429f77e) into main (4fbf655) will increase coverage by 0.09%.
The diff coverage is 100.00%.

❗ Current head 429f77e differs from pull request most recent head 7585290. Consider uploading reports for the commit 7585290 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3618      +/-   ##
==========================================
+ Coverage   76.71%   76.81%   +0.09%     
==========================================
  Files         100      100              
  Lines        7142     7159      +17     
==========================================
+ Hits         5479     5499      +20     
+ Misses       1542     1539       -3     
  Partials      121      121              
Impacted Files Coverage Δ
internal/status/httproutestatus.go 35.00% <ø> (ø)
internal/dag/gatewayapi_processor.go 91.26% <100.00%> (+0.70%) ⬆️
internal/k8s/log.go 69.56% <0.00%> (+6.52%) ⬆️

@stevesloka
Copy link
Member Author

bah these integration tests, will look into why they are failing in CI. Works on my machine. ™️

Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

This is lookin great, thanks Steve.

Do we need to mention anything about the default value of spec.gateways? I can't remember how it plays into these interactions.

@stevesloka
Copy link
Member Author

Do we need to mention anything about the default value of spec.gateways? I can't remember how it plays into these interactions

The default value is SameNamespace, so users would need to modify their HTTPRoutes with All or FromList to work in namespaces outside the one in which the Gateway resides.

Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

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

couple nits but otherwise looks good


---

apiVersion: apps/v1
Copy link
Member

Choose a reason for hiding this comment

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

probably not needed since we're moving to the go framework, but maybe we shouldve made the fixture able to set a namespace as well as name of the resource

if selMatches && nsMatches {
// If all the match criteria for this HTTPRoute match the Gateway, then add
// the route to the set of matchingRoutes.
if selMatches && nsMatches && p.gatewayMatches(route) {
Copy link
Member

Choose a reason for hiding this comment

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

the RouteGateways type mentions:

RouteGateways defines which Gateways will be able to use a route. If this field results in preventing the selection of a Route by a Gateway, an “Admitted” condition with a status of false must be set for the Gateway on that Route.

Seems like we should set status of "Admitted=false" on Routes that are selected by a Gateway but the Route does not "allow" the Gateway to select it

See https://gateway-api.sigs.k8s.io/references/spec/#networking.x-k8s.io/v1alpha1.RouteGateways

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm good catch. We'll need to see if they are defined now to know if they matched by default vs matching the selectors. Let me write up some more tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok just pushed a new commit @sunjayBhatia. =)

stevesloka and others added 7 commits April 27, 2021 14:13
Implement support for HTTPRoutes.Spec.Gateways to allow an HTTPRoute to define how it
binds to a Gateway via "All", "SameNamespace", or "FromList".

Fixes projectcontour#3615

Signed-off-by: Steve Sloka <steve@stevesloka.com>
Signed-off-by: Steve Sloka <slokas@vmware.com>
Signed-off-by: Steve Sloka <slokas@vmware.com>
Signed-off-by: Steve Sloka <slokas@vmware.com>
Signed-off-by: Steve Sloka <slokas@vmware.com>
Signed-off-by: Steve Sloka <slokas@vmware.com>
't set status to Admitted: false

Signed-off-by: Steve Sloka <slokas@vmware.com>
Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

LGTM, nice.

@stevesloka stevesloka merged commit c99b342 into projectcontour:main Apr 28, 2021
@stevesloka stevesloka deleted the gatewayRef branch April 28, 2021 14:38
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.

Gateway API: HTTPRoute spec.gateways is not cared
4 participants