-
Notifications
You must be signed in to change notification settings - Fork 227
Rename .spec.image.ociClaim.ref
to .spec.image.oci
for simplicity
#311
Conversation
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.
Thanks! LGTM overall, but a couple of nits
pkg/apis/ignite/types.go
Outdated
} | ||
|
||
type VMKernelSpec struct { | ||
OCIClaim OCIImageClaim `json:"ociClaim"` | ||
CmdLine string `json:"cmdLine,omitempty"` | ||
OCIRef meta.OCIImageRef `json:"oci"` |
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.
Generally, you always want to match the field name with the JSON tag to avoid so-called "OpenAPI violations".
Let's change this name to avoid those?
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.
Changed in 9d6ab9e.
return err | ||
} | ||
|
||
// Convert between the old and new OCI reference format |
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.
maybe create a Convert_v1alpha1_OCIClaim_To_ignite_OCI(in *OCIClaim, out *meta.OCIImageRef) error
and vice-versa which you can call in all these higher-context functions?
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.
Done in 9d6ab9e.
} | ||
|
||
// Convert between the old and new OCI reference format | ||
out.OCIRef = in.OCIClaim.Ref |
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'd comment specifically here that in.OCIClaim.Type
is ignored on purpose
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.
Added that comment to Convert_v1alpha1_OCIClaim_To_ignite_OCI
in 9d6ab9e.
// OCIImageClaim defines a claim for importing an OCI image | ||
type OCIImageClaim struct { | ||
// Type defines how the image should be imported | ||
Type ImageSourceType `json:"type"` |
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.
Also remove the ImageSourceType
enum
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.
Removed in 9d6ab9e.
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.
Also removed GetImageSourceTypes
as it's redundant.
pkg/openapi/violations.txt
Outdated
@@ -6,6 +6,10 @@ API rule violation: list_type_missing,github.com/weaveworks/ignite/pkg/apis/igni | |||
API rule violation: list_type_missing,github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha2,VMStorageSpec,VolumeMounts | |||
API rule violation: list_type_missing,github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha2,VMStorageSpec,Volumes | |||
API rule violation: names_match,github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1,VMSpec,CPUs | |||
API rule violation: names_match,github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha2,ImageSpec,OCIRef |
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.
Please name the field just OCI
and these violations will go away.
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.
Done in 9d6ab9e.
Feedback addressed and CI is green, merging 👍 |
oci
.spec.image.ociClaim.ref
to .spec.image.oci
for simplicity
This changes the spec for images, kernels and VMs from
to
according to #309. The change basically replaces the old
ociClaim
format in all places it was used. This PR also implements validation and conversion for the newoci
field.Fixes #309.
cc @luxas