-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add functions to query and validate minimum spec version #93
Conversation
06c2c9c
to
29d7a67
Compare
29d7a67
to
861e634
Compare
Wouldn't it be a more sustainable/easier to understand and also easier to maintain implementation to define a compatibility-check function for each valid version we support ? It would be enough if each of those functions would codify and check the extra conditions compared to the previous version, assuming the Spec passed verification of that (and consequently all previous functions). Then
Moreover, something like
|
@klihub I think I'm missing the implementation of The way I've been thinking about this was about adding fields and as such this can be seen as implementing, for example, a:
The issue with vaildation as you describe it (at least from my current point of view), is that older functions need to be updated with new fields with each modification. Rewriting the checks as
Which may be easier to understand than the current implementation. I can work to clean up the edits manipulation a little to. |
861e634
to
e2b48c2
Compare
@klihub I reworked this to match something like you suggested. Not sure if I'm still missing something though. I think we can still combine the |
Sorry, I omitted all the validating function details, because I didn't have time to find out what those really would be. But it looks to me that you got what I was after... even if my vague suggestion/idea was not well thought through (for instance I think I got it totally wrong that version check could/should be done from lowest to highest, requiring that all previous version checks succeed).
If we want to do automatic version-picking in case it is unspecified, then I think it probably would be easier to maintain (and understand) the code if manage to codify the version-specific requirements to per-version validation functions, something along the lines of what is being done here. |
41f16fa
to
72d742d
Compare
72d742d
to
5a76357
Compare
5a76357
to
9cace54
Compare
9cace54
to
e50884e
Compare
This change adds a function to get the minimum required version for a spec. This checks the fields of the spec and retuns the latest version for non-empty fields. For example, the `Mount.Type` field was added in v0.4.0 and the `DeviceNode.HostPath` field was added in v0.5.0. Signed-off-by: Evan Lezar <[email protected]>
Signed-off-by: Evan Lezar <[email protected]>
Signed-off-by: Evan Lezar <[email protected]>
Signed-off-by: Evan Lezar <[email protected]>
Signed-off-by: Evan Lezar <[email protected]>
e50884e
to
1a1203c
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.
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
This change adds support for determining the minimum spec version required for a specified spec. This allows a minimum version spec to be created if newer fields are not used.
Closes #91