Repository navigation
Add ClusterBundle API validations - #664
Conversation
2137d0c to
fea6353
Compare
fea6353 to
ca2ff33
Compare
ca2ff33 to
3c2cf26
Compare
SgtCoDFish
left a comment
There was a problem hiding this comment.
Few questions - I don't see any reason this can't merge but maybe there are some extra tests which would be helpful?
| Entry("when password set", trustmanagerapi.PKCS12{Password: ptr.To("my-password")}), | ||
| Entry("when profile set", trustmanagerapi.PKCS12{Profile: trustmanagerapi.Modern2023PKCS12Profile}), |
There was a problem hiding this comment.
question: are we missing tests for when profile != PKCS12 but "password" is provided? I might be missing something
There was a problem hiding this comment.
Good catch! It was there, but a bit hidden. I have now refactored the test fixture to make it clearer.
3c2cf26 to
7e45a53
Compare
Signed-off-by: Erik Godding Boye <[email protected]>
7e45a53 to
91952a7
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: SgtCoDFish 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 |
This PR adds all API validations for the new
CLusterBundleAPI that I was able to implement without adding a validating webhook. I have added a new "integration" test, based on envtest (simplified control plane), to test these validations. I suggested introducing CEL validations in #475, but theBundleAPI wasn't really ready for it, as the expressions became way too complex. But in the new API, I think the CEL expressions are simple enough.....Label selectors cannot currently be validated using CEL expressions (or OpenAPI schema) and require a webhook for validation. This is probably true for labels/annotations, even if Kubernetes is now providing the format CEL library that might be used for this. I am personally inclined to NOT add a webhook just for this, as it will hopefully be available in CEL later on. And no webhooks implies that trust-manager will not have cert-manager as a prerequisite.
The added tests detected a few minor bugs/improvements in the API:
sources, as theincludeDefaultCAshas moved out of thesourcesarray field. (And also theinLineCAsfield, which we are planning to deprecate.)inLineCAsfield had the wrong init-case in the JSON serialization marker, which is now fixed.