-
Notifications
You must be signed in to change notification settings - Fork 66
Re-add the v1alpha1 API and implement conversion code #213
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
Conversation
@amisevsk curious as to why we're adding this and the conversion back when we didnt release during v1alpha1 :) |
@maysunfaisal Because the Web Terminal Operator is released (you can grab it on |
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.
Good job. Nothing meaningful to add )
It was pretty craftily to use yaml marshaling to reduce our code for converting, as we see it's fast enough to proceed with.
125fbca
to
1cafdd7
Compare
Rebased on master to resolve a conflict with #211 |
6946ab9
to
88e8f94
Compare
Fixed a rare test flake when gofuzz would generate a |
In order to use v1alpha2 with conversion from v1alpha1, we need to use the current (open) PR in devfile/api that combines the API versions and implements conversion. This commit updates go.mod and related files to point to the head of devfile/api#213 Signed-off-by: Angel Misevski <[email protected]>
As suggested by @davidfestal, I've updated conversion to use json as an intermediate representation, since the yaml package we use converts between yaml and json as an intermediate step. |
79cdf01
to
050e283
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.
Approved, but you will have to rebase the PR on master since I merged PR #214, so that endpoint attributes should be updated from string[string]string
to Attributes
.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: amisevsk, davidfestal, JPinkney, sleshchenko The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Copied from commit 9e2280a Signed-off-by: Angel Misevski <[email protected]>
Projects bootstrapped by the current version of kubebuilder depend on a .AddToScheme method being available. Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
050e283
to
00a3487
Compare
New changes are detected. LGTM label has been removed. |
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Add functions to correctly generate devworkspaces (respecting oneOf requirements) Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
When converting between v1alpha1 and v1alpha2, use the json serialization instead of the yaml serialization, since we only need to serialize and deserialize. The yaml package converts to/from json as an intermediate step. Signed-off-by: Angel Misevski <[email protected]>
* Add conversion functions for going from map[string]string to attributes.Attributes * Implement conversion of command attributes for Commands * Adapt tests to handle new incompatibility (parent commands cannot have attributes) Signed-off-by: Angel Misevski <[email protected]>
00a3487
to
7ef3a7b
Compare
Rebased on master to include changes from #214 I had to write some additional conversion code, since #214 moves attributes on commands up a level (from e.g. In the general case, no changes were needed for converting attributes in other cases. |
Merging this PR as it's been two weeks; if any further issues are brought forward I'll fix them separately. |
🎉 |
This PR should be reviewed commit-by-commit
What does this PR do?
v1alpha1
API (this tag) to the current repov1alpha2
andv1alpha1
as much as possible (see below) according to the standard k8s spec (doc)v1alpha2
is defined as the hub and the storage version.v1alpha1
.Note that the general k8s requirement is that all CRD versions are safely round-trippable, meaning we can freely convert between them with no loss of information. This is not possible for
DevWorkspaces
due to some removals inv1alpha2
(e.g. removing custom commands and components from parents). I've added a few fields to thev1alpha1
spec where appropriate, so that we're mostly able to safely convertv1alpha2 -> v1alpha1 -> v1alpha2
without issue (the exception issparseCheckoutDirs
onProjects
)The general approach in this PR is to rely on yaml marshalling and unmarshalling. Otherwise a huge amount of code is required. Attempting to use
conversion-gen
results in an auto-generated file that's 2500 lines long, and still doesn't implement the bulk of the conversion.Is your PR tested? Consider putting some instruction how to test your changes
This PR includes tests where the general structure is to fuzz a
v1alpha1
struct, convert itv1alpha1 -> v1alpha2 -> v1alpha1
and check that it is unchanged.I've also included a simple benchmark for conversion. Using a mostly-filled devworkspace, conversion takes around
8ms5ms on my machine.To test the code, use
To run the benchmark,
Additional Info
Summary of additions to
v1alpha1
in this PR:memoryLimit
fromContainer
components. (c.f. clean up the extra memoryLimit defined in containerComponent #175) -- the duplication actually breaks deserializationKeyed
implementation toCustomComponent
StarterProjects
toParent
With the additions above, the differences between
v1alpha1
andv1alpha2
areComponents
,Commands
, etc.Custom
Components are removed fromPlugin
components andParent
Custom
Commands are removed fromPlugin
components andParent
.Projects
is significantly changed:Parent
sparseCheckoutDir
is moved a level up and converted to a list. Since withv1alpha2
, we can have multipleclonePath
andsparseCheckoutDir
are removed;subDir
is added. For compatibility, I usesubDir
to hold the value ofsparseCheckoutDir
.A summary of differences can be found in this diff