-
Notifications
You must be signed in to change notification settings - Fork 543
OCPBUGS-56725: Add max length validation for apiserver namedCertificates #2342
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
OCPBUGS-56725: Add max length validation for apiserver namedCertificates #2342
Conversation
Hello @enxebre! Some important instructions when contributing to openshift/api: |
@enxebre: This pull request references Jira Issue OCPBUGS-56725, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
/jira refresh |
@enxebre: This pull request references Jira Issue OCPBUGS-56725, which is valid. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira ([email protected]), skipping review request. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
config/v1/types_apiserver.go
Outdated
@@ -155,6 +155,7 @@ type APIServerServingCerts struct { | |||
// the defaultServingCertificate will be used. | |||
// +optional | |||
// +listType=atomic | |||
// +kubebuilder:validation:MaxItems=20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this is technically a breaking change because it is introducing a restriction that did not exist before.
We need to:
- Have insights into how many instances of this configuration exist where there are more than 20 items on both standalone OpenShift and HyperShift to better understand how many clusters may be impacted by this change.
- Understand what happens in the case that a cluster does have more than 20 items and they upgrade to a version where this new validation is added.
- For standalone OpenShift, we should be able to take advantage of ratcheting validation - we need to make sure we have testing in place to make sure the ratcheting behavior works as expected.
- IIRC, HyperShift cannot guarantee any ratcheting behavior until the minimum supported version of OpenShift is 4.18 (I think this is when the ratcheting behavior was added, but @JoelSpeed should be able to confirm)
Also, why was a maximum of 20 chosen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a test for ratcheting to the integration suite in this repo is also important, PTAL at how to do this in the README in the top level tests folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
20 is arbitrary, I changed to 100 so this change has no impact in practice.
We should be able to get some data from insights, I already started a thread on that but let's don't block this pr on it.
I just added a yaml for the ratcheting test (possibly not quite right yet) I'll be happy to address any feedback there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to get some data from insights, I already started a thread on that but let's don't block this pr on it.
Why should we not block the PR until we know whether or not this will impact at least the clusters we collect telemetry for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultimately this is just a mean to provide business value. There's no value / real use case for >100 entries (If someone is doing that, It would be actually good to force a discussion and help them). Not having this is actually resulting in degraded business value. So in this scenario I see the 100 as just a cosmetic impl detail and insights as an interesting exercise that should not prevent us from moving forward and providing business value.
In any case, I appreciate you bringing it up. Data from insights shows that max namedCertificates is 3 and max namedCertificates.Names is 6. Captured those queries within the jira for anyone curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting the insights. With those numbers in mind I think we can set a more reasonable limit here instead of just choosing something totally arbitrary that we may choose to decrease later. Decreasing the max limit is also a breaking change.
Maybe something like 32 and 64 is reasonable based on the insights data we have (and assuming that there is a reasonable case where these values make sense)? That is ~10x for each one, to give plenty of buffer room for customers that might need this scale, and keeps the pattern of doubling the namedCertificates.Names
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Some comments:
TL;DR: LGTM |
Ratcheting tests are not out of the scope of this PR. Before merging this PR we need to ensure that the ratcheting behavior works as expected. Please include them. |
fef7702
to
19cfc7f
Compare
19cfc7f
to
612fa13
Compare
- name: Should not error with an invalid persisted namedCertificates in spec | ||
initialCRDPatches: | ||
- op: remove | ||
path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/fieldWithNewMaxLength/maximum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path should map to the field with the newly added max length. fieldWithNewMaxLength
doesn't seem correct
initial: | | ||
apiVersion: config.openshift.io/v1 | ||
kind: APIServer | ||
spec: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything else here we can set in the spec? For ratcheting tests, we generally want to make sure that when the field was previously violating the new validation that we can still go and make valid modifications to other fields without having to update the now invalid field.
e625a1e
to
5fa236f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I've read correctly, the initial and updated are the same currently, would be better to check for an actual difference, otherwise this seems fine pending conversation about existing usage
additionalCORSAllowedOrigins: | ||
- "foo" | ||
- "bar" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this from initial so that the updated is actually different from the initial?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, see if I get one green then I'll add several test cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a bunch of test cases now for creation, update and ratcheting, PTAL.
191ad2c
to
151c85c
Compare
151c85c
to
1354b60
Compare
@JoelSpeed @everettraven please let me know if there's more feedback I should address |
- "63.kas.same-names-entry.com" | ||
- "64.kas.same-names-entry.com" | ||
- "65.kas.same-names-entry.com" | ||
onUpdate: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't have onUpdate
more than once in the file
- "63.kas.same-names-entry.com" | ||
- "64.kas.same-names-entry.com" | ||
expectedError: "spec.servingCerts.namedCertificates: Too many: 33: must have at most 32 items" | ||
onCreate: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should only have onCreate
once in the file, it's a list
- "63.kas.same-names-entry.com" | ||
- "64.kas.same-names-entry.com" | ||
- "65.kas.same-names-entry.com" | ||
expectedError: "names: Too many: 65: must have at most 64 items" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. missing final new line character
1354b60
to
c825d5e
Compare
The addition of maxLength check is a fix itself. In addition this will help hcp validations to contain cel validation budget
c825d5e
to
83157e5
Compare
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: enxebre, everettraven, JoelSpeed 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 |
1 similar comment
/retest-required |
@enxebre: The following test failed, say
Full PR test history. Your PR dashboard. 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-sigs/prow repository. I understand the commands that are listed here. |
b29811a
into
openshift:master
@enxebre: Jira Issue OCPBUGS-56725: Some pull requests linked via external trackers have merged: The following pull requests linked via external trackers have not merged:
These pull request must merge or be unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with Jira Issue OCPBUGS-56725 has not been moved to the MODIFIED state. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
[ART PR BUILD NOTIFIER] Distgit: ose-cluster-config-api |
The addition of maxLength check is a fix itself. In addition this will help hcp validations to contain cel validation budget