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

Support eventual consistency in conformance tests #1080

Conversation

nathancoleman
Copy link
Contributor

What type of PR is this?

/kind bug
(best effort ^, is there a better option?)

What this PR does / why we need it:
We discussed in the sig meeting recently that "accepted" (or "ready" in the future) can only really indicate that the controller has synced all necessary configuration and that routes will begin working "soon".

In order for the conformance tests to support this, they must accept that HTTP requests to new routes may fail for some period of time but should become eventually consistent.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 29, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @nathancoleman. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 29, 2022
@nathancoleman nathancoleman changed the title Support eventually consistency in conformance tests Support eventual consistency in conformance tests Mar 29, 2022
@nathancoleman nathancoleman marked this pull request as ready for review March 29, 2022 21:50
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 29, 2022
@k8s-ci-robot k8s-ci-robot requested review from hbagdi and jpeach March 29, 2022 21:51
@evankanderson
Copy link
Contributor

Any chance that we could instead require a conservative Ready status for the HttpRoute, rather than expecting each client to build in eventual consistency handling?

I ask because making the Gateway API eventually consistent (rather than conservatively Ready) means that every development team writing an end-to-end test through the Gateway API will need to add this logic to their tests and potentially have to debug the "was it a Gateway-induced eventual consistency failure or an application-level failure" when their tests fail or time out. As an end-user developer writing tests, being able to distinguish between "the Gateway controller didn't finish" and "my application fails for 30s at startup" is pretty useful.

@nathancoleman
Copy link
Contributor Author

nathancoleman commented Mar 29, 2022

Hi @evankanderson ! There was some discussion about adding a Ready status to the HTTPRoute, and it sounds like that will be coming in the near term; however, I believe even then, things are expected to be eventually consistent due to the way these underlying systems work.

The context from the discussion at yesterday's meeting might be helpful. The recording is up on YouTube here (linked to appropriate timestamp) and the meeting notes are available here.

Copy link
Contributor

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

FYI I've been able to run the conformance tests using this PR against Contour's implementation successfully, whereas the tests in master where flaky for us. Thanks!

return true
}, maxConsistencyPeriodPerRequest, 1*time.Second, "error making request, never got expected status")

// Once we've made a successful request and gotten a response with the
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry to nitpick this a lot... a bit worried about the logic here. Typically what I have seen is that config changes will go from "all old config" to "mix of old and new" before arriving at "new config". So if we assert that once we see the 'new' state its immediately always 'new', we may see issues.

For example, if we have 2 pods implementing the gateway and 1 gets the new config first.

Here is how the Istio logic for this works: https://github.com/istio/istio/blob/30a866fdb5ad65eccde3dafe21d19f455addbd72/pkg/test/util/retry/retry.go#L182.

Basically we test that we get a success N times in a row -- but if we fail part way through the check we continue on retrying.

Also a bit of nitpick, but I am not sure we need the consistency_check_%d to show up in the test result? Doing the above would make that pretty hard to retain anyways

Copy link
Member

Choose a reason for hiding this comment

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

I agree with the logic suggested here by @howardjohn. Maybe a fairly low timeout like 30 seconds to get 3 consecutive successful requests would work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Not nitpicking IMO @howardjohn ! This makes a lot of sense and will help us avoid similar issues when we make the number of pods implementing the gateway configurable beyond 1 in the near future.

Copy link
Contributor Author

@nathancoleman nathancoleman Apr 1, 2022

Choose a reason for hiding this comment

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

@howardjohn I've pushed some updates to handle intermittent success in the style of what you linked. Let me know what ya think!

You can see an example run w/ log output under Run tests here.

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 for the work on this @nathancoleman! Agree with John's suggestion but otherwise this LGTM.

return true
}, maxConsistencyPeriodPerRequest, 1*time.Second, "error making request, never got expected status")

// Once we've made a successful request and gotten a response with the
Copy link
Member

Choose a reason for hiding this comment

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

I agree with the logic suggested here by @howardjohn. Maybe a fairly low timeout like 30 seconds to get 3 consecutive successful requests would work?

@robscott
Copy link
Member

robscott commented Apr 1, 2022

Any chance that we could instead require a conservative Ready status for the HttpRoute, rather than expecting each client to build in eventual consistency handling?

@evankanderson I really wish that was possible. That was my original intent here, but unfortunately I think it was a bit too optimistic. Many (maybe most) of the implementations of this API simply don't have a way to know when the config they've written has actually been picked up and implemented. If there are good ways around this, I'm very open to alternatives, because I agree that a reliable "ready" condition on Routes would be more helpful than a condition that indicated that config had been updated and should be ready to use soon.

@robscott
Copy link
Member

robscott commented Apr 1, 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 Apr 1, 2022
@evankanderson
Copy link
Contributor

Two thoughts:

  1. Does it make sense to call this condition Accepted or Programmed rather than Ready to make the distinction clearer to users?
  2. Conservative here could include adding a 30s delay after Accepted, assuming that's something like 2.5 stddev beyond the mean.

@nathancoleman
Copy link
Contributor Author

@evankanderson @robscott I believe that future status additions for HTTPRoute -- "ready" vs. "accepted" vs. "programmed", etc., none of which exists today -- would be a good topic for the next kube-sig meeting on Monday, April 4.

Those evolutions in the Gateway API are only tangentially related to this PR. My goal with this change is just to unblock several implementations that are unable to run the conformance tests successfully today.

Would it make sense to you guys to move this discussion over to that venue? I think that would allow for more participation as well.

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 @nathancoleman! A few more tiny nits but otherwise this LGTM.

conformance/utils/http/http.go Outdated Show resolved Hide resolved
conformance/utils/http/http.go Outdated Show resolved Hide resolved
conformance/utils/http/http.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 5, 2022
@robscott
Copy link
Member

robscott commented Apr 5, 2022

Thanks @nathancoleman!

/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 Apr 5, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nathancoleman, 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 Apr 5, 2022
@k8s-ci-robot k8s-ci-robot merged commit df0cc90 into kubernetes-sigs:master Apr 5, 2022
@nathancoleman nathancoleman deleted the eventually-consistent-conformance branch April 5, 2022 17:47
@nathancoleman nathancoleman restored the eventually-consistent-conformance branch April 5, 2022 17:47
@nathancoleman nathancoleman deleted the eventually-consistent-conformance branch April 5, 2022 18:05
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. kind/bug Categorizes issue or PR as related to a bug. 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.

6 participants