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

conformance: add test for disallowed route kind binding #1130

Merged

Conversation

skriss
Copy link
Contributor

@skriss skriss commented Apr 28, 2022

What type of PR is this?
conformance test (looks like we need a new kind)

What this PR does / why we need it:
Adds a test for a route that has a parentRef to a
Gateway whose listeners don't allow the route type.

This test largely follows the pattern from "invalid cross namespace", except it creates a new Gateway that disallows HTTPRoutes.

Which issue(s) this PR fixes:
Updates #1104.

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 28, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @skriss. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 28, 2022
Comment on lines +1 to +18
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
name: tlsroutes-only
namespace: gateway-conformance-infra
spec:
gatewayClassName: {GATEWAY_CLASS_NAME}
listeners:
- name: tls
port: 443
protocol: TLS
tls:
mode: Passthrough
allowedRoutes:
namespaces:
from: Same
kinds:
- kind: TLSRoute
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per #1104 (comment) it may be problematic for some implementations not to have the Gateway definitions in the base manifests, need to sort out the pattern here.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

For reference, the alternative here would be to add more Gateways to our base set of resources instead. That would work, but could become difficult to maintain.

Copy link
Member

Choose a reason for hiding this comment

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

Discussed in community meeting on Monday in reference to this and #1137 (comment). Apparently this ended up being a non issue for implementations now.

Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @skriss!

This LGTM, but want to get feedback from other implementers on this one.

conformance/tests/httproute-disallowed-kind.yaml Outdated Show resolved Hide resolved
Comment on lines +47 to +53
// TODO: Determine if this is actually what we want. It is likely
// preferable to have status set with some kind of warning/error message
// but that is also unlikely to be universally achievable.
t.Run("Route should not have Parents set in status", func(t *testing.T) {
parents := []v1alpha2.RouteParentStatus{}
kubernetes.HTTPRouteMustHaveParents(t, suite.Client, routeName, parents, true, 60)
})
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to block on this since other tests are already doing the same thing, but created #1135 to track this.

Comment on lines +1 to +18
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
name: tlsroutes-only
namespace: gateway-conformance-infra
spec:
gatewayClassName: {GATEWAY_CLASS_NAME}
listeners:
- name: tls
port: 443
protocol: TLS
tls:
mode: Passthrough
allowedRoutes:
namespaces:
from: Same
kinds:
- kind: TLSRoute
Copy link
Member

Choose a reason for hiding this comment

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

For reference, the alternative here would be to add more Gateways to our base set of resources instead. That would work, but could become difficult to maintain.

Adds a test for a route that has a parentRef to a
Gateway whose listeners don't allow the route type.

Updates kubernetes-sigs#1104.

Signed-off-by: Steve Kriss <krisss@vmware.com>
@skriss skriss force-pushed the conf-invalid-route-kind branch from c4ba064 to 19ff2b8 Compare May 2, 2022 17:58
@robscott
Copy link
Member

robscott commented May 4, 2022

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 4, 2022
@robscott
Copy link
Member

robscott commented May 4, 2022

Thanks @skriss!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 4, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: robscott, skriss

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 4, 2022
@k8s-ci-robot k8s-ci-robot merged commit 642bf7f into kubernetes-sigs:master May 4, 2022
@skriss skriss deleted the conf-invalid-route-kind branch June 8, 2022 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants