Skip to content

Commit 29adeed

Browse files
authored
Merge pull request kubernetes#3266 from cici37/celBeta
KEP-2876: Promote CRD Validation Expression Language to Beta
2 parents 4f0c45b + fcb5a90 commit 29adeed

File tree

3 files changed

+97
-18
lines changed

3 files changed

+97
-18
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
kep-number: 2558
1+
kep-number: 2876
22
alpha:
33
approver: "@deads2k"
4+
beta:
5+
approver: "@deads2k"

keps/sig-api-machinery/2876-crd-validation-expression-language/README.md

Lines changed: 91 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
- [Request lifetime Bound](#request-lifetime-bound)
3838
- [Bounds](#bounds)
3939
- [Test Plan](#test-plan)
40+
- [Prerequisite testing updates](#prerequisite-testing-updates)
41+
- [Unit tests](#unit-tests)
42+
- [Integration tests](#integration-tests)
43+
- [e2e tests](#e2e-tests)
4044
- [Graduation Criteria](#graduation-criteria)
4145
- [Alpha](#alpha)
4246
- [Beta](#beta)
@@ -1013,10 +1017,83 @@ testing and benchmarking.
10131017

10141018
### Test Plan
10151019

1016-
We will extend both the unit test suite and the integration test suite to cover the CRD validation rule described in this KEP.
1020+
<!--
1021+
**Note:** *Not required until targeted at a release.*
1022+
The goal is to ensure that we don't accept enhancements with inadequate testing.
1023+
1024+
All code is expected to have adequate tests (eventually with coverage
1025+
expectations). Please adhere to the [Kubernetes testing guidelines][testing-guidelines]
1026+
when drafting this test plan.
1027+
1028+
[testing-guidelines]: https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
1029+
-->
1030+
1031+
[x] I/we understand the owners of the involved components may require updates to
1032+
existing tests to make this code solid enough prior to committing the changes necessary
1033+
to implement this enhancement.
1034+
1035+
##### Prerequisite testing updates
1036+
1037+
<!--
1038+
Based on reviewers feedback describe what additional tests need to be added prior
1039+
implementing this enhancement to ensure the enhancements have also solid foundations.
1040+
-->
1041+
N/A
1042+
1043+
##### Unit tests
1044+
1045+
<!--
1046+
In principle every added code should have complete unit test coverage, so providing
1047+
the exact set of tests will not bring additional value.
1048+
However, if complete unit test coverage is not possible, explain the reason of it
1049+
together with explanation why this is acceptable.
1050+
-->
1051+
1052+
<!--
1053+
Additionally, for Alpha try to enumerate the core package you will be touching
1054+
to implement this enhancement and provide the current unit coverage for those
1055+
in the form of:
1056+
- <package>: <date> - <current test coverage>
1057+
The data can be easily read from:
1058+
https://testgrid.k8s.io/sig-testing-canaries#ci-kubernetes-coverage-unit
1059+
1060+
This can inform certain test coverage improvements that we want to do before
1061+
extending the production code to implement this enhancement.
1062+
-->
1063+
The unit tests are added together with the added code:
1064+
1065+
- `k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel`: `May 23rd, 2022` - `79.6%`
1066+
- `k8s.io/apiextensions-apiserver/third_party/forked/celopenapi/model`: `May 23rd, 2022` - `76.5%`
1067+
- `k8s.io/apiextensions-apiserver/pkg/registry/customresourcedefinition`: `May 23rd, 2022` - `13.1%`
1068+
- `k8s.io/apiextensions-apiserver/pkg/apiserver/validation`: `May 23rd, 2022` - `87.2%`
10171069

1018-
We also intend to explore what testing utilities could be added to make it easier for 3rd party
1019-
developers to test their validation rules.
1070+
##### Integration tests
1071+
1072+
<!--
1073+
This question should be filled when targeting a release.
1074+
For Alpha, describe what tests will be added to ensure proper quality of the enhancement.
1075+
1076+
For Beta and GA, add links to added tests together with links to k8s-triage for those tests:
1077+
https://storage.googleapis.com/k8s-triage/index.html
1078+
-->
1079+
The integration test has been added to test the crd expression validation with feature gate on/off:
1080+
1081+
- test/integration/apiserver/crd_validation_expressions_test.go
1082+
1083+
##### e2e tests
1084+
1085+
<!--
1086+
This question should be filled when targeting a release.
1087+
For Alpha, describe what tests will be added to ensure proper quality of the enhancement.
1088+
1089+
For Beta and GA, add links to added tests together with links to k8s-triage for those tests:
1090+
https://storage.googleapis.com/k8s-triage/index.html
1091+
1092+
We expect no non-infra related flakes in the last month as a GA graduation criteria.
1093+
-->
1094+
We plan to add e2e test under api-machinery for crd expression validation:
1095+
1096+
- test/e2e/apimachinery/crd_expressions_validation.go: https://storage.googleapis.com/k8s-triage/index.html?sig=api-machinery
10201097

10211098
### Graduation Criteria
10221099

@@ -1035,6 +1112,8 @@ developers to test their validation rules.
10351112
- [Reduce noise of invalid data messages reported from cel.UnstructuredToVal](https://github.com/kubernetes/kubernetes/issues/106440)
10361113
- [Benchmark cel.UnstructuredToVal and optimize away repeated wrapper object construction](https://github.com/kubernetes/kubernetes/issues/106438)
10371114
- Demonstrate adoption and successful feature usage in the community
1115+
- Optimization on super-linear complexity growth
1116+
- Adding metric of the latency of CEL evaluation for CRD evaluation
10381117

10391118
## Production Readiness Review Questionnaire
10401119

@@ -1168,30 +1247,27 @@ combination of large, compact, complex vs. similar combinations using existing v
11681247
<!--
11691248
This section must be completed when targeting beta to a release.
11701249
1250+
For GA, this section is required: approvers should be able to confirm the
1251+
previous answers based on experience in the field.
1252+
11711253
The Troubleshooting section currently serves the `Playbook` role. We may consider
11721254
splitting it into a dedicated `Playbook` document (potentially with some monitoring
11731255
details). For now, we leave it here.
11741256
-->
11751257

11761258
###### How does this feature react if the API server and/or etcd is unavailable?
11771259

1260+
Same as without the feature.
1261+
11781262
###### What are other known failure modes?
11791263

1180-
<!--
1181-
For each of them, fill in the following information by copying the below template:
1182-
- [Failure mode brief description]
1183-
- Detection: How can it be detected via metrics? Stated another way:
1184-
how can an operator troubleshoot without logging into a master or worker node?
1185-
- Mitigations: What can be done to stop the bleeding, especially for already
1186-
running user workloads?
1187-
- Diagnostics: What are the useful log messages and their required logging
1188-
levels that could help debug the issue?
1189-
Not required until feature graduated to beta.
1190-
- Testing: Are there any tests for failure mode? If not, describe why.
1191-
-->
1264+
N/A
11921265

11931266
###### What steps should be taken if SLOs are not being met to determine the problem?
11941267

1268+
1. The feature can be disabled by setting the feature-gate to false if the performance impact of it is not tolerable.
1269+
2. Try to run the rules separately to see which rule is slow
1270+
3. Remove the problematic rules or update the rules to meet the requirements
11951271

11961272
## Graduation Criteria
11971273

keps/sig-api-machinery/2876-crd-validation-expression-language/kep.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@ see-also:
2929
- "/keps/sig-api-machinery/95-custom-resource-definitions"
3030

3131
# The target maturity stage in the current dev cycle for this KEP.
32-
stage: alpha
32+
stage: beta
3333

3434
# The most recent milestone for which work toward delivery of this KEP has been
3535
# done. This can be the current (upcoming) milestone, if it is being actively
3636
# worked on.
37-
latest-milestone: "v1.23"
37+
latest-milestone: "v1.25"
3838

3939
# The milestone at which this feature was, or is targeted to be, at each stage.
4040
milestone:
4141
alpha: "v1.23"
42+
beta: "v1.25"
4243

4344
# The following PRR answers are required at alpha release
4445
# List the feature gate name and the components for which it must be enabled

0 commit comments

Comments
 (0)