-
Notifications
You must be signed in to change notification settings - Fork 552
OCPBUGS-31522: Warn and allow CRD upgrade if validation fails but new CRD specifies a conversion strategy #3209
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-31522: Warn and allow CRD upgrade if validation fails but new CRD specifies a conversion strategy #3209
Conversation
…ersion strategy Signed-off-by: everettraven <[email protected]>
4fc01b4
to
43c7bd9
Compare
/jira refresh |
Signed-off-by: everettraven <[email protected]>
if crd.Spec.Conversion == nil || crd.Spec.Conversion.Strategy == apiextensionsv1.NoneConverter || !errors.As(err, vErr) { | ||
return fmt.Errorf("error validating existing CRs against new CRD's schema for %q: %w", step.Resource.Name, err) |
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.
I think we need to explicitly check for Webhook Converter to switch to the warn logic. If another converter type is added in the future, I think that should be an error, not a warning. If it turns out that new converter type is something we can't evaluate we could opt that into the warning logic at that time.
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 be done in 209d783
// is an error related to validation, warn that validation failed but that we are trusting | ||
// that the conversion strategy specified by the author will successfully convert to a format | ||
// that passes validation and allow the upgrade to continue | ||
b.logger.Warnf("trusting conversion strategy detected in new CRD, but failed validation of existing CRs against new CRD's schema for %q: %s", |
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.
Two things:
- This is likely something that needs some pretty descriptive messaging. Can you try to explain a bit more about why this isn't being treated as an error.
- I think we need to use an EventRecorder to emit the warning as a kubernetes event against the InstallPlan object.
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.
(But keep this. Logging to the olm-operator log is helpful too)
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 be done in 209d783
… installplan Signed-off-by: everettraven <[email protected]>
warnTempl := `validation of existing CRs against new CRD's schema failed, but a webhook conversion strategy was specified. | ||
allowing the CRD upgrade to occur as we can't run the webhook, but is assumed that it will successfully convert existing CRs | ||
to a format that would have passed validation. | ||
CRD: %q | ||
Validation Error: %s | ||
` |
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.
warnTempl := `validation of existing CRs against new CRD's schema failed, but a webhook conversion strategy was specified. | |
allowing the CRD upgrade to occur as we can't run the webhook, but is assumed that it will successfully convert existing CRs | |
to a format that would have passed validation. | |
CRD: %q | |
Validation Error: %s | |
` | |
warnTempl := `Validation of existing CRs against the new CRD's schema failed, but a webhook conversion strategy was specified in the new CRD. The new webhook will only start after the bundle is upgraded, so we must assume that it will successfully convert existing CRs to a format that would have passed validation. | |
CRD: %q | |
Validation Error: %s | |
` |
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 in 91b7f5f
Signed-off-by: everettraven <[email protected]>
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!
c3e1774
Description of the change:
Motivation for the change:
Architectural changes:
Testing remarks:
Reviewer Checklist
/doc
[FLAKE]
are truly flaky and have an issue