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

ReferenceGrant deletion doesn't cause losing the grant for the reference #3289

Closed
1 task done
mlavacca opened this issue Dec 20, 2022 · 3 comments
Closed
1 task done
Assignees
Labels
area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API bug Something isn't working
Milestone

Comments

@mlavacca
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

If a resource has the cross-namespace reference granted by a specific ReferenceGrant, deleting that ReferenceGrant does not cause losing such a grant.

Expected Behavior

When a resource has a cross-namespace reference granted by a ReferenceGrant, deleting such a grant should cause that reference failing and the following should be happening:

  • the resource status should be updated to reflect the current status
  • the kong rules should be updated accordingly

Steps To Reproduce

1. create an HTTPRoute that references a service in another namespace
2. grant that reference through a `ReferenceGrant`
3. delete the `ReferenceGrant`
4. the cross-namespace reference is still valid even after the `ReferenceGrant` deletion

Kong Ingress Controller version

2.7

Kubernetes version

No response

Anything else?

No response

@mlavacca mlavacca added bug Something isn't working area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API labels Dec 20, 2022
@pmalek
Copy link
Member

pmalek commented Mar 17, 2023

I've looked at this and it seems to work just fine.

I've added an exemplar manifest in #3758 which shows how one can use the ReferenceGrant. After removing the ReferenceGrant from that manifest the Gateway returns: {"message":"no existing backendRef provided"} with a status code of 500. Not sure if that's intended. It seems to be:

// In the context of the gateway API conformance tests, if there is no service for the backend,
// the response must have a status code of 500. Since The default behavior of Kong is returning 503
// if there is no backend for a service, we inject a plugin that terminates all requests with 500
// as status code
if len(service.Backends) == 0 && len(backendRefs) != 0 {
if service.Plugins == nil {
service.Plugins = make([]kong.Plugin, 0)
}
service.Plugins = append(service.Plugins, kong.Plugin{
Name: kong.String("request-termination"),
Config: kong.Configuration{
"status_code": 500,
"message": "no existing backendRef provided",
},
})
}

Having said that: do we consider this closed?

I can observe that route in question still has all the conditions set as if it was able to route to the requested backendRef.

@mlavacca are you aware of any particular requirements for route's status when it cannot route traffic to the designated backendRef or are we good to close this?

@pmalek
Copy link
Member

pmalek commented Mar 17, 2023

Ok I seem I got it: in order to get the type: ResolvedRefs condition with reason: RefNotPermitted to status: "False" we need to enqueue the routes when reference grants change. This will be done in #3759.

@pmalek
Copy link
Member

pmalek commented Apr 4, 2023

#3759 already landed in v2.9

@pmalek pmalek closed this as completed Apr 4, 2023
@pmalek pmalek added this to the KIC v2.9.0 milestone Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants