-
Notifications
You must be signed in to change notification settings - Fork 267
Add regular expression (regex) pattern support #930
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
Comments
Hi @chlunde! This is a great feature request and something I think we should be able to accommodate fairly easily. I'll see what I can do about getting this into our next sprint or two. |
Issues go stale after 90d of inactivity. |
/lifecycle frozen |
One concern I have with this feature request is that with stricter validation of field patterns we lose flexibility when/if an underlying AWS API changes its pattern or a mismatch is introduced some other way. If an ACK CRD and underlying AWS API’s pattern became out of sync we’d need to re-generate the ACK controller and publish a new version before users could resolve the mismatch. Note, this doesn’t necessarily require a breaking change on the AWS API side as the new pattern could be a superset of the old pattern. We could update our API Reference docs and CRD descriptions to include this information with less potential downside in the event of a mismatch. Would that help address some of your concerns? |
/remove-lifecycle frozen |
Issue #, if available: [930](aws-controllers-k8s/community#930) Description of changes: - Read smithy.api#pattern from aws-sdk-go-v2 JSON models - Add Regex pattern to documentation string if exists - Add test to verify pattern string is added when present By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Is your feature request related to a problem?
When creating a CR, only the documentation and types are available. Sometimes the type is string and the documentation is brief or non-existent, for example for a role of type string. The api-2.json files often contains a validation pattern for this case, but the author of a CR does not have that information available, and will have to create the resource in a cluster and observe the result to check if the format is correct.
Describe the solution you'd like
Consider adding kubebuilder Pattern annotations. In order to do this we would have to expose this information in aws-sdk-for-go v1, that seems trivial:
Finally we can add it to the template, similar to
The result
Example (I have not tested this in a cluster, so the syntax might not be exactly right):
Describe alternatives you've considered
Keeping it as it is? 🤔
Things to consider
We would also have to understand what possible differences between the regex language in the JSON files are, and what the API server validates, and possibly convert (or drop) some patterns. We should also consider if introducing validations will cause other problems, and possibly an escape hatch in
generator-config.yaml
to ignore the pattern for a specific attribute?Related issue: crossplane-contrib/provider-aws#572
cc @muvaf
The text was updated successfully, but these errors were encountered: