Version fields are currently treated as a simple optional string (pointer). Kubebuilder offers markers for validating strings with regular expressions. If the version field is used, we usually expect it to be a semver (+ the leading v maybe? cc @ncdc).
/milestone v0.3.0
/kind feature
/priority important-longterm
/area api
Hi @vincepri,
The semver pattern allows an optional leading v. FWIW, Go modules requires it, but the semver spec doesn't. As you said, there is a Kubernetes package for parsing semvers.
I was more thinking about using a regex with // +kubebuilder:validation:Pattern marker as described in https://book.kubebuilder.io/reference/markers/crd-validation.html
Sure. I was simply pointing to the package as a reference for the patterns that were deemed suitable by the k/k community as there are both strict and relaxed.
It will be important to not exclude versions that are currently being used today.
Since we haven't enforced it, I'm not sure that the versions that have been used conform to semver. @aaroniscode
@detiber are you aware of any specific values that might break?
I am not, which is why I tagged in @aaroniscode, @codenrhoden might have additional context here as well.
cc @imikushin
I've used a version based on the VMware binaries like "v1.15.3+vmware.1". We'd want to make sure that doesn't break.
v1.15.3+vmware.1 is a valid semver and is parsable. We spent a lot of time debating how to format the version for our builds.
While the above is true, funny enough, you can鈥檛 use two + chars with the k/k parsing library. I have a list of odd restrictions written somewhere. Will find it
Yeah, I think I filed that issue 馃槃 or was at least involved.
I see version strings like v1.15.3+vmware.1.20-guest.3.15 in my current work.
/help
@ncdc:
This request has been marked as needing help from a contributor.
Please ensure the request meets the requirements listed here.
If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.
In response to this:
/help
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/test-infra repository.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
/lifecycle frozen
I'm gonna close this out for now given that now we have webhooks and we can make sure the versions are valid semver there
/close
@vincepri: Closing this issue.
In response to this:
I'm gonna close this out for now given that now we have webhooks and we can make sure the versions are valid semver there
/close
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/test-infra repository.
Most helpful comment
v1.15.3+vmware.1is a valid semver and is parsable. We spent a lot of time debating how to format the version for our builds.