37
37
- [ Request lifetime Bound] ( #request-lifetime-bound )
38
38
- [ Bounds] ( #bounds )
39
39
- [ 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 )
40
44
- [ Graduation Criteria] ( #graduation-criteria )
41
45
- [ Alpha] ( #alpha )
42
46
- [ Beta] ( #beta )
@@ -1013,10 +1017,83 @@ testing and benchmarking.
1013
1017
1014
1018
### Test Plan
1015
1019
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% `
1017
1069
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
1020
1097
1021
1098
### Graduation Criteria
1022
1099
@@ -1035,6 +1112,8 @@ developers to test their validation rules.
1035
1112
- [ Reduce noise of invalid data messages reported from cel.UnstructuredToVal] ( https://github.com/kubernetes/kubernetes/issues/106440 )
1036
1113
- [ Benchmark cel.UnstructuredToVal and optimize away repeated wrapper object construction] ( https://github.com/kubernetes/kubernetes/issues/106438 )
1037
1114
- 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
1038
1117
1039
1118
## Production Readiness Review Questionnaire
1040
1119
@@ -1168,30 +1247,27 @@ combination of large, compact, complex vs. similar combinations using existing v
1168
1247
<!--
1169
1248
This section must be completed when targeting beta to a release.
1170
1249
1250
+ For GA, this section is required: approvers should be able to confirm the
1251
+ previous answers based on experience in the field.
1252
+
1171
1253
The Troubleshooting section currently serves the `Playbook` role. We may consider
1172
1254
splitting it into a dedicated `Playbook` document (potentially with some monitoring
1173
1255
details). For now, we leave it here.
1174
1256
-->
1175
1257
1176
1258
###### How does this feature react if the API server and/or etcd is unavailable?
1177
1259
1260
+ Same as without the feature.
1261
+
1178
1262
###### What are other known failure modes?
1179
1263
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
1192
1265
1193
1266
###### What steps should be taken if SLOs are not being met to determine the problem?
1194
1267
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
1195
1271
1196
1272
## Graduation Criteria
1197
1273
0 commit comments