From 29dc4b6b673d996544806b83f3ef361ead8fcbb4 Mon Sep 17 00:00:00 2001 From: Nikita Korolev <141920865+universal-itengineer@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:24:22 +0300 Subject: [PATCH] Revert "fix(vi): update CEL (#549)" This reverts commit 98da8646a9b82ba4c406bd3d5471df3306613d29. --- api/core/v1alpha2/virtual_image.go | 5 +---- .../generated/openapi/zz_generated.openapi.go | 2 +- crds/virtualimages.yaml | 18 +----------------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/api/core/v1alpha2/virtual_image.go b/api/core/v1alpha2/virtual_image.go index 1f13cf09c..7c5b0946a 100644 --- a/api/core/v1alpha2/virtual_image.go +++ b/api/core/v1alpha2/virtual_image.go @@ -66,14 +66,11 @@ type VirtualImageList struct { Items []VirtualImage `json:"items"` } -// +kubebuilder:validation:XValidation:rule="self.storage == 'ContainerRegistry' ? !has(self.persistentVolumeClaim) && has(self.dataSource): true",message="The storage type ContainerRegistry should contain only the dataSource." -// +kubebuilder:validation:XValidation:rule="self.storage == 'PersistentVolumeClaim' ? !has(self.dataSource) && has(self.persistentVolumeClaim): true",message="The storage type PersistentVolumeClaim should contain only the persistentVolumeClaim." -// +kubebuilder:validation:XValidation:rule="self.storage == 'Kubernetes' ? !has(self.dataSource) && has(self.persistentVolumeClaim): true",message="The storage type Kubernetes should contain only the persistentVolumeClaim." type VirtualImageSpec struct { // +kubebuilder:default:=ContainerRegistry Storage StorageType `json:"storage"` PersistentVolumeClaim VirtualImagePersistentVolumeClaim `json:"persistentVolumeClaim,omitempty"` - DataSource VirtualImageDataSource `json:"dataSource,omitempty"` + DataSource VirtualImageDataSource `json:"dataSource"` } type VirtualImageStatus struct { diff --git a/api/pkg/apiserver/api/generated/openapi/zz_generated.openapi.go b/api/pkg/apiserver/api/generated/openapi/zz_generated.openapi.go index 55e5479bb..d769f5487 100644 --- a/api/pkg/apiserver/api/generated/openapi/zz_generated.openapi.go +++ b/api/pkg/apiserver/api/generated/openapi/zz_generated.openapi.go @@ -2937,7 +2937,7 @@ func schema_virtualization_api_core_v1alpha2_VirtualImageSpec(ref common.Referen }, }, }, - Required: []string{"storage"}, + Required: []string{"storage", "dataSource"}, }, }, Dependencies: []string{ diff --git a/crds/virtualimages.yaml b/crds/virtualimages.yaml index 840528ac6..714b55b6b 100644 --- a/crds/virtualimages.yaml +++ b/crds/virtualimages.yaml @@ -240,25 +240,9 @@ spec: - PersistentVolumeClaim type: string required: + - dataSource - storage type: object - x-kubernetes-validations: - - message: - The storage type ContainerRegistry should contain only the - dataSource. - rule: - "self.storage == 'ContainerRegistry' ? !has(self.persistentVolumeClaim) - && has(self.dataSource): true" - - message: - The storage type PersistentVolumeClaim should contain only - the persistentVolumeClaim. - rule: - "self.storage == 'PersistentVolumeClaim' ? !has(self.dataSource) - && has(self.persistentVolumeClaim): true" - - message: The storage type Kubernetes should contain only the persistentVolumeClaim. - rule: - "self.storage == 'Kubernetes' ? !has(self.dataSource) && has(self.persistentVolumeClaim): - true" status: properties: cdrom: