KEP-5468: Invariant Testing - #5514
Conversation
5d434e5 to
7d568c8
Compare
7d568c8 to
f44f65a
Compare
f44f65a to
0c1d1f2
Compare
| # worked on. | ||
| latest-milestone: "v1.35" | ||
|
|
||
| # The milestone at which this feature was, or is targeted to be, at each stage. |
There was a problem hiding this comment.
will update this pending above discussion about the alpha/beta/stable lifecycle not really making sense for this KEP https://github.com/kubernetes/enhancements/pull/5514/files#r2323831978
| - sig-api-machinery | ||
| status: provisional | ||
| creation-date: 2025-09-04 | ||
| reviewers: |
There was a problem hiding this comment.
|
There is a draft of the implementation in kubernetes/kubernetes#133394, though I intend to capture all necessary details here. Mostly here we want to formalize what sort of "run after all other tests" is permitted and how we're approaching that. |
|
/assign |
|
LGTM there are some open comments, but we have been discussing this for a long time and I think describes pretty well the overall idea, of course when moving to execution we may find some unexpected issues that we need to reconsider, but I think is important to get this early in the cycle to get feedback before the large features start to get merged and avoid to get perfection in the KEP |
|
/lgtm |
|
/hold for other comments to be resolved |
|
This is failing because we don't have the PRR approver metadata yet. Will reach out when we sort api-machinery, I posted in their slack last week, reached out to a lead today. |
pohly
left a comment
There was a problem hiding this comment.
Looks good overall, some nits and suggestions.
| @@ -0,0 +1,970 @@ | |||
| <!-- | |||
| **Note:** When your KEP is complete, all of these comment blocks should be removed. | |||
There was a problem hiding this comment.
Nit: you could make the README.md easier to review if you dropped comments which are no longer needed.
There was a problem hiding this comment.
/shrug, this is an artifact of the KEP process, this KEP is not complete.
that these instructions are super verbose .... is another matter
There was a problem hiding this comment.
You can keep those which are still relevant. But below you have filled out entire sections with "not applicable" while keeping the comments. Those comments could be removed because the section is complete.
As it stands now, the README.md is mostly obsolete comments with very little actual content.
| > | ||
| > If this failed in a periodic CI, please file a bug and assign the owners. | ||
| > | ||
| > Owners for this metric: <github-handles> |
There was a problem hiding this comment.
| > Owners for this metric: <github-handles> | |
| > Owners for this metric: <github-handles and/or SIG> |
There was a problem hiding this comment.
I think we really need a list of specific owners of the feature, assigning SIGs to resolve bugs does not work for most SIGs. Maybe a few SIGs are extremely well staffed, but in general we need to require that a list of multiple owners is responsible for a feature.
There was a problem hiding this comment.
I'm worried that we'll end up with situations where individual owners have moved on. Whom should a problem be escalated to when that happens?
Listing the SIG would also be useful for /sig ... in the issue that we ask contributors to file.
Let's make that <github-handles and SIG(s)>?
There was a problem hiding this comment.
That makes sense, I just think they need to not be interchangeable and that a list of owners should be required. But also documenting the SIG makes sense.
Especially when this is first introduced for a feature there should be some specific owners with context that can help ensure there are not issues. Similar to the underlying metrics (which currently list a single owner and SIG).
I also think we should consider as we approve these requiring some minimum number of owners, but I don't know what to set it to and I do want to make sure we start testing out the initial invariant early in the cycle, 1.35 will be a short cycle and we also may risk holding up declarative validation if we wind up having to revert this test.
I have pretty high confidence in the current implementation but ... unknown unknowns until we actually start soaking it.
There was a problem hiding this comment.
So do you want to add the "and SIG" or "and SIG(s)". If not, then I can LGTM.
There was a problem hiding this comment.
Never mind, it's not ready for other reasons (PRR), as you noted in #5514 (comment).
There was a problem hiding this comment.
I added the SIG (though we may still revisit the exact formatting/language), and I took a stab at PRR by way of just marking it direct to stable ...
There was a problem hiding this comment.
Last time I did one of these "non-production" KEPs the process was a bit different ...
… production changes and has no graduation criteria
|
/cc @jpbetz |
| These tests can be labeled appropriately, allowing the existing test selection | ||
| mechanisms to select / skip them. | ||
|
|
||
| We can then use `ginkgo.ReportAfterSuite` to inspect which, if any, of these |
There was a problem hiding this comment.
ReportAfterSuite seems to be used mostly for custom reports, so it's not designed to run more tests.
In OpenShift we use two test annotations: [Early] and [Late] and split tests in the suite, running them in necessary order. Have this alternative been considered?
There was a problem hiding this comment.
ReportAfterSuite seems to be used mostly for custom reports, so it's not designed to run more tests.
Yeah, we're not running actual tests here though, we're only fetching metrics (which we already have an option to do after the test suite) and validating some of them, if not for the metric fetch part, it fits as a custom report. The metrics fetch part is cheap and quick anyhow so 🤷♂️
We explicitly do not wish to permit anything more expensive than this, or any mutable actions, or any intra-test ordering, only checking cluster status after-suite and reporting if it's invalid.
IMHO as a general rule, tests that need to be ordered are a huge anti-pattern especially in shared cluster e2e environment, and between the SIG Testing leads we've agreed to not permit this.
We actually considered doing this entirely outside of ginkgo just as part of TestMain() and having an env opt in/out, but leveraging the test selection logic to decide if it should run simplifies getting it enabled in the right jobs.
In OpenShift we use two test annotations: [Early] and [Late] and split tests in the suite, running them in necessary order. Have this alternative been considered?
This is an interesting option, but it would be more involved for our case, since we are using ginkgo's stock runner / scheduling and otherwise have no reason to rewrite this, we plan to keep randomized order for all tests other than this special invariant check.
I think it would make sense if we planned to have more tests with special ordering, but we don't.
There was a problem hiding this comment.
I really prefer to avoid to customize ginkgo, since that will add more surface to cover and to maintain, and we got a lot of troubles because of that when we had to migrate from v1 to v2 ... this is pretty simple and decoupled
There was a problem hiding this comment.
The metrics fetch part is cheap and quick anyhow so 🤷♂️
I wonder if there is a way to limit the code to stay cheap and quick?
we plan to keep randomized order for all tests other than this special invariant check
Sure, the test list can be additionally shuffled to ensure tests don't depend on special order. I acknowledge it may be using advanced ginkgo features, but it doesn't seem like a significant ginkgo modification to me.
In any case, this idea is worth adding to the alternative list imo
There was a problem hiding this comment.
I think this is more of an implementation detail than an alternative to the overall KEP, the alternatives section of a KEP is meant to cover approaches versus more detailed implementation details. See the listed alternatives we have currently. (e.g., instead of having a test case we could collect this metric and monitor it out of band)
There was a problem hiding this comment.
I do agree this is worth considering.
|
/lgtm I think we have an overall agreement on how to proceed, and the proposed implementation is encapsulated enough that we can always revisit without causing much problems, but at one point we need to execute and start to find the unknown unknowns ... 🤞 |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aojea, BenTheElder, jpbetz, pohly The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold-cancel |
|
/hold cancel |
/cc @pohly @aojea @richabanker