-
Notifications
You must be signed in to change notification settings - Fork 472
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
conformance against invalid ReferenceGrants in HTTPRoute and TLSRoute #2076
conformance against invalid ReferenceGrants in HTTPRoute and TLSRoute #2076
Conversation
Welcome @meyskens! |
Hi @meyskens. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
da1c97d
to
af206d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing from here:
func SetupTimeoutConfig(timeoutConfig *TimeoutConfig) { |
if timeoutConfig.TLSRouteMustHaveCondition == 0 {
timeoutConfig.TLSRouteMustHaveCondition = defaultTimeoutConfig.TLSRouteMustHaveCondition
}
conformance/base/manifests.yaml
Outdated
@@ -300,6 +300,75 @@ spec: | |||
--- | |||
apiVersion: v1 | |||
kind: Namespace | |||
metadata: | |||
name: gateway-conformance-tls-backend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be reuse the existing -app-backend
instead of having to create a new namespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was doubting to do to that but not entirely too sure about it so I chose to make a separate namespace to make clear boundaries. Happy to revert it and use the app namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think one of the maintainers may chime in here but I believe we've tried to limit the number of namespaces/resources the tests create to streamline things a bit 👍🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @sunjayBhatia, where possible I think we should reuse the same resources instead of creating new ones for specific use cases.
(with the timeout change, these pass against Contour) |
This adds a test comparable to the one for Gateway checking if ReferenceGrants are not incorrectly accepted. Signed-off-by: Maartje Eyskens <maartje.eyskens@isovalent.com>
af206d2
to
6c7fe97
Compare
/ok-to-test |
conformance/base/manifests.yaml
Outdated
@@ -300,6 +300,75 @@ spec: | |||
--- | |||
apiVersion: v1 | |||
kind: Namespace | |||
metadata: | |||
name: gateway-conformance-tls-backend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @sunjayBhatia, where possible I think we should reuse the same resources instead of creating new ones for specific use cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:+1 I like that you created many ReferenceGrant
s, each with a possible misconfiguration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is really great, nicely done @meyskens!
d404197
to
b5c82e5
Compare
b5c82e5
to
fb72173
Compare
fb72173
to
75a582b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @meyskens! Other than @sunjayBhatia's comment, this mostly LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is really great, nicely done @meyskens!
75a582b
to
3a12feb
Compare
/retest |
|
||
kubernetes.GatewayAndTLSRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) | ||
|
||
t.Run("TLSRoute with BackendRef in another namespace and no ReferenceGrant covering the Service has a ResolvedRefs Condition with status False and Reason RefNotPermitted", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
realizing this test only specifies the conditions set on the route with no valid referencegrant to make the backendref in it valid, which is valuable
however, it seems the language on what to do with an invalid backendref needs some more specificity, particularly what "reject" means since this is a "must" statement:
gateway-api/apis/v1alpha2/tlsroute_types.go
Lines 104 to 108 in a5ede12
// sent. If unspecified or invalid (refers to a non-existent resource or | |
// a Service with no endpoints), the rule performs no forwarding; if no | |
// filters are specified that would result in a response being sent, the | |
// underlying implementation must actively reject request attempts to this | |
// backend, by rejecting the connection or returning a 500 status code. |
I think we could use a follow up to this PR that clarifies that language (and possibly removes the HTTP 500 reference) and adds coverage to this test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow up #2153
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, tests both pass with Contour
one comment here that needs a follow up issue: https://github.com/kubernetes-sigs/gateway-api/pull/2076/files#r1245405876
This checks ReferenceGrant rules for TLSRoute against accepting an invalid ReferenceGrant for the backend service. Signed-off-by: Maartje Eyskens <maartje.eyskens@isovalent.com>
3a12feb
to
e3c6ccc
Compare
Thanks @meyskens! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: meyskens, robscott, sunjayBhatia The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind test
/area conformance
What this PR does / why we need it:
This PR adds two new conformance tests to test that invalid ReferenceGrants are not getting programmed as well as checking that they are indeed not. It does this check for both HTTPRoutes and TLSRoutes. The list of invalid ReferenceGrants is based on the test in https://github.com/kubernetes-sigs/gateway-api/blob/main/conformance/tests/gateway-secret-invalid-reference-grant.go
Which issue(s) this PR fixes:
Fixes #2075
Does this PR introduce a user-facing change?: