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

Check ResolvedRefs condition in Gateway conformance tests #2247

Merged
merged 3 commits into from
Sep 21, 2023

Conversation

levikobi
Copy link
Member

What type of PR is this?

/kind test
/area conformance

What this PR does / why we need it:
Checks the ListenerConditionResolvedRefs value. This is needed to ensure that its value is always set, no matter if the ConditionStatus is true, or false.

Which issue(s) this PR fixes:

Fixes #1315

Does this PR introduce a user-facing change?:

None

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/test area/conformance cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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 Jul 28, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @levikobi. 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.

Copy link
Contributor

@michaelbeaumont michaelbeaumont left a comment

Choose a reason for hiding this comment

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

/lgtm !

@levikobi
Copy link
Member Author

/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 Jul 29, 2023
Copy link
Member

@Xunzhuo Xunzhuo left a comment

Choose a reason for hiding this comment

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

/lgtm thanks!

defer to others, make sure nowhere is missed.

@LiorLieberman
Copy link
Member

/cc

Copy link
Member

@LiorLieberman LiorLieberman left a comment

Choose a reason for hiding this comment

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

I might be missing something, but if are adding these conditions here and not changing https://github.com/kubernetes-sigs/gateway-api/blob/main/conformance/utils/kubernetes/helpers.go#L708-L711

It must say that either our tests fail now or this change will cause them to fail.

What am I missing?

@michaelbeaumont
Copy link
Contributor

michaelbeaumont commented Jul 31, 2023

I might be missing something, but if are adding these conditions here and not changing https://github.com/kubernetes-sigs/gateway-api/blob/main/conformance/utils/kubernetes/helpers.go#L708-L711

It must say that either our tests fail now or this change will cause them to fail.

What am I missing?

The check only asserts on conditions explicitly listed in the test, so whether existing or missing, the ResolvedRefs condition was ignored

@LiorLieberman
Copy link
Member

The check only asserts on conditions explicitly listed in the test, so whether existing or missing, the ResolvedRefs condition was ignored

But it looks like it compares the number of actual conditions vs the expected conditions before.
So if we add another condition the length should be different

@levikobi
Copy link
Member Author

The check only asserts on conditions explicitly listed in the test, so whether existing or missing, the ResolvedRefs condition was ignored

But it looks like it compares the number of actual conditions vs the expected conditions before. So if we add another condition the length should be different

Have a look at https://github.com/kubernetes-sigs/gateway-api/blob/main/conformance/utils/kubernetes/helpers.go#L721

Only if the number of expected conditions is larger than the actual the test will fail.
Up until now, the number of expected was lower, hence the tests passed.
Right now we are adding another condition, which should have already been in the actual conditions list (this is what the modification is verifying). So, len(actual) will equal len(expected) at most, and if not - the test should fail

@LiorLieberman
Copy link
Member

Right, thats what I was missing, long day ...😅

Thanks!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 31, 2023
@LiorLieberman
Copy link
Member

/assign @sunjayBhatia

Copy link
Member

@mlavacca mlavacca left a comment

Choose a reason for hiding this comment

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

Thanks for this PR @levikobi!

I think we should check that all the gateways used in the tests have actually set such a condition to true (Even the gateways used in the HTTPRoute tests). To do so, we could change this helper to check that the resolvedRefs is enforced as well.

@mlavacca
Copy link
Member

mlavacca commented Aug 2, 2023

/cc

@k8s-ci-robot k8s-ci-robot requested a review from mlavacca August 2, 2023 15:06
@shaneutt shaneutt added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 2, 2023
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 3, 2023
@levikobi
Copy link
Member Author

levikobi commented Aug 3, 2023

Thanks for this PR @levikobi!

I think we should check that all the gateways used in the tests have actually set such a condition to true (Even the gateways used in the HTTPRoute tests). To do so, we could change this helper to check that the resolvedRefs is enforced as well.

That's a great suggestion, thanks @mlavacca!

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 @levikobi!

// GatewayAndHTTPRoutesMustBeAccepted waits until:
// 1. The specified Gateway has an IP address assigned to it.
// 2. The route has a ParentRef referring to the Gateway.
// 3. All the gateway's listeners have the ListenerConditionResolvedRefs set to true.
Copy link
Member

Choose a reason for hiding this comment

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

Do we have any tests that currently expect ListenerConditionResolvedRefs to be false? Since this is such a wide-reaching change, I'm concerned we may break some implementations with this change. Have you run this test against any implementations?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we do have a bunch of tests that expect ListenerConditionResolvedRefs to be false:

I tested the changes against Kong's implementation and it works 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

@robscott I tried running it against Contour's implementation but got some errors. It didn't seem like a problem in the conformance though, but missing assignments of the ResolvedRefs.

Then I discovered @sunjayBhatia had already opened projectcontour/contour#5668 to address that 😅

Nevertheless I'm glad to hear that Kong and Kuma works.

Copy link
Member

@mlavacca mlavacca left a comment

Choose a reason for hiding this comment

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

Thanks @levikobi!

/approve

leaving the lgtm to @robscott to be sure his concern is addressed.

// GatewayAndHTTPRoutesMustBeAccepted waits until:
// 1. The specified Gateway has an IP address assigned to it.
// 2. The route has a ParentRef referring to the Gateway.
// 3. All the gateway's listeners have the ListenerConditionResolvedRefs set to true.
Copy link
Member

Choose a reason for hiding this comment

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

Yes, we do have a bunch of tests that expect ListenerConditionResolvedRefs to be false:

I tested the changes against Kong's implementation and it works 👍

Reason: "", // any reason
}

GatewayListenersMustHaveCondition(t, c, timeoutConfig, gw.NamespacedName, resolvedRefsCondition)
Copy link
Member

Choose a reason for hiding this comment

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

Since we are already adding the ResolvedRefs condition here, I think we should check all the positive-polarity conditions:

  • ResolvedRefs
  • Accepted
  • Programmed

Ideally, GatewayListenersMustHaveCondition should check the three above conditions to be set and true, before going on. I've created #2415 for this purpose, as it looks like a lack of consistency in our suite. We can address it in another PR, as it is a bit out of scope for this PR, but I wanted to highlight this aspect here as well.

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 21, 2023
@mlavacca
Copy link
Member

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 21, 2023
Copy link
Contributor

@michaelbeaumont michaelbeaumont left a comment

Choose a reason for hiding this comment

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

LGTM, passes with Kuma

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: levikobi, michaelbeaumont, mlavacca, Xunzhuo

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

@robscott
Copy link
Member

Thanks @levikobi!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 21, 2023
@k8s-ci-robot k8s-ci-robot merged commit 2457533 into kubernetes-sigs:main Sep 21, 2023
@levikobi levikobi deleted the conformance-1315 branch September 22, 2023 05:39
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. area/conformance cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/test 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. release-blocker MUST be completed to complete the milestone release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

conformance: always check ResolvedRefs condition in Gateway conformance tests
9 participants