Skip to content

Commit

Permalink
Edit sources for task-generated YAMLs
Browse files Browse the repository at this point in the history
Signed-off-by: Max Chervov <[email protected]>
  • Loading branch information
maxinsky committed Jan 14, 2025
1 parent 15de849 commit 651c25e
Show file tree
Hide file tree
Showing 8 changed files with 215 additions and 214 deletions.
52 changes: 26 additions & 26 deletions api/core/v1alpha2/cluster_virtual_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ const (
ClusterVirtualImageResource = "clustervirtualimages"
)

// Describes a virtual disk image that can be used as a data source for new `VirtualDisks` or an installation image (iso) to be mounted in `Virtuals` directly. This resource type is available for all namespaces in the cluster.
// Describes a virtual disk image that can be used as a data source for new VirtualDisks or an installation image (iso) to be mounted in VirtualMachines directly. This resource type is available for all namespaces in the cluster.
//
// > This resource cannot be modified once it has been created.
//
// A container image is created under the hood of this resource, which is stored in a dedicated deckhouse virtualization container registry (DVCR).
// With this resource in the cluster, a container image is created and stored in a dedicated Deckhouse Virtualization Container Registry (DVCR).
//
// +kubebuilder:object:root=true
// +kubebuilder:metadata:labels={heritage=deckhouse,module=virtualization,backup.deckhouse.io/cluster-config=true}
Expand Down Expand Up @@ -58,21 +58,21 @@ type ClusterVirtualImage struct {
}

// ClusterVirtualImageList provides the needed parameters
// to do request a list of ClusterVirtualImages from the system.
// for requesting a list of ClusterVirtualImages from the system.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ClusterVirtualImageList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`

// Items provides a list of CDIs
// Items provides a list of CVIs.
Items []ClusterVirtualImage `json:"items"`
}

type ClusterVirtualImageSpec struct {
DataSource ClusterVirtualImageDataSource `json:"dataSource"`
}

// An origin of the image.
// Origin of the image.
// +kubebuilder:validation:XValidation:rule="self.type == 'HTTP' ? has(self.http) && !has(self.containerImage) && !has(self.objectRef) : true",message="HTTP requires http and cannot have ContainerImage or ObjectRef"
// +kubebuilder:validation:XValidation:rule="self.type == 'ContainerImage' ? has(self.containerImage) && !has(self.http) && !has(self.objectRef) : true",message="ContainerImage requires containerImage and cannot have HTTP or ObjectRef"
// +kubebuilder:validation:XValidation:rule="self.type == 'ObjectRef' ? has(self.objectRef) && !has(self.http) && !has(self.containerImage) : true",message="ObjectRef requires objectRef and cannot have HTTP or ContainerImage"
Expand All @@ -83,31 +83,31 @@ type ClusterVirtualImageDataSource struct {
ObjectRef *ClusterVirtualImageObjectRef `json:"objectRef,omitempty"`
}

// Use an image stored in external container registry. Only TLS enabled registries are supported. Use caBundle field to provide custom CA chain if needed.
// Use an image stored in external container registry. Only registries with enabled TLS protocol are supported. To provide a custom Certificate Authority (CA) chain, use the `caBundle` field.
type ClusterVirtualImageContainerImage struct {
// The container registry address of an image.
// Path to the image in the container registry.
// +kubebuilder:example:="registry.example.com/images/slackware:15"
// +kubebuilder:validation:Pattern:=`^(?P<name>(?:(?P<domain>(?:(?:localhost|[\w-]+(?:\.[\w-]+)+)(?::\d+)?)|[\w]+:\d+)/)?(?P<image>[a-z0-9_.-]+(?:/[a-z0-9_.-]+)*))(?::(?P<tag>[\w][\w.-]{0,127}))?(?:@(?P<digest>[A-Za-z][A-Za-z0-9]*(?:[+.-_][A-Za-z][A-Za-z0-9]*)*:[0-9a-fA-F]{32,}))?$`
Image string `json:"image"`
ImagePullSecret ImagePullSecret `json:"imagePullSecret,omitempty"`
// The CA chain in base64 format to verify the container registry.
// CA chain in Base64 format to verify the container registry.
// +kubebuilder:example:="YWFhCg=="
CABundle []byte `json:"caBundle,omitempty"`
}

// Use an existing `VirtualImage`, `ClusterVirtualImage` or `VirtualDisk` to create an image.
// Use an existing VirtualImage, ClusterVirtualImage, or VirtualDisk resource to create an image.
//
// +kubebuilder:validation:XValidation:rule="self.kind == 'VirtualImage' || self.kind == 'VirtualDisk' ? has(self.__namespace__) && size(self.__namespace__) > 0 : true",message="The namespace is required for VirtualDisk and VirtualImage"
// +kubebuilder:validation:XValidation:rule="self.kind == 'VirtualImage' || self.kind == 'VirtualDisk' ? has(self.__namespace__) && size(self.__namespace__) < 64 : true",message="The namespace must be no longer than 63 characters."
type ClusterVirtualImageObjectRef struct {
Kind ClusterVirtualImageObjectRefKind `json:"kind"`
// A name of existing `VirtualImage`, `ClusterVirtualImage` or `VirtualDisk`.
// Name of the existing VirtualImage, ClusterVirtualImage, or VirtualDisk resource.
Name string `json:"name"`
// A namespace where `VirtualImage` or `VirtualDisk` is located.
// Namespace where the VirtualImage or VirtualDisk resource is located.
Namespace string `json:"namespace,omitempty"`
}

// A kind of existing `VirtualImage`, `ClusterVirtualImage` or `VirtualDisk`.
// Kind of the existing VirtualImage, ClusterVirtualImage, or VirtualDisk resource.
// +kubebuilder:validation:Enum:={ClusterVirtualImage,VirtualImage,VirtualDisk}
type ClusterVirtualImageObjectRefKind string

Expand All @@ -120,30 +120,30 @@ const (
type ClusterVirtualImageStatus struct {
// Image download speed from an external source. Appears only during the `Provisioning` phase.
DownloadSpeed *StatusSpeed `json:"downloadSpeed,omitempty"`
// Discovered sizes of the image.
// Discovered image size data.
Size ImageStatusSize `json:"size,omitempty"`
// Discovered format of the image.
// Discovered image format.
Format string `json:"format,omitempty"`
// Whether the image is a format that is supposed to be mounted as a cdrom, such as iso and so on.
// Defines whether the image is a format that needs to be mounted as a CD-ROM drive, such as iso and so on.
CDROM bool `json:"cdrom,omitempty"`
// Current status of `ClusterVirtualImage` resource:
// * Pending - The resource has been created and is on a waiting queue.
// * Provisioning - The process of resource creation (copying/downloading/building the image) is in progress.
// * WaitForUserUpload - Waiting for the user to upload the image. The endpoint to upload the image is specified in `.status.uploadCommand`.
// * Ready - The resource is created and ready to use.
// * Failed - There was a problem when creating a resource.
// * Terminating - The process of resource deletion is in progress.
// Current status of the ClusterVirtualImage resource:
// * `Pending`: The resource has been created and is on a waiting queue.
// * `Provisioning`: The resource is being created: copying, downloading, or building of the image is in progress.
// * `WaitForUserUpload`: Waiting for the user to upload the image. The endpoint to upload the image is specified in `.status.uploadCommand`.
// * `Ready`: The resource has been created and is ready to use.
// * `Failed`: There was an error when creating the resource.
// * `Terminating`: The resource is being deleted.
// +kubebuilder:validation:Enum:={Pending,Provisioning,WaitForUserUpload,Ready,Failed,Terminating}
Phase ImagePhase `json:"phase,omitempty"`
// Progress of copying an image from source to DVCR. Appears only during the `Provisioning' phase.
// Progress of copying an image from the source to DVCR. Appears only during the `Provisioning' phase.
Progress string `json:"progress,omitempty"`
// The UID of the source (`VirtualImage`, `ClusterVirtualImage` or `VirtualDisk`) used when creating the cluster virtual image.
// UID of the source (VirtualImage, ClusterVirtualImage, or VirtualDisk) used when creating the cluster virtual image.
SourceUID *types.UID `json:"sourceUID,omitempty"`
// The latest available observations of an object's current state.
Conditions []metav1.Condition `json:"conditions,omitempty"`
// The generation last processed by the controller.
// Resource generation last processed by the controller.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Deprecated. Use imageUploadURLs instead.
// Deprecated. Use `imageUploadURLs` instead.
UploadCommand string `json:"uploadCommand,omitempty"`
ImageUploadURLs *ImageUploadURLs `json:"imageUploadURLs,omitempty"`
Target ClusterVirtualImageStatusTarget `json:"target,omitempty"`
Expand Down
Loading

0 comments on commit 651c25e

Please sign in to comment.