From e35f7a26a1dd9820d702f70e31d1ab51571dfa3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20=C5=A0imon?= Date: Thu, 11 May 2023 13:16:26 +0200 Subject: [PATCH 1/2] feat: clean up create-vm task MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR should clean up create-vm task. It removes parameters which are no longer needed, because they can be set directly in manifest or virtctl parameters. Additional clean up is done in the code, where I am removing code, which is no longer in use. Signed-off-by: Karel Šimon --- .../kubevirt-tekton-tasks-kubernetes.yaml | 24 - manifests/okd/kubevirt-tekton-tasks-okd.yaml | 48 -- modules/create-vm/cmd/create-vm/main.go | 8 - modules/create-vm/go.mod | 4 +- modules/create-vm/go.sum | 4 - .../pkg/datavolume/datavolume-provider.go | 70 -- modules/create-vm/pkg/k8s/ownerereferences.go | 14 - .../pkg/k8s/ownerereferences_test.go | 23 - modules/create-vm/pkg/k8s/patch.go | 25 - modules/create-vm/pkg/k8s/patch_test.go | 33 - modules/create-vm/pkg/pvc/pvc-provider.go | 64 -- modules/create-vm/pkg/templates/template.go | 15 - .../create-vm/pkg/templates/template_test.go | 8 - .../pkg/templates/validations/validations.go | 118 --- .../validations/validations_suite_test.go | 17 - .../templates/validations/validations_test.go | 36 - .../create-vm/pkg/utils/parse/clioptions.go | 48 +- .../pkg/utils/parse/clioptions_test.go | 106 +-- .../create-vm/pkg/utils/parse/validations.go | 6 - .../testobjects/template-validations.go | 25 - modules/create-vm/pkg/vm/vm.go | 117 --- modules/create-vm/pkg/vm/vm_test.go | 244 +----- modules/create-vm/pkg/vmcreator/vm-creator.go | 105 --- .../sharedtest/testconstants/constants.go | 6 - .../github.com/mattbaird/jsonpatch/.gitignore | 24 - .../github.com/mattbaird/jsonpatch/LICENSE | 202 ----- .../github.com/mattbaird/jsonpatch/README.md | 46 - .../mattbaird/jsonpatch/jsonpatch.go | 257 ------ .../pkg/apis/core/v1alpha1/doc.go | 6 - .../pkg/apis/core/v1alpha1/register.go | 46 - .../pkg/apis/core/v1alpha1/types.go | 534 ------------ .../core/v1alpha1/types_swagger_generated.go | 249 ------ .../pkg/apis/core/v1alpha1/utils.go | 61 -- .../core/v1alpha1/zz_generated.deepcopy.go | 799 ------------------ .../pkg/apis/upload/v1alpha1/doc.go | 6 - .../pkg/apis/upload/v1alpha1/register.go | 39 - .../pkg/apis/upload/v1alpha1/types.go | 57 -- .../v1alpha1/types_swagger_generated.go | 32 - .../upload/v1alpha1/zz_generated.deepcopy.go | 119 --- .../containerized-data-importer/LICENSE | 202 ----- .../clientset/versioned/scheme/BUILD.bazel | 22 - .../client/clientset/versioned/scheme/doc.go | 20 - .../clientset/versioned/scheme/register.go | 62 -- .../versioned/typed/core/v1beta1/BUILD.bazel | 27 - .../versioned/typed/core/v1beta1/cdi.go | 184 ---- .../versioned/typed/core/v1beta1/cdiconfig.go | 184 ---- .../typed/core/v1beta1/core_client.go | 137 --- .../typed/core/v1beta1/dataimportcron.go | 195 ----- .../typed/core/v1beta1/datasource.go | 195 ----- .../typed/core/v1beta1/datavolume.go | 195 ----- .../versioned/typed/core/v1beta1/doc.go | 20 - .../typed/core/v1beta1/generated_expansion.go | 33 - .../typed/core/v1beta1/objecttransfer.go | 184 ---- .../typed/core/v1beta1/storageprofile.go | 184 ---- modules/create-vm/vendor/modules.txt | 9 - .../sharedtest/testconstants/constants.go | 6 - modules/sharedtest/testconstants/constants.go | 6 - modules/tests/test/constants/create-vm.go | 14 - modules/tests/test/create_vm_common_test.go | 296 ------- .../test/create_vm_from_manifest_test.go | 40 - .../test/create_vm_from_template_test.go | 108 +-- .../tests/test/testconfigs/vm-test-config.go | 174 +--- .../sharedtest/testconstants/constants.go | 6 - .../sharedtest/testconstants/constants.go | 6 - tasks/create-vm-from-manifest/README.md | 4 - .../manifests/create-vm-from-manifest.yaml | 24 - tasks/create-vm-from-template/README.md | 4 - .../manifests/create-vm-from-template.yaml | 24 - .../manifests/create-vm.yaml | 24 - 69 files changed, 48 insertions(+), 6186 deletions(-) delete mode 100644 modules/create-vm/pkg/datavolume/datavolume-provider.go delete mode 100644 modules/create-vm/pkg/k8s/ownerereferences.go delete mode 100644 modules/create-vm/pkg/k8s/ownerereferences_test.go delete mode 100644 modules/create-vm/pkg/k8s/patch.go delete mode 100644 modules/create-vm/pkg/k8s/patch_test.go delete mode 100644 modules/create-vm/pkg/pvc/pvc-provider.go delete mode 100644 modules/create-vm/pkg/templates/validations/validations.go delete mode 100644 modules/create-vm/pkg/templates/validations/validations_suite_test.go delete mode 100644 modules/create-vm/pkg/templates/validations/validations_test.go delete mode 100644 modules/create-vm/pkg/utilstest/testobjects/template-validations.go delete mode 100644 modules/create-vm/vendor/github.com/mattbaird/jsonpatch/.gitignore delete mode 100644 modules/create-vm/vendor/github.com/mattbaird/jsonpatch/LICENSE delete mode 100644 modules/create-vm/vendor/github.com/mattbaird/jsonpatch/README.md delete mode 100644 modules/create-vm/vendor/github.com/mattbaird/jsonpatch/jsonpatch.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/doc.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/register.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/types.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/types_swagger_generated.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/utils.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/doc.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/register.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/types.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/types_swagger_generated.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/zz_generated.deepcopy.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/LICENSE delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/BUILD.bazel delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/doc.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/register.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/BUILD.bazel delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/cdi.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/cdiconfig.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/core_client.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/dataimportcron.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/datasource.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/datavolume.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/doc.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/generated_expansion.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/objecttransfer.go delete mode 100644 modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/storageprofile.go delete mode 100644 modules/tests/test/create_vm_common_test.go diff --git a/manifests/kubernetes/kubevirt-tekton-tasks-kubernetes.yaml b/manifests/kubernetes/kubevirt-tekton-tasks-kubernetes.yaml index 32926f7bd..ded4c0adb 100644 --- a/manifests/kubernetes/kubevirt-tekton-tasks-kubernetes.yaml +++ b/manifests/kubernetes/kubevirt-tekton-tasks-kubernetes.yaml @@ -175,22 +175,6 @@ spec: description: Set runStrategy to VM. If runStrategy is set, vm.spec.running attribute is set to nil. default: "" type: string - - name: dataVolumes - description: Add DVs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: ownDataVolumes - description: Add DVs to VM Volumes and add VM to DV ownerReferences. These DataVolumes will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: persistentVolumeClaims - description: Add PVCs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array - - name: ownPersistentVolumeClaims - description: Add PVCs to VM Volumes and add VM to PVC ownerReferences. These PVCs will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array results: - name: name description: The name of a VM that was created. @@ -203,14 +187,6 @@ spec: - create-vm args: - "--output=yaml" - - '--dvs' - - $(params.dataVolumes) - - '--own-dvs' - - $(params.ownDataVolumes) - - '--pvcs' - - $(params.persistentVolumeClaims) - - '--own-pvcs' - - $(params.ownPersistentVolumeClaims) env: - name: VM_MANIFEST value: $(params.manifest) diff --git a/manifests/okd/kubevirt-tekton-tasks-okd.yaml b/manifests/okd/kubevirt-tekton-tasks-okd.yaml index 244adf1de..fd245f400 100644 --- a/manifests/okd/kubevirt-tekton-tasks-okd.yaml +++ b/manifests/okd/kubevirt-tekton-tasks-okd.yaml @@ -273,22 +273,6 @@ spec: description: Set runStrategy to VM. If runStrategy is set, vm.spec.running attribute is set to nil. default: "" type: string - - name: dataVolumes - description: Add DVs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: ownDataVolumes - description: Add DVs to VM Volumes and add VM to DV ownerReferences. These DataVolumes will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: persistentVolumeClaims - description: Add PVCs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array - - name: ownPersistentVolumeClaims - description: Add PVCs to VM Volumes and add VM to PVC ownerReferences. These PVCs will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array results: - name: name description: The name of a VM that was created. @@ -301,14 +285,6 @@ spec: - create-vm args: - "--output=yaml" - - '--dvs' - - $(params.dataVolumes) - - '--own-dvs' - - $(params.ownDataVolumes) - - '--pvcs' - - $(params.persistentVolumeClaims) - - '--own-pvcs' - - $(params.ownPersistentVolumeClaims) env: - name: VM_MANIFEST value: $(params.manifest) @@ -432,22 +408,6 @@ spec: description: Set runStrategy to VM. If runStrategy is set, vm.spec.running attribute is set to nil. default: "" type: string - - name: dataVolumes - description: Add DVs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: ownDataVolumes - description: Add DVs to VM Volumes and add VM to DV ownerReferences. These DataVolumes will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: persistentVolumeClaims - description: Add PVCs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array - - name: ownPersistentVolumeClaims - description: Add PVCs to VM Volumes and add VM to PVC ownerReferences. These PVCs will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array results: - name: name description: The name of a VM that was created. @@ -460,14 +420,6 @@ spec: - create-vm args: - "--output=yaml" - - '--dvs' - - $(params.dataVolumes) - - '--own-dvs' - - $(params.ownDataVolumes) - - '--pvcs' - - $(params.persistentVolumeClaims) - - '--own-pvcs' - - $(params.ownPersistentVolumeClaims) - '--template-params' - $(params.templateParams) env: diff --git a/modules/create-vm/cmd/create-vm/main.go b/modules/create-vm/cmd/create-vm/main.go index 1baf3351e..21fbf30d4 100644 --- a/modules/create-vm/cmd/create-vm/main.go +++ b/modules/create-vm/cmd/create-vm/main.go @@ -35,10 +35,6 @@ func main() { exit.ExitOrDieFromError(GenericExitCode, err) } - if err := vmCreator.CheckVolumesExist(); err != nil { - exit.ExitFromError(VolumesNotPresentExitCode, err) - } - vm, err := vmCreator.CreateVM() if err != nil { exit.ExitOrDieFromError(CreateVMErrorExitCode, err, @@ -46,10 +42,6 @@ func main() { ) } - if err := vmCreator.OwnVolumes(vm); err != nil { - exit.ExitFromError(OwnVolumesErrorExitCode, err) - } - if cliOptions.GetStartVMFlag() && (vm.Spec.RunStrategy == nil || *vm.Spec.RunStrategy != kubevirtv1.RunStrategyAlways) && (vm.Spec.Running == nil || !*vm.Spec.Running) { diff --git a/modules/create-vm/go.mod b/modules/create-vm/go.mod index 1154a3c6a..6b93661f7 100644 --- a/modules/create-vm/go.mod +++ b/modules/create-vm/go.mod @@ -6,7 +6,6 @@ require ( github.com/alexflint/go-arg v1.3.0 github.com/kubevirt/kubevirt-tekton-tasks/modules/shared v0.0.0 github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest v0.0.0 - github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a github.com/onsi/ginkgo/v2 v2.2.0 github.com/onsi/gomega v1.20.2 github.com/openshift/api v0.0.0 @@ -17,8 +16,6 @@ require ( k8s.io/client-go v12.0.0+incompatible kubevirt.io/api v1.0.0-alpha.0 kubevirt.io/client-go v1.0.0-alpha.0 - kubevirt.io/containerized-data-importer v1.55.0 - kubevirt.io/containerized-data-importer-api v1.55.0 kubevirt.io/kubevirt v1.0.0-alpha.0 sigs.k8s.io/yaml v1.3.0 ) @@ -79,6 +76,7 @@ require ( k8s.io/kube-aggregator v0.23.5 // indirect k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect + kubevirt.io/containerized-data-importer-api v1.55.0 // indirect kubevirt.io/controller-lifecycle-operator-sdk/api v0.0.0-20220329064328-f3cc58c6ed90 // indirect sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect diff --git a/modules/create-vm/go.sum b/modules/create-vm/go.sum index e90bbcdb7..9f1725813 100644 --- a/modules/create-vm/go.sum +++ b/modules/create-vm/go.sum @@ -551,8 +551,6 @@ github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7 github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a h1:+J2gw7Bw77w/fbK7wnNJJDKmw1IbWft2Ul5BzrG1Qm8= -github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a/go.mod h1:M1qoD/MqPgTZIk0EWKB38wE28ACRfVcn+cU08jyArI0= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= @@ -1440,8 +1438,6 @@ kubevirt.io/api v1.0.0-alpha.0 h1:KltThlM4UY/MMZanpL3nWNA2nA1sS8g4SHKTccNmwhg= kubevirt.io/api v1.0.0-alpha.0/go.mod h1:zts/6mioR8vGgvYmQ17Cb9XsUR9e/WjJcdokmrE38wY= kubevirt.io/client-go v1.0.0-alpha.0 h1:7pr/dim7eI7ZLXCOGsB2COsTH9dOUsjMD8ndgCSrf/A= kubevirt.io/client-go v1.0.0-alpha.0/go.mod h1:e4nqXJd657nHweLxscFWeahbLY4383RR0RWYn3U+i4U= -kubevirt.io/containerized-data-importer v1.55.0 h1:AcO/b1OPVEhPpobB2fY9SKZ+jOO9KLq1jHmlRxXTTBU= -kubevirt.io/containerized-data-importer v1.55.0/go.mod h1:zb6UhVnep9rCOxm25B/IApPGWZjQfLRj79FtFoavSZE= kubevirt.io/containerized-data-importer-api v1.55.0 h1:IQNc8PYVq1cTwKNPEJza5xSlcnXeYVNt76M5kZ8X7xo= kubevirt.io/containerized-data-importer-api v1.55.0/go.mod h1:92HiQEyzPoeMiCbgfG5Qe10JQVbtWMZOXucy56dKdGg= kubevirt.io/controller-lifecycle-operator-sdk/api v0.0.0-20220329064328-f3cc58c6ed90 h1:QMrd0nKP0BGbnxTqakhDZAUhGKxPiPiN5gSDqKUmGGc= diff --git a/modules/create-vm/pkg/datavolume/datavolume-provider.go b/modules/create-vm/pkg/datavolume/datavolume-provider.go deleted file mode 100644 index 83e37988a..000000000 --- a/modules/create-vm/pkg/datavolume/datavolume-provider.go +++ /dev/null @@ -1,70 +0,0 @@ -package datavolume - -import ( - "context" - "errors" - - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/k8s" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/zerrors" - k8serrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - datavolumev1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" - datavolumeclientv1beta1 "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1" -) - -type dataVolumeProvider struct { - client datavolumeclientv1beta1.CdiV1beta1Interface -} - -type DataVolumeProvider interface { - GetByName(namespace string, names ...string) ([]*datavolumev1beta1.DataVolume, map[string]struct{}, error) - AddOwnerReferences(dv *datavolumev1beta1.DataVolume, newOwnerRefs ...metav1.OwnerReference) (*datavolumev1beta1.DataVolume, error) -} - -func NewDataVolumeProvider(client datavolumeclientv1beta1.CdiV1beta1Interface) DataVolumeProvider { - return &dataVolumeProvider{ - client: client, - } -} - -func (d *dataVolumeProvider) GetByName(namespace string, names ...string) ([]*datavolumev1beta1.DataVolume, map[string]struct{}, error) { - var multiError zerrors.MultiError - var dvs []*datavolumev1beta1.DataVolume - notFoundDVs := make(map[string]struct{}) - for _, name := range names { - dv, err := d.client.DataVolumes(namespace).Get(context.TODO(), name, metav1.GetOptions{}) - if err == nil { - dvs = append(dvs, dv) - } else { - if k8serrors.IsNotFound(err) { - notFoundDVs[name] = struct{}{} - continue - } - dvs = append(dvs, nil) - multiError.Add(name, err) - } - } - return dvs, notFoundDVs, multiError.AsOptional() -} - -func (d *dataVolumeProvider) AddOwnerReferences(dv *datavolumev1beta1.DataVolume, newOwnerRefs ...metav1.OwnerReference) (*datavolumev1beta1.DataVolume, error) { - if dv == nil { - return nil, errors.New("did not receive any DataVolume to add reference to") - } - - if len(newOwnerRefs) <= 0 { - return dv, nil - } - - result := dv.DeepCopy() - result.SetOwnerReferences(k8s.AppendOwnerReferences(result.GetOwnerReferences(), newOwnerRefs)) - - patch, err := k8s.CreatePatch(dv, result) - - if err != nil { - return nil, err - } - - return d.client.DataVolumes(dv.Namespace).Patch(context.TODO(), dv.Name, types.JSONPatchType, patch, metav1.PatchOptions{}) -} diff --git a/modules/create-vm/pkg/k8s/ownerereferences.go b/modules/create-vm/pkg/k8s/ownerereferences.go deleted file mode 100644 index 06afac327..000000000 --- a/modules/create-vm/pkg/k8s/ownerereferences.go +++ /dev/null @@ -1,14 +0,0 @@ -package k8s - -import "k8s.io/apimachinery/pkg/apis/meta/v1" - -func AppendOwnerReferences(ownerRefs []v1.OwnerReference, newOwnerRefs []v1.OwnerReference) []v1.OwnerReference { - if ownerRefs == nil { - ownerRefs = []v1.OwnerReference{} - } - - for _, newOwnerRef := range newOwnerRefs { - ownerRefs = append(ownerRefs, newOwnerRef) - } - return ownerRefs -} diff --git a/modules/create-vm/pkg/k8s/ownerereferences_test.go b/modules/create-vm/pkg/k8s/ownerereferences_test.go deleted file mode 100644 index 5030d1458..000000000 --- a/modules/create-vm/pkg/k8s/ownerereferences_test.go +++ /dev/null @@ -1,23 +0,0 @@ -package k8s_test - -import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - v1core "k8s.io/api/core/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/k8s" -) - -var _ = Describe("Ownerereferences", func() { - DescribeTable("Append OwnerReferences", func(refs []v1.OwnerReference) { - pod := v1core.Pod{} - pod.OwnerReferences = k8s.AppendOwnerReferences(pod.OwnerReferences, refs) - Expect(pod.OwnerReferences).To(HaveLen(len(refs))) - - }, - Entry("nil", nil), - Entry("empty", []v1.OwnerReference{}), - Entry("one", []v1.OwnerReference{{APIVersion: "v1", Kind: "Pod", Name: "first", UID: "", Controller: nil, BlockOwnerDeletion: nil}}), - ) -}) diff --git a/modules/create-vm/pkg/k8s/patch.go b/modules/create-vm/pkg/k8s/patch.go deleted file mode 100644 index ea11178d8..000000000 --- a/modules/create-vm/pkg/k8s/patch.go +++ /dev/null @@ -1,25 +0,0 @@ -package k8s - -import ( - "encoding/json" - "github.com/mattbaird/jsonpatch" -) - -func CreatePatch(before interface{}, after interface{}) ([]byte, error) { - beforeJson, err := json.Marshal(before) - if err != nil { - return nil, err - } - - afterJson, err := json.Marshal(after) - if err != nil { - return nil, err - } - - patch, err := jsonpatch.CreatePatch(beforeJson, afterJson) - if err != nil { - return nil, err - } - - return json.MarshalIndent(patch, "", " ") -} diff --git a/modules/create-vm/pkg/k8s/patch_test.go b/modules/create-vm/pkg/k8s/patch_test.go deleted file mode 100644 index d6485a4f2..000000000 --- a/modules/create-vm/pkg/k8s/patch_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package k8s_test - -import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - v1 "k8s.io/api/core/v1" - - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/k8s" -) - -const expectedPatch1 = `[ - { - "op": "add", - "path": "/metadata/labels", - "value": { - "app": "test" - } - } -]` - -var _ = Describe("Patch", func() { - It("Creates Patch", func() { - before := v1.Pod{} - after := v1.Pod{} - after.Labels = map[string]string{"app": "test"} - - patch, err := k8s.CreatePatch(before, after) - - Expect(err).ShouldNot(HaveOccurred()) - Expect(string(patch)).To(Equal(expectedPatch1)) - }) - -}) diff --git a/modules/create-vm/pkg/pvc/pvc-provider.go b/modules/create-vm/pkg/pvc/pvc-provider.go deleted file mode 100644 index 87a926b8f..000000000 --- a/modules/create-vm/pkg/pvc/pvc-provider.go +++ /dev/null @@ -1,64 +0,0 @@ -package pvc - -import ( - "context" - "errors" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/k8s" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/zerrors" - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - clientv1 "k8s.io/client-go/kubernetes/typed/core/v1" -) - -type pvcProvider struct { - client clientv1.CoreV1Interface -} - -type PersistentVolumeClaimProvider interface { - GetByName(namespace string, names ...string) ([]*v1.PersistentVolumeClaim, error) - AddOwnerReferences(dv *v1.PersistentVolumeClaim, newOwnerRefs ...metav1.OwnerReference) (*v1.PersistentVolumeClaim, error) -} - -func NewPersistentVolumeClaimProvider(client clientv1.CoreV1Interface) PersistentVolumeClaimProvider { - return &pvcProvider{ - client: client, - } -} - -func (d *pvcProvider) GetByName(namespace string, names ...string) ([]*v1.PersistentVolumeClaim, error) { - var multiError zerrors.MultiError - var pvcs []*v1.PersistentVolumeClaim - - for _, name := range names { - pvc, err := d.client.PersistentVolumeClaims(namespace).Get(context.TODO(), name, metav1.GetOptions{}) - if err == nil { - pvcs = append(pvcs, pvc) - } else { - pvcs = append(pvcs, nil) - multiError.Add(name, err) - } - } - return pvcs, multiError.AsOptional() -} - -func (d *pvcProvider) AddOwnerReferences(pvc *v1.PersistentVolumeClaim, newOwnerRefs ...metav1.OwnerReference) (*v1.PersistentVolumeClaim, error) { - if pvc == nil { - return nil, errors.New("did not receive any PersistentVolumeClaim to add reference to") - } - - if len(newOwnerRefs) <= 0 { - return pvc, nil - } - - result := pvc.DeepCopy() - result.SetOwnerReferences(k8s.AppendOwnerReferences(result.GetOwnerReferences(), newOwnerRefs)) - - patch, err := k8s.CreatePatch(pvc, result) - - if err != nil { - return nil, err - } - - return d.client.PersistentVolumeClaims(pvc.Namespace).Patch(context.TODO(), pvc.Name, types.JSONPatchType, patch, metav1.PatchOptions{}) -} diff --git a/modules/create-vm/pkg/templates/template.go b/modules/create-vm/pkg/templates/template.go index 707f51e8a..8dafd4463 100644 --- a/modules/create-vm/pkg/templates/template.go +++ b/modules/create-vm/pkg/templates/template.go @@ -1,12 +1,10 @@ package templates import ( - "encoding/json" "sort" "strings" lab "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/constants/labels" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/templates/validations" "github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/zconstants" templatev1 "github.com/openshift/api/template/v1" ) @@ -29,19 +27,6 @@ func GetFlagLabelByPrefix(template *templatev1.Template, labelPrefix string) (st return "", "" } -func GetTemplateValidations(template *templatev1.Template) (*validations.TemplateValidations, error) { - marshalledValidations := template.Annotations[validationsAnnotation] - var commonTemplateValidations []validations.CommonTemplateValidation - - // empty validations have defaults - if marshalledValidations != "" { - if err := json.Unmarshal([]byte(marshalledValidations), &commonTemplateValidations); err != nil { - return nil, err - } - } - return validations.NewTemplateValidations(commonTemplateValidations), nil -} - // returns osID, osName func GetOs(template *templatev1.Template) (string, string) { diff --git a/modules/create-vm/pkg/templates/template_test.go b/modules/create-vm/pkg/templates/template_test.go index d4408d80f..58507860d 100644 --- a/modules/create-vm/pkg/templates/template_test.go +++ b/modules/create-vm/pkg/templates/template_test.go @@ -6,7 +6,6 @@ import ( . "github.com/onsi/gomega" "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/templates" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants" ) var _ = Describe("Template", func() { @@ -17,13 +16,6 @@ var _ = Describe("Template", func() { Expect(value).To(Equal("true")) }) - It("GetTemplateValidations", func() { - validations, err := templates.GetTemplateValidations(template.NewFedoraServerTinyTemplate().Build()) - Expect(err).Should(Succeed()) - Expect(validations.IsEmpty()).To(BeFalse()) - Expect(validations.GetDefaultDiskBus()).To(Equal(testconstants.Virtio)) - }) - It("GetOs", func() { osID, osName := templates.GetOs(template.NewFedoraServerTinyTemplate().Build()) Expect(osID).To(Equal("fedora29")) diff --git a/modules/create-vm/pkg/templates/validations/validations.go b/modules/create-vm/pkg/templates/validations/validations.go deleted file mode 100644 index 8ed05ff77..000000000 --- a/modules/create-vm/pkg/templates/validations/validations.go +++ /dev/null @@ -1,118 +0,0 @@ -package validations - -import ( - "strings" -) - -const ( - diskBusJSONPath = "jsonpath::.spec.domain.devices.disks[*].disk.bus" -) - -const ( - diskBusVirtIO = "virtio" - diskBusSATA = "sata" - diskBusSCSI = "scsi" -) - -var defaultDiskBus = diskBusVirtIO - -type CommonTemplateValidation struct { - Name string // Identifier of the rule. Must be unique among all the rules attached to a template - Rule string // Validation rule name. One of integer|string|regex|enum - Path string // jsonpath of the field whose value is going to be evaluated. - Message string // User-friendly string message describing the failure, should the rule not be satisfied - Min int // For 'integer' rule - Max int // For 'integer' rule - MinLength int // For 'string' rule - MaxLength int // For 'string' rule - Regex string // For 'regex' rule - Values []string // For 'enum' rule - JustWarning bool -} - -type TemplateValidations struct { - validations []CommonTemplateValidation -} - -func NewTemplateValidations(validations []CommonTemplateValidation) *TemplateValidations { - return &TemplateValidations{validations} -} - -func (t *TemplateValidations) IsEmpty() bool { - return len(t.validations) == 0 -} - -func (t *TemplateValidations) GetDefaultDiskBus() string { - - allowedBuses := t.getAllowedBuses(diskBusJSONPath, false) - - if len(allowedBuses) == 0 { - return defaultDiskBus - } - - recommendedBuses := t.getRecommendedBuses(diskBusJSONPath) - - if len(recommendedBuses) > 0 { - if recommendedBuses[defaultDiskBus] { - return defaultDiskBus - } - for bus := range recommendedBuses { - return bus - } - } - - if allowedBuses[defaultDiskBus] { - return defaultDiskBus - } - for bus := range allowedBuses { - return bus - } - - return defaultDiskBus -} - -func (t *TemplateValidations) getAllowedBuses(jsonPath string, justWarning bool) map[string]bool { - allowedBuses := t.getAllowedEnumValues(jsonPath, justWarning) - if len(allowedBuses) == 0 { - // default to all - return map[string]bool{ - diskBusVirtIO: true, - diskBusSATA: true, - diskBusSCSI: true, - } - } - - result := make(map[string]bool) - for _, diskBus := range allowedBuses { - result[diskBus] = true - } - return result -} - -func (t *TemplateValidations) getRecommendedBuses(jsonPath string) map[string]bool { - allowedBuses := t.getAllowedBuses(jsonPath, false) - recommendedBuses := t.getAllowedBuses(jsonPath, true) - - for key := range recommendedBuses { - if !allowedBuses[key] { - delete(recommendedBuses, key) - } - } - - if len(recommendedBuses) == 0 { - return allowedBuses - } - - return recommendedBuses -} - -func (t *TemplateValidations) getAllowedEnumValues(jsonPath string, justWarning bool) []string { - var relevantValidations []string - - for _, validation := range t.validations { - if strings.HasPrefix(validation.Path, jsonPath) && validation.JustWarning == justWarning { - relevantValidations = append(relevantValidations, validation.Values...) - } - } - return relevantValidations -} diff --git a/modules/create-vm/pkg/templates/validations/validations_suite_test.go b/modules/create-vm/pkg/templates/validations/validations_suite_test.go deleted file mode 100644 index 3bc76933f..000000000 --- a/modules/create-vm/pkg/templates/validations/validations_suite_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package validations_test - -import ( - "testing" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/utilstest" -) - -func TestValidations(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Validations Suite") -} - -var _ = BeforeSuite(utilstest.SetupTestSuite) diff --git a/modules/create-vm/pkg/templates/validations/validations_test.go b/modules/create-vm/pkg/templates/validations/validations_test.go deleted file mode 100644 index dc73901e8..000000000 --- a/modules/create-vm/pkg/templates/validations/validations_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package validations_test - -import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/templates/validations" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/utilstest/testobjects" - . "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants" -) - -var _ = Describe("Validations", func() { - DescribeTable("gets default bus", func(templateValidations []validations.CommonTemplateValidation, expectedBus string) { - Expect(validations.NewTemplateValidations(templateValidations).GetDefaultDiskBus()).To(Equal(expectedBus)) - }, - Entry("nil", nil, Virtio), - Entry("empty", testobjects.NewTestCommonTemplateValidations(), Virtio), - Entry("one", testobjects.NewTestCommonTemplateValidations(Scsi), Scsi), - Entry("two with virtio", testobjects.NewTestCommonTemplateValidations(Scsi, Virtio), Virtio), - ) - - It("gets prefered bus", func() { - allowed := testobjects.NewTestCommonTemplateValidations(Scsi, Sata, Virtio) - otherAllowed := testobjects.NewTestCommonTemplateValidations(Virtio) - prefered := testobjects.NewTestCommonTemplateValidations(Sata) - prefered[0].JustWarning = true - - var finalTemplateValidations []validations.CommonTemplateValidation - - finalTemplateValidations = append(finalTemplateValidations, allowed...) - finalTemplateValidations = append(finalTemplateValidations, otherAllowed...) - finalTemplateValidations = append(finalTemplateValidations, prefered...) - - Expect(validations.NewTemplateValidations(finalTemplateValidations).GetDefaultDiskBus()).To(Equal(Sata)) - }) -}) diff --git a/modules/create-vm/pkg/utils/parse/clioptions.go b/modules/create-vm/pkg/utils/parse/clioptions.go index e30f6f806..e732880e4 100644 --- a/modules/create-vm/pkg/utils/parse/clioptions.go +++ b/modules/create-vm/pkg/utils/parse/clioptions.go @@ -23,36 +23,16 @@ const templateParamSep = ":" const volumesSep = ":" type CLIOptions struct { - TemplateName string `arg:"--template-name,env:TEMPLATE_NAME" placeholder:"NAME" help:"Name of a template to create VM from"` - TemplateNamespace string `arg:"--template-namespace,env:TEMPLATE_NAMESPACE" placeholder:"NAMESPACE" help:"Namespace of a template to create VM from"` - TemplateParams []string `arg:"--template-params" placeholder:"KEY1:VAL1 KEY2:VAL2" help:"Template params to pass when processing the template manifest"` - VirtualMachineManifest string `arg:"--vm-manifest,env:VM_MANIFEST" placeholder:"MANIFEST" help:"YAML manifest of a VirtualMachine resource to be created (can be set by VM_MANIFEST env variable)."` - VirtualMachineNamespace string `arg:"--vm-namespace,env:VM_NAMESPACE" placeholder:"NAMESPACE" help:"Namespace where to create the VM"` - DataVolumes []string `arg:"--dvs" placeholder:"DV1 VOLUME_NAME:DV2 DV3" help:"Add DataVolumes to VM Volumes. Replaces a particular volume if in VOLUME_NAME:DV_NAME format."` - OwnDataVolumes []string `arg:"--own-dvs" placeholder:"DV1 VOLUME_NAME:DV2 DV3" help:"Add DataVolumes to VM Volumes and add VM to DV ownerReferences. These DVs will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:DV_NAME format."` - PersistentVolumeClaims []string `arg:"--pvcs" placeholder:"PVC1 VOLUME_NAME:PVC2 PVC3" help:"Add PersistentVolumeClaims to VM Volumes. Replaces a particular volume if in PVC_NAME:DV_NAME format."` - OwnPersistentVolumeClaims []string `arg:"--own-pvcs" placeholder:"PVC1 VOLUME_NAME:PVC2 PVC3" help:"Add PersistentVolumeClaims to VM Volumes and add VM to PVC ownerReferences. These PVCs will be deleted once the created VM gets deleted. Replaces a particular volume if in PVC_NAME:DV_NAME format."` - StartVM string `arg:"--start-vm,env:START_VM" help:"Start vm after creation"` - RunStrategy string `arg:"--run-strategy,env:RUN_STRATEGY" help:"Set run strategy to vm"` - Output output.OutputType `arg:"-o" placeholder:"FORMAT" help:"Output format. One of: yaml|json"` - Debug bool `arg:"--debug" help:"Sets DEBUG log level"` - Virtctl string `arg:"--virtctl,env:VIRTCTL" placeholder:"VIRTCTL" help:"Specifies the parameters for virtctl create vm command that will be used to create VirtualMachine."` -} - -func (c *CLIOptions) GetPVCNames() []string { - return removeVolumePrefixes(c.PersistentVolumeClaims) -} - -func (c *CLIOptions) GetOwnPVCNames() []string { - return removeVolumePrefixes(c.OwnPersistentVolumeClaims) -} - -func (c *CLIOptions) GetDVNames() []string { - return removeVolumePrefixes(c.DataVolumes) -} - -func (c *CLIOptions) GetOwnDVNames() []string { - return removeVolumePrefixes(c.OwnDataVolumes) + TemplateName string `arg:"--template-name,env:TEMPLATE_NAME" placeholder:"NAME" help:"Name of a template to create VM from"` + TemplateNamespace string `arg:"--template-namespace,env:TEMPLATE_NAMESPACE" placeholder:"NAMESPACE" help:"Namespace of a template to create VM from"` + TemplateParams []string `arg:"--template-params" placeholder:"KEY1:VAL1 KEY2:VAL2" help:"Template params to pass when processing the template manifest"` + VirtualMachineManifest string `arg:"--vm-manifest,env:VM_MANIFEST" placeholder:"MANIFEST" help:"YAML manifest of a VirtualMachine resource to be created (can be set by VM_MANIFEST env variable)."` + VirtualMachineNamespace string `arg:"--vm-namespace,env:VM_NAMESPACE" placeholder:"NAMESPACE" help:"Namespace where to create the VM"` + StartVM string `arg:"--start-vm,env:START_VM" help:"Start vm after creation"` + RunStrategy string `arg:"--run-strategy,env:RUN_STRATEGY" help:"Set run strategy to vm"` + Output output.OutputType `arg:"-o" placeholder:"FORMAT" help:"Output format. One of: yaml|json"` + Debug bool `arg:"--debug" help:"Sets DEBUG log level"` + Virtctl string `arg:"--virtctl,env:VIRTCTL" placeholder:"VIRTCTL" help:"Specifies the parameters for virtctl create vm command that will be used to create VirtualMachine."` } func (c *CLIOptions) GetStartVMFlag() bool { @@ -67,14 +47,6 @@ func (c *CLIOptions) GetVirtctl() string { return c.Virtctl } -func (c *CLIOptions) GetPVCDiskNamesMap() map[string]string { - return getDiskNameMap(zutils.ConcatStringSlices(c.OwnPersistentVolumeClaims, c.PersistentVolumeClaims)) -} - -func (c *CLIOptions) GetDVDiskNamesMap() map[string]string { - return getDiskNameMap(zutils.ConcatStringSlices(c.OwnDataVolumes, c.DataVolumes)) -} - func (c *CLIOptions) GetTemplateParams() map[string]string { result, err := zutils.ExtractKeysAndValuesByLastKnownKey(c.TemplateParams, templateParamSep) diff --git a/modules/create-vm/pkg/utils/parse/clioptions_test.go b/modules/create-vm/pkg/utils/parse/clioptions_test.go index c1e13d10b..6cb32a976 100644 --- a/modules/create-vm/pkg/utils/parse/clioptions_test.go +++ b/modules/create-vm/pkg/utils/parse/clioptions_test.go @@ -69,12 +69,6 @@ var _ = Describe("CLIOptions", func() { "GetTemplateNamespace": defaultNS, "GetVirtualMachineNamespace": defaultNS, "GetVirtualMachineManifest": "", - "GetPVCNames": []string(nil), - "GetOwnPVCNames": []string(nil), - "GetDVNames": []string(nil), - "GetOwnDVNames": []string(nil), - "GetPVCDiskNamesMap": map[string]string{}, - "GetDVDiskNamesMap": map[string]string{}, "GetTemplateParams": map[string]string{}, "GetDebugLevel": zapcore.InfoLevel, "GetCreationMode": constants.TemplateCreationMode, @@ -82,38 +76,18 @@ var _ = Describe("CLIOptions", func() { "GetRunStrategy": "", }), Entry("handles template cli arguments", &parse.CLIOptions{ - TemplateName: "test", - TemplateNamespace: defaultNS, - TemplateParams: []string{"K1:V1", "with", "space", "K2:V2"}, - VirtualMachineNamespace: defaultNS, - Output: output.YamlOutput, // check if passes validation - PersistentVolumeClaims: []string{"pvc1"}, - OwnPersistentVolumeClaims: []string{"mydisk1:pvc2", "pvc3"}, - DataVolumes: []string{"dv1", "mydisk2:dv2"}, - OwnDataVolumes: []string{"mydisk3:dv3", "dv4", "mydisk4:dv5"}, - Debug: true, - StartVM: "true", - RunStrategy: "Always", + TemplateName: "test", + TemplateNamespace: defaultNS, + TemplateParams: []string{"K1:V1", "with", "space", "K2:V2"}, + VirtualMachineNamespace: defaultNS, + Output: output.YamlOutput, // check if passes validation + Debug: true, + StartVM: "true", + RunStrategy: "Always", }, map[string]interface{}{ "GetTemplateNamespace": defaultNS, "GetVirtualMachineNamespace": defaultNS, "GetVirtualMachineManifest": "", - "GetPVCNames": []string{"pvc1"}, - "GetOwnPVCNames": []string{"pvc2", "pvc3"}, - "GetDVNames": []string{"dv1", "dv2"}, - "GetOwnDVNames": []string{"dv3", "dv4", "dv5"}, - "GetPVCDiskNamesMap": map[string]string{ - "pvc1": "pvc1", - "mydisk1": "pvc2", - "pvc3": "pvc3", - }, - "GetDVDiskNamesMap": map[string]string{ - "dv1": "dv1", - "mydisk2": "dv2", - "mydisk3": "dv3", - "dv4": "dv4", - "mydisk4": "dv5", - }, "GetTemplateParams": map[string]string{ "K1": "V1 with space", "K2": "V2", @@ -124,65 +98,29 @@ var _ = Describe("CLIOptions", func() { "GetRunStrategy": "Always", }), Entry("handles vm cli arguments", &parse.CLIOptions{ - VirtualMachineManifest: testVMManifest, - VirtualMachineNamespace: defaultNS, - Output: output.YamlOutput, // check if passes validation - PersistentVolumeClaims: []string{"mydisk1:pvc1"}, - OwnPersistentVolumeClaims: []string{"pvc2", "pvc3"}, - DataVolumes: []string{"mydisk2:dv1", ":dv2"}, - OwnDataVolumes: []string{"dv3"}, - Debug: true, - StartVM: "false", - RunStrategy: "Always", + VirtualMachineManifest: testVMManifest, + VirtualMachineNamespace: defaultNS, + Output: output.YamlOutput, // check if passes validation + Debug: true, + StartVM: "false", + RunStrategy: "Always", }, map[string]interface{}{ "GetTemplateNamespace": "", "GetVirtualMachineNamespace": defaultNS, "GetVirtualMachineManifest": testVMManifest, - "GetPVCNames": []string{"pvc1"}, - "GetOwnPVCNames": []string{"pvc2", "pvc3"}, - "GetDVNames": []string{"dv1", "dv2"}, - "GetOwnDVNames": []string{"dv3"}, - "GetPVCDiskNamesMap": map[string]string{ - "mydisk1": "pvc1", - "pvc2": "pvc2", - "pvc3": "pvc3", - }, - "GetDVDiskNamesMap": map[string]string{ - "mydisk2": "dv1", - "dv2": "dv2", - "dv3": "dv3", - }, - "GetTemplateParams": map[string]string{}, - "GetDebugLevel": zapcore.DebugLevel, - "GetCreationMode": constants.VMManifestCreationMode, - "GetStartVMFlag": false, - "GetRunStrategy": "Always", + "GetTemplateParams": map[string]string{}, + "GetDebugLevel": zapcore.DebugLevel, + "GetCreationMode": constants.VMManifestCreationMode, + "GetStartVMFlag": false, + "GetRunStrategy": "Always", }), Entry("handles trim", &parse.CLIOptions{ - TemplateName: "test", - TemplateNamespace: " " + defaultNS + " ", - VirtualMachineNamespace: defaultNS + " ", - PersistentVolumeClaims: []string{"pvc1 "}, - OwnPersistentVolumeClaims: []string{" pvc2", " pvc3 "}, - DataVolumes: []string{" dv1", "dv2"}, - OwnDataVolumes: []string{" dv3 "}, + TemplateName: "test", + TemplateNamespace: " " + defaultNS + " ", + VirtualMachineNamespace: defaultNS + " ", }, map[string]interface{}{ "GetTemplateNamespace": defaultNS, "GetVirtualMachineNamespace": defaultNS, - "GetPVCNames": []string{"pvc1"}, - "GetOwnPVCNames": []string{"pvc2", "pvc3"}, - "GetDVNames": []string{"dv1", "dv2"}, - "GetOwnDVNames": []string{"dv3"}, - "GetPVCDiskNamesMap": map[string]string{ - "pvc1": "pvc1", - "pvc2": "pvc2", - "pvc3": "pvc3", - }, - "GetDVDiskNamesMap": map[string]string{ - "dv1": "dv1", - "dv2": "dv2", - "dv3": "dv3", - }, }), ) diff --git a/modules/create-vm/pkg/utils/parse/validations.go b/modules/create-vm/pkg/utils/parse/validations.go index 93e089232..4e366c81f 100644 --- a/modules/create-vm/pkg/utils/parse/validations.go +++ b/modules/create-vm/pkg/utils/parse/validations.go @@ -38,12 +38,6 @@ func (c *CLIOptions) trimSpaces() { for _, strVariablePtr := range []*string{&c.TemplateName, &c.TemplateNamespace, &c.VirtualMachineNamespace} { *strVariablePtr = strings.TrimSpace(*strVariablePtr) } - - for _, sliceVariablePtr := range []*[]string{&c.DataVolumes, &c.OwnDataVolumes, &c.PersistentVolumeClaims, &c.OwnPersistentVolumeClaims} { - for i, v := range *sliceVariablePtr { - (*sliceVariablePtr)[i] = strings.TrimSpace(v) - } - } } func (c *CLIOptions) resolveDefaultNamespacesAndManifests() error { diff --git a/modules/create-vm/pkg/utilstest/testobjects/template-validations.go b/modules/create-vm/pkg/utilstest/testobjects/template-validations.go deleted file mode 100644 index ce4ee9669..000000000 --- a/modules/create-vm/pkg/utilstest/testobjects/template-validations.go +++ /dev/null @@ -1,25 +0,0 @@ -package testobjects - -import ( - "strings" - - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/templates/validations" -) - -func NewTestCommonTemplateValidations(buses ...string) []validations.CommonTemplateValidation { - if len(buses) == 0 { - return []validations.CommonTemplateValidation{} - } - - var values []string - - values = append(values, buses...) - - return []validations.CommonTemplateValidation{{ - Name: "disk-bus", - Rule: "enum", - Path: "jsonpath::.spec.domain.devices.disks[*].disk.bus", - Message: strings.Join(values, ", ") + " allowed only", - Values: values, - }} -} diff --git a/modules/create-vm/pkg/vm/vm.go b/modules/create-vm/pkg/vm/vm.go index 782fcdfbe..0c319e365 100644 --- a/modules/create-vm/pkg/vm/vm.go +++ b/modules/create-vm/pkg/vm/vm.go @@ -4,12 +4,8 @@ import ( lab "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/constants/labels" "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/k8s" "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/templates" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/templates/validations" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/utils/parse" "github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/zconstants" templatev1 "github.com/openshift/api/template/v1" - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kubevirtv1 "kubevirt.io/api/core/v1" ) @@ -23,18 +19,6 @@ func AddMetadata(vm *kubevirtv1.VirtualMachine, template *templatev1.Template) { labels[lab.TemplateNameLabel] = template.GetName() labels[lab.TemplateNamespace] = template.GetNamespace() - // set template flavor - if flavorKey, flavorValue := templates.GetFlagLabelByPrefix(template, lab.TemplateFlavorLabel); flavorKey != "" { - labels[flavorKey] = flavorValue - tempLabels[flavorKey] = flavorValue - } - - // set template workload - if workloadKey, workloadValue := templates.GetFlagLabelByPrefix(template, lab.TemplateWorkloadLabel); workloadKey != "" { - labels[workloadKey] = workloadValue - tempLabels[workloadKey] = workloadValue - } - if osID, osName := templates.GetOs(template); osID != "" { osIDLabel := lab.TemplateOsLabel + "/" + osID labels[osIDLabel] = zconstants.True @@ -51,104 +35,3 @@ func AddMetadata(vm *kubevirtv1.VirtualMachine, template *templatev1.Template) { tempLabels[lab.VMNameLabel] = vmName } } - -// returns transient pointer to the Disk struct in array -func getDisk(vm *kubevirtv1.VirtualMachine, name string) *kubevirtv1.Disk { - for i := 0; i < len(vm.Spec.Template.Spec.Domain.Devices.Disks); i++ { - if vm.Spec.Template.Spec.Domain.Devices.Disks[i].Name == name { - return &vm.Spec.Template.Spec.Domain.Devices.Disks[i] - } - } - - return nil -} - -// returns transient pointer to the Volume struct in array -func getVolume(vm *kubevirtv1.VirtualMachine, name string) *kubevirtv1.Volume { - for i := 0; i < len(vm.Spec.Template.Spec.Volumes); i++ { - if vm.Spec.Template.Spec.Volumes[i].Name == name { - return &vm.Spec.Template.Spec.Volumes[i] - } - } - - return nil -} - -func AddVolumes(vm *kubevirtv1.VirtualMachine, templateValidations *validations.TemplateValidations, cliParams *parse.CLIOptions) { - if templateValidations == nil { - templateValidations = validations.NewTemplateValidations(nil) - } - defaultBus := templateValidations.GetDefaultDiskBus() - - ensureDisk := func(diskName string) *kubevirtv1.Disk { - if disk := getDisk(vm, diskName); disk != nil { - return disk - } - disk := kubevirtv1.Disk{ - Name: diskName, - DiskDevice: kubevirtv1.DiskDevice{ - Disk: &kubevirtv1.DiskTarget{Bus: kubevirtv1.DiskBus(defaultBus)}, - }, - } - - vm.Spec.Template.Spec.Domain.Devices.Disks = append(vm.Spec.Template.Spec.Domain.Devices.Disks, disk) - - return getDisk(vm, diskName) - } - - ensureVolume := func(volumeName string) *kubevirtv1.Volume { - if volume := getVolume(vm, volumeName); volume != nil { - return volume - } - volume := kubevirtv1.Volume{ - Name: volumeName, - } - - vm.Spec.Template.Spec.Volumes = append(vm.Spec.Template.Spec.Volumes, volume) - - return getVolume(vm, volumeName) - } - - for volumeName, pvcName := range cliParams.GetPVCDiskNamesMap() { - ensureDisk(volumeName) - volume := ensureVolume(volumeName) - - if volume.PersistentVolumeClaim == nil { - volume.VolumeSource = kubevirtv1.VolumeSource{ - PersistentVolumeClaim: &kubevirtv1.PersistentVolumeClaimVolumeSource{ - PersistentVolumeClaimVolumeSource: v1.PersistentVolumeClaimVolumeSource{ - ClaimName: pvcName, - }, - }, - } - } else { - volume.PersistentVolumeClaim.ClaimName = pvcName - } - } - - for volumeName, dvName := range cliParams.GetDVDiskNamesMap() { - ensureDisk(volumeName) - volume := ensureVolume(volumeName) - - if volume.DataVolume == nil { - volume.VolumeSource = kubevirtv1.VolumeSource{ - DataVolume: &kubevirtv1.DataVolumeSource{Name: dvName}, - } - } else { - volume.DataVolume.Name = dvName - } - } -} - -func AsVMOwnerReference(vm *kubevirtv1.VirtualMachine) metav1.OwnerReference { - blockOwnerDeletion := true - isController := false - return metav1.OwnerReference{ - APIVersion: vm.GroupVersionKind().GroupVersion().String(), - Kind: vm.GetObjectKind().GroupVersionKind().Kind, - Name: vm.GetName(), - UID: vm.GetUID(), - BlockOwnerDeletion: &blockOwnerDeletion, - Controller: &isController, - } -} diff --git a/modules/create-vm/pkg/vm/vm_test.go b/modules/create-vm/pkg/vm/vm_test.go index a6349d108..e27cbac64 100644 --- a/modules/create-vm/pkg/vm/vm_test.go +++ b/modules/create-vm/pkg/vm/vm_test.go @@ -1,19 +1,11 @@ package vm_test import ( - "sort" - - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/utilstest/testobjects" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kubevirtv1 "kubevirt.io/api/core/v1" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/templates/validations" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/utils/parse" vm2 "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/vm" - . "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants" shtestobjects "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testobjects" template "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testobjects/template" ) @@ -25,188 +17,13 @@ var _ = Describe("VM", func() { vm = shtestobjects.NewTestVM().Build() }) - It("Creates owner reference", func() { - result := vm2.AsVMOwnerReference(vm) - Expect(result).To(BeAssignableToTypeOf(metav1.OwnerReference{})) - Expect(result.Name).To(Equal(vm.Name)) - }) - - Describe("Adds volumes", func() { - var emptyValidations *validations.TemplateValidations - var cliOptions *parse.CLIOptions - - BeforeEach(func() { - vm = shtestobjects.NewTestVM().Build() - emptyValidations = validations.NewTemplateValidations(nil) - cliOptions = &parse.CLIOptions{ - TemplateName: "test", - TemplateNamespace: "default", - VirtualMachineNamespace: "default", - PersistentVolumeClaims: []string{"pvc1"}, - OwnPersistentVolumeClaims: []string{"pvc2", "pvc3"}, - DataVolumes: []string{"dv1", "dv2"}, - OwnDataVolumes: []string{"dv3"}, - } - Expect(cliOptions.Init()).Should(Succeed()) - }) - - DescribeTable("adds all volumes with various validations", func(templateValidations *validations.TemplateValidations, expectedBus kubevirtv1.DiskBus) { - addsVolumesCorrectly(vm, templateValidations, cliOptions, []kubevirtv1.DiskBus{expectedBus}) - }, - Entry("no validations", nil, kubevirtv1.DiskBusVirtio), - Entry("empty validations", validations.NewTemplateValidations(nil), kubevirtv1.DiskBusVirtio), - Entry("empty validations", validations.NewTemplateValidations(testobjects.NewTestCommonTemplateValidations(Scsi)), kubevirtv1.DiskBusSCSI), - ) - - It("adds some volumes", func() { - cliOptions.DataVolumes = nil - cliOptions.OwnPersistentVolumeClaims = nil - addsVolumesCorrectly(vm, emptyValidations, cliOptions, []kubevirtv1.DiskBus{kubevirtv1.DiskBusVirtio}) - }) - - It("adds no volumes", func() { - cliOptions.OwnDataVolumes = nil - cliOptions.DataVolumes = nil - cliOptions.OwnPersistentVolumeClaims = nil - cliOptions.PersistentVolumeClaims = nil - addsVolumesCorrectly(vm, emptyValidations, cliOptions, []kubevirtv1.DiskBus{kubevirtv1.DiskBusVirtio}) - }) - - It("adding named disks", func() { - cliOptions.OwnDataVolumes = append(cliOptions.OwnDataVolumes, "disk1:dv4") - cliOptions.PersistentVolumeClaims = append(cliOptions.PersistentVolumeClaims, "disk2:pvc4") - addsVolumesCorrectly(vm, emptyValidations, cliOptions, []kubevirtv1.DiskBus{kubevirtv1.DiskBusVirtio}) - }) - - It("replaces existing disks", func() { - bootOrder := uint(1) - vm.Spec.Template.Spec.Domain.Devices.Disks = append(vm.Spec.Template.Spec.Domain.Devices.Disks, - kubevirtv1.Disk{ - Name: "disk1", - BootOrder: &bootOrder, - DiskDevice: kubevirtv1.DiskDevice{ - CDRom: &kubevirtv1.CDRomTarget{Bus: Sata}, - }, - }, - kubevirtv1.Disk{ - Name: "disk2", - DiskDevice: kubevirtv1.DiskDevice{ - Disk: &kubevirtv1.DiskTarget{Bus: Virtio}, - }, - }, - kubevirtv1.Disk{ - Name: "disk3", - DiskDevice: kubevirtv1.DiskDevice{ - Disk: &kubevirtv1.DiskTarget{Bus: Sata}, - }, - }, - ) - vm.Spec.Template.Spec.Volumes = append(vm.Spec.Template.Spec.Volumes, - kubevirtv1.Volume{ - Name: "disk1", - // wrong source - should overwrite - VolumeSource: kubevirtv1.VolumeSource{ - PersistentVolumeClaim: &kubevirtv1.PersistentVolumeClaimVolumeSource{ - PersistentVolumeClaimVolumeSource: v1.PersistentVolumeClaimVolumeSource{ - ClaimName: "other1", - }, - }, - }, - }, - kubevirtv1.Volume{ - // no source - should complete - Name: "disk2", - }, - // for disk3 - should create volume - // for disk4 - should not damage source - kubevirtv1.Volume{ - Name: "disk4", - VolumeSource: kubevirtv1.VolumeSource{ - PersistentVolumeClaim: &kubevirtv1.PersistentVolumeClaimVolumeSource{ - PersistentVolumeClaimVolumeSource: v1.PersistentVolumeClaimVolumeSource{ - ClaimName: "other2", - ReadOnly: true, - }, - }, - }, - }, - ) - - cliOptions.OwnDataVolumes = append(cliOptions.OwnDataVolumes, "disk1:dv4") - cliOptions.PersistentVolumeClaims = append(cliOptions.PersistentVolumeClaims, "disk2:pvc4", "disk3:pvc5", "disk4:pvc6") - addsVolumesCorrectly(vm, emptyValidations, cliOptions, []kubevirtv1.DiskBus{kubevirtv1.DiskBusSATA, kubevirtv1.DiskBusVirtio, kubevirtv1.DiskBusSATA, kubevirtv1.DiskBusVirtio}) - // initial disks should not be changed - Expect(vm.Spec.Template.Spec.Domain.Devices.Disks[0]).Should(Equal( - kubevirtv1.Disk{ - Name: "disk1", - BootOrder: &bootOrder, - DiskDevice: kubevirtv1.DiskDevice{ - CDRom: &kubevirtv1.CDRomTarget{Bus: Sata}, - }, - }, - )) - Expect(vm.Spec.Template.Spec.Domain.Devices.Disks[1]).Should(Equal( - kubevirtv1.Disk{ - Name: "disk2", - DiskDevice: kubevirtv1.DiskDevice{ - Disk: &kubevirtv1.DiskTarget{Bus: Virtio}, - }, - }, - )) - Expect(vm.Spec.Template.Spec.Domain.Devices.Disks[2]).Should(Equal( - kubevirtv1.Disk{ - Name: "disk3", - DiskDevice: kubevirtv1.DiskDevice{ - Disk: &kubevirtv1.DiskTarget{Bus: Sata}, - }, - }, - )) - // should have correctly filled sources - Expect(vm.Spec.Template.Spec.Volumes[0]).Should(Equal( - kubevirtv1.Volume{ - Name: "disk1", - VolumeSource: kubevirtv1.VolumeSource{ - DataVolume: &kubevirtv1.DataVolumeSource{Name: "dv4"}, - }, - }, - )) - Expect(vm.Spec.Template.Spec.Volumes[1]).Should(Equal( - kubevirtv1.Volume{ - Name: "disk2", - VolumeSource: kubevirtv1.VolumeSource{ - PersistentVolumeClaim: &kubevirtv1.PersistentVolumeClaimVolumeSource{ - PersistentVolumeClaimVolumeSource: v1.PersistentVolumeClaimVolumeSource{ - ClaimName: "pvc4", - }, - }, - }, - }, - )) - Expect(vm.Spec.Template.Spec.Volumes[2]).Should(Equal( - kubevirtv1.Volume{ - Name: "disk4", - VolumeSource: kubevirtv1.VolumeSource{ - PersistentVolumeClaim: &kubevirtv1.PersistentVolumeClaimVolumeSource{ - PersistentVolumeClaimVolumeSource: v1.PersistentVolumeClaimVolumeSource{ - ClaimName: "pvc6", - ReadOnly: true, - }, - }, - }, - }, - )) - }) - }) - It("Adds correct metadata from template", func() { vm2.AddMetadata(vm, template.NewFedoraServerTinyTemplate().Build()) Expect(vm.Labels).To(Equal(map[string]string{ - "vm.kubevirt.io/template": "fedora-server-tiny-v0.7.0", - "vm.kubevirt.io/template.namespace": "openshift", - "os.template.kubevirt.io/fedora29": "true", - "flavor.template.kubevirt.io/tiny": "true", - "workload.template.kubevirt.io/server": "true", + "vm.kubevirt.io/template": "fedora-server-tiny-v0.7.0", + "vm.kubevirt.io/template.namespace": "openshift", + "os.template.kubevirt.io/fedora29": "true", })) Expect(vm.Annotations).To(Equal(map[string]string{ @@ -214,11 +31,9 @@ var _ = Describe("VM", func() { })) Expect(vm.Spec.Template.ObjectMeta.Labels).To(Equal(map[string]string{ - "vm.kubevirt.io/name": vm.Name, - "name": vm.Name, - "os.template.kubevirt.io/fedora29": "true", - "flavor.template.kubevirt.io/tiny": "true", - "workload.template.kubevirt.io/server": "true", + "vm.kubevirt.io/name": vm.Name, + "name": vm.Name, + "os.template.kubevirt.io/fedora29": "true", })) }) @@ -233,50 +48,3 @@ var _ = Describe("VM", func() { }) }) - -// expectedBuses: the disk at index i should have a bus at expectedBuses[i], or the last of expectedBuses -func addsVolumesCorrectly(vm *kubevirtv1.VirtualMachine, templateValidations *validations.TemplateValidations, cliOpts *parse.CLIOptions, expectedBuses []kubevirtv1.DiskBus) { - vm2.AddVolumes(vm, templateValidations, cliOpts) - disksCount := len(cliOpts.GetPVCDiskNamesMap()) + len(cliOpts.GetDVDiskNamesMap()) - Expect(vm.Spec.Template.Spec.Volumes).To(HaveLen(disksCount)) - Expect(vm.Spec.Template.Spec.Domain.Devices.Disks).To(HaveLen(disksCount)) - - var foundDiskNames []string - var foundVolumeNames []string - for i, disk := range vm.Spec.Template.Spec.Domain.Devices.Disks { - var expectedBus kubevirtv1.DiskBus - if i < len(expectedBuses) { - expectedBus = expectedBuses[i] - } else { - expectedBus = expectedBuses[len(expectedBuses)-1] - } - - if disk.CDRom != nil { - Expect(disk.CDRom.Bus).To(Equal(expectedBus)) - } else { - Expect(disk.Disk.Bus).To(Equal(expectedBus)) - } - - foundDiskNames = append(foundDiskNames, disk.Name) - } - for _, volume := range vm.Spec.Template.Spec.Volumes { - foundVolumeNames = append(foundVolumeNames, volume.Name) - } - - var expectedNames []string - - for expectedName, _ := range cliOpts.GetPVCDiskNamesMap() { - expectedNames = append(expectedNames, expectedName) - } - - for expectedName, _ := range cliOpts.GetDVDiskNamesMap() { - expectedNames = append(expectedNames, expectedName) - } - - sort.Strings(foundDiskNames) - sort.Strings(foundVolumeNames) - sort.Strings(expectedNames) - - Expect(foundDiskNames).To(Equal(expectedNames)) - Expect(foundVolumeNames).To(Equal(expectedNames)) -} diff --git a/modules/create-vm/pkg/vmcreator/vm-creator.go b/modules/create-vm/pkg/vmcreator/vm-creator.go index 8e0232ab9..e9c0ce90c 100644 --- a/modules/create-vm/pkg/vmcreator/vm-creator.go +++ b/modules/create-vm/pkg/vmcreator/vm-creator.go @@ -6,10 +6,7 @@ import ( "strings" "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/constants" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/datavolume" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/pvc" "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/templates" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/templates/validations" "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/utils/parse" virtualMachine "github.com/kubevirt/kubevirt-tekton-tasks/modules/create-vm/pkg/vm" "github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/env" @@ -18,11 +15,9 @@ import ( "github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/zutils" templatev1 "github.com/openshift/client-go/template/clientset/versioned/typed/template/v1" "go.uber.org/zap" - "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" kubevirtv1 "kubevirt.io/api/core/v1" kubevirtcliv1 "kubevirt.io/client-go/kubecli" - datavolumeclientv1beta1 "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1" virtctl "kubevirt.io/kubevirt/pkg/virtctl/create" "sigs.k8s.io/yaml" ) @@ -33,8 +28,6 @@ type VMCreator struct { config *rest.Config templateProvider templates.TemplateProvider virtualMachineProvider virtualMachine.VirtualMachineProvider - dataVolumeProvider datavolume.DataVolumeProvider - pvcProvider pvc.PersistentVolumeClaimProvider } func NewVMCreator(cliOptions *parse.CLIOptions) (*VMCreator, error) { @@ -47,8 +40,6 @@ func NewVMCreator(cliOptions *parse.CLIOptions) (*VMCreator, error) { } // clients - kubeClient := kubernetes.NewForConfigOrDie(config) - cdiClient := datavolumeclientv1beta1.NewForConfigOrDie(config) kubevirtClient, err := kubevirtcliv1.GetKubevirtClientFromRESTConfig(config) if err != nil { return nil, fmt.Errorf("cannot create kubevirt client: %v", err.Error()) @@ -56,8 +47,6 @@ func NewVMCreator(cliOptions *parse.CLIOptions) (*VMCreator, error) { var templateProvider templates.TemplateProvider virtualMachineProvider := virtualMachine.NewVirtualMachineProvider(kubevirtClient) - dataVolumeProvider := datavolume.NewDataVolumeProvider(cdiClient) - pvcProvider := pvc.NewPersistentVolumeClaimProvider(kubeClient.CoreV1()) if cliOptions.GetCreationMode() == constants.TemplateCreationMode { templateProvider = templates.NewTemplateProvider(templatev1.NewForConfigOrDie(config)) @@ -69,8 +58,6 @@ func NewVMCreator(cliOptions *parse.CLIOptions) (*VMCreator, error) { config: config, templateProvider: templateProvider, virtualMachineProvider: virtualMachineProvider, - dataVolumeProvider: dataVolumeProvider, - pvcProvider: pvcProvider, }, nil } @@ -133,9 +120,6 @@ func (v *VMCreator) createVMFromManifest() (*kubevirtv1.VirtualMachine, error) { vm.Namespace = v.targetNamespace virtualMachine.AddMetadata(&vm, nil) - templateValidations := validations.NewTemplateValidations(nil) // fallback to defaults - virtualMachine.AddVolumes(&vm, templateValidations, v.cliOptions) - runStrategy := kubevirtv1.VirtualMachineRunStrategy(v.cliOptions.GetRunStrategy()) if runStrategy != "" { vm.Spec.Running = nil @@ -163,20 +147,8 @@ func (v *VMCreator) createVMFromTemplate() (*kubevirtv1.VirtualMachine, error) { return nil, err } - templateValidations, err := templates.GetTemplateValidations(processedTemplate) - if err != nil { - log.Logger().Warn("could not parse template validations", zap.Error(err)) - templateValidations = validations.NewTemplateValidations(nil) // fallback to defaults - } - if templateValidations.IsEmpty() { - log.Logger().Debug("template validations are empty: falling back to defaults") - } - vm.Namespace = v.targetNamespace - virtualMachine.AddMetadata(vm, processedTemplate) - virtualMachine.AddVolumes(vm, templateValidations, v.cliOptions) - runStrategy := kubevirtv1.VirtualMachineRunStrategy(v.cliOptions.GetRunStrategy()) if runStrategy != "" { vm.Spec.Running = nil @@ -186,80 +158,3 @@ func (v *VMCreator) createVMFromTemplate() (*kubevirtv1.VirtualMachine, error) { log.Logger().Debug("creating VM", zap.Reflect("vm", vm)) return v.virtualMachineProvider.Create(v.targetNamespace, vm) } - -func (v *VMCreator) CheckVolumesExist() error { - allDVs := zutils.ConcatStringSlices(v.cliOptions.GetOwnDVNames(), v.cliOptions.GetDVNames()) - allPVCs := zutils.ConcatStringSlices(v.cliOptions.GetOwnPVCNames(), v.cliOptions.GetPVCNames()) - - log.Logger().Debug("asserting additional volumes exist", zap.Strings("additional-dvs", allDVs), zap.Strings("additional-pvcs", allPVCs)) - _, notFoundDVs, dvsErr := v.dataVolumeProvider.GetByName(v.targetNamespace, allDVs...) - - for dv, _ := range notFoundDVs { - allPVCs = append(allPVCs, dv) - } - - _, pvcsErr := v.pvcProvider.GetByName(v.targetNamespace, allPVCs...) - - return zerrors.NewMultiError(). - AddC("dvsErr", dvsErr). - AddC("pvcsErr", pvcsErr). - AsOptional() -} - -func (v *VMCreator) OwnVolumes(vm *kubevirtv1.VirtualMachine) error { - dvsErr := v.ownDataVolumes(vm) - pvcsErr := v.ownPersistentVolumeClaims(vm) - - return zerrors.NewMultiError(). - AddC("dvsErr", dvsErr). - AddC("pvcsErr", pvcsErr). - AsOptional() -} - -func (v *VMCreator) ownDataVolumes(vm *kubevirtv1.VirtualMachine) error { - ownDVs := v.cliOptions.GetOwnDVNames() - log.Logger().Debug("taking ownership of DataVolumes", zap.Strings("own-dvs", ownDVs)) - var multiError zerrors.MultiError - - dvs, notFoundDVs, dvsErr := v.dataVolumeProvider.GetByName(v.targetNamespace, ownDVs...) - - for idx, dvName := range ownDVs { - if _, ok := notFoundDVs[dvName]; ok { - // DV not found, nothing to do - continue - } - - if err := zerrors.GetErrorFromMultiError(dvsErr, dvName); err != nil { - multiError.Add(dvName, err) - continue - } - - if _, err := v.dataVolumeProvider.AddOwnerReferences(dvs[idx], virtualMachine.AsVMOwnerReference(vm)); err != nil { - multiError.Add(dvName, fmt.Errorf("could not add owner reference to %v DataVolume: %v", dvName, err.Error())) - } - - } - - return multiError.AsOptional() -} - -func (v *VMCreator) ownPersistentVolumeClaims(vm *kubevirtv1.VirtualMachine) error { - ownPVCs := v.cliOptions.GetOwnPVCNames() - log.Logger().Debug("taking ownership of PersistentVolumeClaims", zap.Strings("own-pvcs", ownPVCs)) - var multiError zerrors.MultiError - - pvcs, pvcsErr := v.pvcProvider.GetByName(v.targetNamespace, ownPVCs...) - - for idx, pvcName := range ownPVCs { - if err := zerrors.GetErrorFromMultiError(pvcsErr, pvcName); err != nil { - multiError.Add(pvcName, err) - continue - } - - if _, err := v.pvcProvider.AddOwnerReferences(pvcs[idx], virtualMachine.AsVMOwnerReference(vm)); err != nil { - multiError.Add(pvcName, fmt.Errorf("could not add owner reference to %v PersistentVolumeClaim: %v", pvcName, err.Error())) - } - } - - return multiError.AsOptional() -} diff --git a/modules/create-vm/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go b/modules/create-vm/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go index 764694af2..c2f888998 100644 --- a/modules/create-vm/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go +++ b/modules/create-vm/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go @@ -1,9 +1,3 @@ package testconstants -const ( - Virtio = "virtio" - Scsi = "scsi" - Sata = "sata" -) - const NamespaceTestDefault = "default" diff --git a/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/.gitignore b/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/.gitignore deleted file mode 100644 index daf913b1b..000000000 --- a/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof diff --git a/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/LICENSE b/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/LICENSE deleted file mode 100644 index 8f71f43fe..000000000 --- a/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/README.md b/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/README.md deleted file mode 100644 index 91c03b3fc..000000000 --- a/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# jsonpatch -As per http://jsonpatch.com/ JSON Patch is specified in RFC 6902 from the IETF. - -JSON Patch allows you to generate JSON that describes changes you want to make to a document, so you don't have to send the whole doc. JSON Patch format is supported by HTTP PATCH method, allowing for standards based partial updates via REST APIs. - -```bash -go get github.com/mattbaird/jsonpatch -``` - -I tried some of the other "jsonpatch" go implementations, but none of them could diff two json documents and -generate format like jsonpatch.com specifies. Here's an example of the patch format: - -```json -[ - { "op": "replace", "path": "/baz", "value": "boo" }, - { "op": "add", "path": "/hello", "value": ["world"] }, - { "op": "remove", "path": "/foo"} -] - -``` -The API is super simple -#example -```go -package main - -import ( - "fmt" - "github.com/mattbaird/jsonpatch" -) - -var simpleA = `{"a":100, "b":200, "c":"hello"}` -var simpleB = `{"a":100, "b":200, "c":"goodbye"}` - -func main() { - patch, e := jsonpatch.CreatePatch([]byte(simpleA), []byte(simpleA)) - if e != nil { - fmt.Printf("Error creating JSON patch:%v", e) - return - } - for _, operation := range patch { - fmt.Printf("%s\n", operation.Json()) - } -} -``` - -This code needs more tests, as it's a highly recursive, type-fiddly monster. It's not a lot of code, but it has to deal with a lot of complexity. diff --git a/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/jsonpatch.go b/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/jsonpatch.go deleted file mode 100644 index 295f260f5..000000000 --- a/modules/create-vm/vendor/github.com/mattbaird/jsonpatch/jsonpatch.go +++ /dev/null @@ -1,257 +0,0 @@ -package jsonpatch - -import ( - "bytes" - "encoding/json" - "fmt" - "reflect" - "strings" -) - -var errBadJSONDoc = fmt.Errorf("Invalid JSON Document") - -type JsonPatchOperation struct { - Operation string `json:"op"` - Path string `json:"path"` - Value interface{} `json:"value,omitempty"` -} - -func (j *JsonPatchOperation) Json() string { - b, _ := json.Marshal(j) - return string(b) -} - -func (j *JsonPatchOperation) MarshalJSON() ([]byte, error) { - var b bytes.Buffer - b.WriteString("{") - b.WriteString(fmt.Sprintf(`"op":"%s"`, j.Operation)) - b.WriteString(fmt.Sprintf(`,"path":"%s"`, j.Path)) - // Consider omitting Value for non-nullable operations. - if j.Value != nil || j.Operation == "replace" || j.Operation == "add" { - v, err := json.Marshal(j.Value) - if err != nil { - return nil, err - } - b.WriteString(`,"value":`) - b.Write(v) - } - b.WriteString("}") - return b.Bytes(), nil -} - -type ByPath []JsonPatchOperation - -func (a ByPath) Len() int { return len(a) } -func (a ByPath) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a ByPath) Less(i, j int) bool { return a[i].Path < a[j].Path } - -func NewPatch(operation, path string, value interface{}) JsonPatchOperation { - return JsonPatchOperation{Operation: operation, Path: path, Value: value} -} - -// CreatePatch creates a patch as specified in http://jsonpatch.com/ -// -// 'a' is original, 'b' is the modified document. Both are to be given as json encoded content. -// The function will return an array of JsonPatchOperations -// -// An error will be returned if any of the two documents are invalid. -func CreatePatch(a, b []byte) ([]JsonPatchOperation, error) { - aI := map[string]interface{}{} - bI := map[string]interface{}{} - err := json.Unmarshal(a, &aI) - if err != nil { - return nil, errBadJSONDoc - } - err = json.Unmarshal(b, &bI) - if err != nil { - return nil, errBadJSONDoc - } - return diff(aI, bI, "", []JsonPatchOperation{}) -} - -// Returns true if the values matches (must be json types) -// The types of the values must match, otherwise it will always return false -// If two map[string]interface{} are given, all elements must match. -func matchesValue(av, bv interface{}) bool { - if reflect.TypeOf(av) != reflect.TypeOf(bv) { - return false - } - switch at := av.(type) { - case string: - bt := bv.(string) - if bt == at { - return true - } - case float64: - bt := bv.(float64) - if bt == at { - return true - } - case bool: - bt := bv.(bool) - if bt == at { - return true - } - case map[string]interface{}: - bt := bv.(map[string]interface{}) - for key := range at { - if !matchesValue(at[key], bt[key]) { - return false - } - } - for key := range bt { - if !matchesValue(at[key], bt[key]) { - return false - } - } - return true - case []interface{}: - bt := bv.([]interface{}) - if len(bt) != len(at) { - return false - } - for key := range at { - if !matchesValue(at[key], bt[key]) { - return false - } - } - for key := range bt { - if !matchesValue(at[key], bt[key]) { - return false - } - } - return true - } - return false -} - -// From http://tools.ietf.org/html/rfc6901#section-4 : -// -// Evaluation of each reference token begins by decoding any escaped -// character sequence. This is performed by first transforming any -// occurrence of the sequence '~1' to '/', and then transforming any -// occurrence of the sequence '~0' to '~'. -// TODO decode support: -// var rfc6901Decoder = strings.NewReplacer("~1", "/", "~0", "~") - -var rfc6901Encoder = strings.NewReplacer("~", "~0", "/", "~1") - -func makePath(path string, newPart interface{}) string { - key := rfc6901Encoder.Replace(fmt.Sprintf("%v", newPart)) - if path == "" { - return "/" + key - } - if strings.HasSuffix(path, "/") { - return path + key - } - return path + "/" + key -} - -// diff returns the (recursive) difference between a and b as an array of JsonPatchOperations. -func diff(a, b map[string]interface{}, path string, patch []JsonPatchOperation) ([]JsonPatchOperation, error) { - for key, bv := range b { - p := makePath(path, key) - av, ok := a[key] - // value was added - if !ok { - patch = append(patch, NewPatch("add", p, bv)) - continue - } - // If types have changed, replace completely - if reflect.TypeOf(av) != reflect.TypeOf(bv) { - patch = append(patch, NewPatch("replace", p, bv)) - continue - } - // Types are the same, compare values - var err error - patch, err = handleValues(av, bv, p, patch) - if err != nil { - return nil, err - } - } - // Now add all deleted values as nil - for key := range a { - _, found := b[key] - if !found { - p := makePath(path, key) - - patch = append(patch, NewPatch("remove", p, nil)) - } - } - return patch, nil -} - -func handleValues(av, bv interface{}, p string, patch []JsonPatchOperation) ([]JsonPatchOperation, error) { - var err error - switch at := av.(type) { - case map[string]interface{}: - bt := bv.(map[string]interface{}) - patch, err = diff(at, bt, p, patch) - if err != nil { - return nil, err - } - case string, float64, bool: - if !matchesValue(av, bv) { - patch = append(patch, NewPatch("replace", p, bv)) - } - case []interface{}: - bt, ok := bv.([]interface{}) - if !ok { - // array replaced by non-array - patch = append(patch, NewPatch("replace", p, bv)) - } else if len(at) != len(bt) { - // arrays are not the same length - patch = append(patch, compareArray(at, bt, p)...) - - } else { - for i := range bt { - patch, err = handleValues(at[i], bt[i], makePath(p, i), patch) - if err != nil { - return nil, err - } - } - } - case nil: - switch bv.(type) { - case nil: - // Both nil, fine. - default: - patch = append(patch, NewPatch("add", p, bv)) - } - default: - panic(fmt.Sprintf("Unknown type:%T ", av)) - } - return patch, nil -} - -func compareArray(av, bv []interface{}, p string) []JsonPatchOperation { - retval := []JsonPatchOperation{} - // var err error - for i, v := range av { - found := false - for _, v2 := range bv { - if reflect.DeepEqual(v, v2) { - found = true - break - } - } - if !found { - retval = append(retval, NewPatch("remove", makePath(p, i), nil)) - } - } - - for i, v := range bv { - found := false - for _, v2 := range av { - if reflect.DeepEqual(v, v2) { - found = true - break - } - } - if !found { - retval = append(retval, NewPatch("add", makePath(p, i), v)) - } - } - - return retval -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/doc.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/doc.go deleted file mode 100644 index 85f3dd689..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// +k8s:deepcopy-gen=package -// +k8s:openapi-gen=true - -// Package v1alpha1 is the v1alpha1 version of the API. -// +groupName=cdi.kubevirt.io -package v1alpha1 diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/register.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/register.go deleted file mode 100644 index 11ad78f7b..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/register.go +++ /dev/null @@ -1,46 +0,0 @@ -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - - "kubevirt.io/containerized-data-importer-api/pkg/apis/core" -) - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: core.GroupName, Version: "v1alpha1"} - -//CDIGroupVersionKind group version kind -var CDIGroupVersionKind = schema.GroupVersionKind{Group: SchemeGroupVersion.Group, Version: SchemeGroupVersion.Version, Kind: "CDI"} - -// Kind takes an unqualified kind and returns back a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // SchemeBuilder tbd - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - // AddToScheme tbd - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &DataVolume{}, - &DataVolumeList{}, - &CDIConfig{}, - &CDIConfigList{}, - &CDI{}, - &CDIList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/types.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/types.go deleted file mode 100644 index 358acae41..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/types.go +++ /dev/null @@ -1,534 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - sdkapi "kubevirt.io/controller-lifecycle-operator-sdk/api" -) - -// DataVolume is an abstraction on top of PersistentVolumeClaims to allow easy population of those PersistentVolumeClaims with relation to VirtualMachines -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:object:root=true -// +kubebuilder:resource:shortName=dv;dvs,categories=all -// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The phase the data volume is in" -// +kubebuilder:printcolumn:name="Progress",type="string",JSONPath=".status.progress",description="Transfer progress in percentage if known, N/A otherwise" -// +kubebuilder:printcolumn:name="Restarts",type="integer",JSONPath=".status.restartCount",description="The number of times the transfer has been restarted." -// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" -type DataVolume struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec DataVolumeSpec `json:"spec"` - Status DataVolumeStatus `json:"status,omitempty"` -} - -// DataVolumeSpec defines the DataVolume type specification -type DataVolumeSpec struct { - //Source is the src of the data for the requested DataVolume - Source DataVolumeSource `json:"source"` - //PVC is the PVC specification - PVC *corev1.PersistentVolumeClaimSpec `json:"pvc,omitempty"` - // Storage is the requested storage specification - Storage *StorageSpec `json:"storage,omitempty"` - //PriorityClassName for Importer, Cloner and Uploader pod - PriorityClassName string `json:"priorityClassName,omitempty"` - //DataVolumeContentType options: "kubevirt", "archive" - // +kubebuilder:validation:Enum="kubevirt";"archive" - ContentType DataVolumeContentType `json:"contentType,omitempty"` - // Checkpoints is a list of DataVolumeCheckpoints, representing stages in a multistage import. - Checkpoints []DataVolumeCheckpoint `json:"checkpoints,omitempty"` - // FinalCheckpoint indicates whether the current DataVolumeCheckpoint is the final checkpoint. - FinalCheckpoint bool `json:"finalCheckpoint,omitempty"` - // Preallocation controls whether storage for DataVolumes should be allocated in advance. - Preallocation *bool `json:"preallocation,omitempty"` -} - -// StorageSpec defines the Storage type specification -type StorageSpec struct { - // AccessModes contains the desired access modes the volume should have. - // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1 - // +optional - AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes,omitempty"` - // A label query over volumes to consider for binding. - // +optional - Selector *metav1.LabelSelector `json:"selector,omitempty"` - // Resources represents the minimum resources the volume should have. - // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources - // +optional - Resources corev1.ResourceRequirements `json:"resources,omitempty"` - // VolumeName is the binding reference to the PersistentVolume backing this claim. - // +optional - VolumeName string `json:"volumeName,omitempty"` - // Name of the StorageClass required by the claim. - // More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1 - // +optional - StorageClassName *string `json:"storageClassName,omitempty"` - // volumeMode defines what type of volume is required by the claim. - // Value of Filesystem is implied when not included in claim spec. - // +optional - VolumeMode *corev1.PersistentVolumeMode `json:"volumeMode,omitempty"` - // This field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) * An existing custom resource that implements data population (Alpha) In order to use custom resource types that implement data population, the AnyVolumeDataSource feature gate must be enabled. If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. - // +optional - DataSource *corev1.TypedLocalObjectReference `json:"dataSource,omitempty"` -} - -// DataVolumeCheckpoint defines a stage in a warm migration. -type DataVolumeCheckpoint struct { - // Previous is the identifier of the snapshot from the previous checkpoint. - Previous string `json:"previous"` - // Current is the identifier of the snapshot created for this checkpoint. - Current string `json:"current"` -} - -// DataVolumeContentType represents the types of the imported data -type DataVolumeContentType string - -const ( - // DataVolumeKubeVirt is the content-type of the imported file, defaults to kubevirt - DataVolumeKubeVirt DataVolumeContentType = "kubevirt" - // DataVolumeArchive is the content-type to specify if there is a need to extract the imported archive - DataVolumeArchive DataVolumeContentType = "archive" -) - -// DataVolumeSource represents the source for our Data Volume, this can be HTTP, Imageio, S3, Registry or an existing PVC -type DataVolumeSource struct { - HTTP *DataVolumeSourceHTTP `json:"http,omitempty"` - S3 *DataVolumeSourceS3 `json:"s3,omitempty"` - Registry *DataVolumeSourceRegistry `json:"registry,omitempty"` - PVC *DataVolumeSourcePVC `json:"pvc,omitempty"` - Upload *DataVolumeSourceUpload `json:"upload,omitempty"` - Blank *DataVolumeBlankImage `json:"blank,omitempty"` - Imageio *DataVolumeSourceImageIO `json:"imageio,omitempty"` - VDDK *DataVolumeSourceVDDK `json:"vddk,omitempty"` -} - -// DataVolumeSourcePVC provides the parameters to create a Data Volume from an existing PVC -type DataVolumeSourcePVC struct { - // The namespace of the source PVC - Namespace string `json:"namespace"` - // The name of the source PVC - Name string `json:"name"` -} - -// DataVolumeBlankImage provides the parameters to create a new raw blank image for the PVC -type DataVolumeBlankImage struct{} - -// DataVolumeSourceUpload provides the parameters to create a Data Volume by uploading the source -type DataVolumeSourceUpload struct { -} - -// DataVolumeSourceS3 provides the parameters to create a Data Volume from an S3 source -type DataVolumeSourceS3 struct { - //URL is the url of the S3 source - URL string `json:"url"` - //SecretRef provides the secret reference needed to access the S3 source - SecretRef string `json:"secretRef,omitempty"` - // CertConfigMap is a configmap reference, containing a Certificate Authority(CA) public key, and a base64 encoded pem certificate - // +optional - CertConfigMap string `json:"certConfigMap,omitempty"` -} - -// DataVolumeSourceRegistry provides the parameters to create a Data Volume from an registry source -type DataVolumeSourceRegistry struct { - //URL is the url of the Docker registry source - URL string `json:"url"` - //SecretRef provides the secret reference needed to access the Registry source - SecretRef string `json:"secretRef,omitempty"` - //CertConfigMap provides a reference to the Registry certs - CertConfigMap string `json:"certConfigMap,omitempty"` -} - -// DataVolumeSourceHTTP can be either an http or https endpoint, with an optional basic auth user name and password, and an optional configmap containing additional CAs -type DataVolumeSourceHTTP struct { - // URL is the URL of the http(s) endpoint - URL string `json:"url"` - // SecretRef A Secret reference, the secret should contain accessKeyId (user name) base64 encoded, and secretKey (password) also base64 encoded - // +optional - SecretRef string `json:"secretRef,omitempty"` - // CertConfigMap is a configmap reference, containing a Certificate Authority(CA) public key, and a base64 encoded pem certificate - // +optional - CertConfigMap string `json:"certConfigMap,omitempty"` - // ExtraHeaders is a list of strings containing extra headers to include with HTTP transfer requests - // +optional - ExtraHeaders []string `json:"extraHeaders,omitempty"` - // SecretExtraHeaders is a list of Secret references, each containing an extra HTTP header that may include sensitive information - // +optional - SecretExtraHeaders []string `json:"secretExtraHeaders,omitempty"` -} - -// DataVolumeSourceImageIO provides the parameters to create a Data Volume from an imageio source -type DataVolumeSourceImageIO struct { - //URL is the URL of the ovirt-engine - URL string `json:"url"` - // DiskID provides id of a disk to be imported - DiskID string `json:"diskId"` - //SecretRef provides the secret reference needed to access the ovirt-engine - SecretRef string `json:"secretRef,omitempty"` - //CertConfigMap provides a reference to the CA cert - CertConfigMap string `json:"certConfigMap,omitempty"` -} - -// DataVolumeSourceVDDK provides the parameters to create a Data Volume from a Vmware source -type DataVolumeSourceVDDK struct { - // URL is the URL of the vCenter or ESXi host with the VM to migrate - URL string `json:"url,omitempty"` - // UUID is the UUID of the virtual machine that the backing file is attached to in vCenter/ESXi - UUID string `json:"uuid,omitempty"` - // BackingFile is the path to the virtual hard disk to migrate from vCenter/ESXi - BackingFile string `json:"backingFile,omitempty"` - // Thumbprint is the certificate thumbprint of the vCenter or ESXi host - Thumbprint string `json:"thumbprint,omitempty"` - // SecretRef provides a reference to a secret containing the username and password needed to access the vCenter or ESXi host - SecretRef string `json:"secretRef,omitempty"` - // InitImageURL is an optional URL to an image containing an extracted VDDK library, overrides v2v-vmware config map - InitImageURL string `json:"initImageURL,omitempty"` -} - -// DataVolumeStatus contains the current status of the DataVolume -type DataVolumeStatus struct { - // ClaimName is the name of the underlying PVC used by the DataVolume. - ClaimName string `json:"claimName,omitempty"` - //Phase is the current phase of the data volume - Phase DataVolumePhase `json:"phase,omitempty"` - Progress DataVolumeProgress `json:"progress,omitempty"` - // RestartCount is the number of times the pod populating the DataVolume has restarted - RestartCount int32 `json:"restartCount,omitempty"` - Conditions []DataVolumeCondition `json:"conditions,omitempty" optional:"true"` -} - -//DataVolumeList provides the needed parameters to do request a list of Data Volumes from the system -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type DataVolumeList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items provides a list of DataVolumes - Items []DataVolume `json:"items"` -} - -// DataVolumeCondition represents the state of a data volume condition. -type DataVolumeCondition struct { - Type DataVolumeConditionType `json:"type" description:"type of condition ie. Ready|Bound|Running."` - Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"` - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` - LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime,omitempty"` - Reason string `json:"reason,omitempty" description:"reason for the condition's last transition"` - Message string `json:"message,omitempty" description:"human-readable message indicating details about last transition"` -} - -// DataVolumePhase is the current phase of the DataVolume -type DataVolumePhase string - -// DataVolumeProgress is the current progress of the DataVolume transfer operation. Value between 0 and 100 inclusive, N/A if not available -type DataVolumeProgress string - -// DataVolumeConditionType is the string representation of known condition types -type DataVolumeConditionType string - -const ( - // PhaseUnset represents a data volume with no current phase - PhaseUnset DataVolumePhase = "" - - // Pending represents a data volume with a current phase of Pending - Pending DataVolumePhase = "Pending" - // PVCBound represents a data volume with a current phase of PVCBound - PVCBound DataVolumePhase = "PVCBound" - - // ImportScheduled represents a data volume with a current phase of ImportScheduled - ImportScheduled DataVolumePhase = "ImportScheduled" - - // ImportInProgress represents a data volume with a current phase of ImportInProgress - ImportInProgress DataVolumePhase = "ImportInProgress" - - // CloneScheduled represents a data volume with a current phase of CloneScheduled - CloneScheduled DataVolumePhase = "CloneScheduled" - - // CloneInProgress represents a data volume with a current phase of CloneInProgress - CloneInProgress DataVolumePhase = "CloneInProgress" - - // SnapshotForSmartCloneInProgress represents a data volume with a current phase of SnapshotForSmartCloneInProgress - SnapshotForSmartCloneInProgress DataVolumePhase = "SnapshotForSmartCloneInProgress" - - // SmartClonePVCInProgress represents a data volume with a current phase of SmartClonePVCInProgress - SmartClonePVCInProgress DataVolumePhase = "SmartClonePVCInProgress" - - // UploadScheduled represents a data volume with a current phase of UploadScheduled - UploadScheduled DataVolumePhase = "UploadScheduled" - - // UploadReady represents a data volume with a current phase of UploadReady - UploadReady DataVolumePhase = "UploadReady" - - // WaitForFirstConsumer represents a data volume with a current phase of WaitForFirstConsumer - WaitForFirstConsumer DataVolumePhase = "WaitForFirstConsumer" - - // Succeeded represents a DataVolumePhase of Succeeded - Succeeded DataVolumePhase = "Succeeded" - // Failed represents a DataVolumePhase of Failed - Failed DataVolumePhase = "Failed" - // Unknown represents a DataVolumePhase of Unknown - Unknown DataVolumePhase = "Unknown" - // Paused represents a DataVolumePhase of Paused - Paused DataVolumePhase = "Paused" - - // DataVolumeReady is the condition that indicates if the data volume is ready to be consumed. - DataVolumeReady DataVolumeConditionType = "Ready" - // DataVolumeBound is the condition that indicates if the underlying PVC is bound or not. - DataVolumeBound DataVolumeConditionType = "Bound" - // DataVolumeRunning is the condition that indicates if the import/upload/clone container is running. - DataVolumeRunning DataVolumeConditionType = "Running" -) - -// DataVolumeCloneSourceSubresource is the subresource checked for permission to clone -const DataVolumeCloneSourceSubresource = "source" - -// this has to be here otherwise informer-gen doesn't recognize it -// see https://github.com/kubernetes/code-generator/issues/59 -// +genclient:nonNamespaced - -// CDI is the CDI Operator CRD -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:object:root=true -// +kubebuilder:resource:shortName=cdi;cdis,scope=Cluster -// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase" -type CDI struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec CDISpec `json:"spec"` - // +optional - Status CDIStatus `json:"status"` -} - -// CertConfig contains the tunables for TLS certificates -type CertConfig struct { - // The requested 'duration' (i.e. lifetime) of the Certificate. - Duration *metav1.Duration `json:"duration,omitempty"` - - // The amount of time before the currently issued certificate's `notAfter` - // time that we will begin to attempt to renew the certificate. - RenewBefore *metav1.Duration `json:"renewBefore,omitempty"` -} - -// CDICertConfig has the CertConfigs for CDI -type CDICertConfig struct { - // CA configuration - // CA certs are kept in the CA bundle as long as they are valid - CA *CertConfig `json:"ca,omitempty"` - - // Server configuration - // Certs are rotated and discarded - Server *CertConfig `json:"server,omitempty"` -} - -// CDISpec defines our specification for the CDI installation -type CDISpec struct { - // +kubebuilder:validation:Enum=Always;IfNotPresent;Never - // PullPolicy describes a policy for if/when to pull a container image - ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty" valid:"required"` - // +kubebuilder:validation:Enum=RemoveWorkloads;BlockUninstallIfWorkloadsExist - // CDIUninstallStrategy defines the state to leave CDI on uninstall - UninstallStrategy *CDIUninstallStrategy `json:"uninstallStrategy,omitempty"` - // Rules on which nodes CDI infrastructure pods will be scheduled - Infra sdkapi.NodePlacement `json:"infra,omitempty"` - // Restrict on which nodes CDI workload pods will be scheduled - Workloads sdkapi.NodePlacement `json:"workload,omitempty"` - // Clone strategy override: should we use a host-assisted copy even if snapshots are available? - // +kubebuilder:validation:Enum="copy";"snapshot" - CloneStrategyOverride *CDICloneStrategy `json:"cloneStrategyOverride,omitempty"` - // CDIConfig at CDI level - Config *CDIConfigSpec `json:"config,omitempty"` - // certificate configuration - CertConfig *CDICertConfig `json:"certConfig,omitempty"` -} - -// CDICloneStrategy defines the preferred method for performing a CDI clone (override snapshot?) -type CDICloneStrategy string - -const ( - // CloneStrategyHostAssisted specifies slower, host-assisted copy - CloneStrategyHostAssisted = "copy" - - // CloneStrategySnapshot specifies snapshot-based copying - CloneStrategySnapshot = "snapshot" - - // CloneStrategyCsiClone specifies csi volume clone based cloning - CloneStrategyCsiClone = "csi-clone" -) - -// CDIUninstallStrategy defines the state to leave CDI on uninstall -type CDIUninstallStrategy string - -const ( - // CDIUninstallStrategyRemoveWorkloads specifies clean uninstall - CDIUninstallStrategyRemoveWorkloads CDIUninstallStrategy = "RemoveWorkloads" - - // CDIUninstallStrategyBlockUninstallIfWorkloadsExist "leaves stuff around" - CDIUninstallStrategyBlockUninstallIfWorkloadsExist CDIUninstallStrategy = "BlockUninstallIfWorkloadsExist" -) - -// CDIPhase is the current phase of the CDI deployment -type CDIPhase string - -// CDIStatus defines the status of the installation -type CDIStatus struct { - sdkapi.Status `json:",inline"` -} - -const ( - // CDIPhaseDeploying signals that the CDI resources are being deployed - CDIPhaseDeploying CDIPhase = "Deploying" - - // CDIPhaseDeployed signals that the CDI resources are successflly deployed - CDIPhaseDeployed CDIPhase = "Deployed" - - // CDIPhaseDeleting signals that the CDI resources are being removed - CDIPhaseDeleting CDIPhase = "Deleting" - - // CDIPhaseDeleted signals that the CDI resources are deleted - CDIPhaseDeleted CDIPhase = "Deleted" - - // CDIPhaseError signals that the CDI deployment is in an error state - CDIPhaseError CDIPhase = "Error" - - // CDIPhaseUpgrading signals that the CDI resources are being deployed - CDIPhaseUpgrading CDIPhase = "Upgrading" - - // CDIPhaseEmpty is an uninitialized phase - CDIPhaseEmpty CDIPhase = "" -) - -//CDIList provides the needed parameters to do request a list of CDIs from the system -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type CDIList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items provides a list of CDIs - Items []CDI `json:"items"` -} - -// this has to be here otherwise informer-gen doesn't recognize it -// see https://github.com/kubernetes/code-generator/issues/59 -// +genclient:nonNamespaced - -// CDIConfig provides a user configuration for CDI -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:object:root=true -// +kubebuilder:resource:scope=Cluster -type CDIConfig struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec CDIConfigSpec `json:"spec"` - Status CDIConfigStatus `json:"status,omitempty"` -} - -//Percent is a string that can only be a value between [0,1) -// (Note: we actually rely on reconcile to reject invalid values) -// +kubebuilder:validation:Pattern=`^(0(?:\.\d{1,3})?|1)$` -type Percent string - -//FilesystemOverhead defines the reserved size for PVCs with VolumeMode: Filesystem -type FilesystemOverhead struct { - // Global is how much space of a Filesystem volume should be reserved for overhead. This value is used unless overridden by a more specific value (per storageClass) - Global Percent `json:"global,omitempty"` - // StorageClass specifies how much space of a Filesystem volume should be reserved for safety. The keys are the storageClass and the values are the overhead. This value overrides the global value - StorageClass map[string]Percent `json:"storageClass,omitempty"` -} - -//CDIConfigSpec defines specification for user configuration -type CDIConfigSpec struct { - // Override the URL used when uploading to a DataVolume - UploadProxyURLOverride *string `json:"uploadProxyURLOverride,omitempty"` - // ImportProxy contains importer pod proxy configuration. - // +optional - ImportProxy *ImportProxy `json:"importProxy,omitempty"` - // Override the storage class to used for scratch space during transfer operations. The scratch space storage class is determined in the following order: 1. value of scratchSpaceStorageClass, if that doesn't exist, use the default storage class, if there is no default storage class, use the storage class of the DataVolume, if no storage class specified, use no storage class for scratch space - ScratchSpaceStorageClass *string `json:"scratchSpaceStorageClass,omitempty"` - // ResourceRequirements describes the compute resource requirements. - PodResourceRequirements *corev1.ResourceRequirements `json:"podResourceRequirements,omitempty"` - // FeatureGates are a list of specific enabled feature gates - FeatureGates []string `json:"featureGates,omitempty"` - // FilesystemOverhead describes the space reserved for overhead when using Filesystem volumes. A value is between 0 and 1, if not defined it is 0.055 (5.5% overhead) - FilesystemOverhead *FilesystemOverhead `json:"filesystemOverhead,omitempty"` - // Preallocation controls whether storage for DataVolumes should be allocated in advance. - Preallocation *bool `json:"preallocation,omitempty"` - // InsecureRegistries is a list of TLS disabled registries - InsecureRegistries []string `json:"insecureRegistries,omitempty"` -} - -//CDIConfigStatus provides the most recently observed status of the CDI Config resource -type CDIConfigStatus struct { - // The calculated upload proxy URL - UploadProxyURL *string `json:"uploadProxyURL,omitempty"` - // ImportProxy contains importer pod proxy configuration. - // +optional - ImportProxy *ImportProxy `json:"importProxy,omitempty"` - // The calculated storage class to be used for scratch space - ScratchSpaceStorageClass string `json:"scratchSpaceStorageClass,omitempty"` - // ResourceRequirements describes the compute resource requirements. - DefaultPodResourceRequirements *corev1.ResourceRequirements `json:"defaultPodResourceRequirements,omitempty"` - // FilesystemOverhead describes the space reserved for overhead when using Filesystem volumes. A percentage value is between 0 and 1 - FilesystemOverhead *FilesystemOverhead `json:"filesystemOverhead,omitempty"` - // Preallocation controls whether storage for DataVolumes should be allocated in advance. - Preallocation bool `json:"preallocation,omitempty"` -} - -//CDIConfigList provides the needed parameters to do request a list of CDIConfigs from the system -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type CDIConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - // Items provides a list of CDIConfigs - Items []CDIConfig `json:"items"` -} - -//ImportProxy provides the information on how to configure the importer pod proxy. -type ImportProxy struct { - // HTTPProxy is the URL http://:@: of the import proxy for HTTP requests. Empty means unset and will not result in the import pod env var. - // +optional - HTTPProxy *string `json:"HTTPProxy,omitempty"` - // HTTPSProxy is the URL https://:@: of the import proxy for HTTPS requests. Empty means unset and will not result in the import pod env var. - // +optional - HTTPSProxy *string `json:"HTTPSProxy,omitempty"` - // NoProxy is a comma-separated list of hostnames and/or CIDRs for which the proxy should not be used. Empty means unset and will not result in the import pod env var. - // +optional - NoProxy *string `json:"noProxy,omitempty"` - // TrustedCAProxy is the name of a ConfigMap in the cdi namespace that contains a user-provided trusted certificate authority (CA) bundle. - // The TrustedCAProxy field is consumed by the import controller that is resposible for coping it to a config map named trusted-ca-proxy-bundle-cm in the cdi namespace. - // Here is an example of the ConfigMap (in yaml): - // - // apiVersion: v1 - // kind: ConfigMap - // metadata: - // name: trusted-ca-proxy-bundle-cm - // namespace: cdi - // data: - // ca.pem: | - // -----BEGIN CERTIFICATE----- - // ... ... - // -----END CERTIFICATE----- - // +optional - TrustedCAProxy *string `json:"trustedCAProxy,omitempty"` -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/types_swagger_generated.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/types_swagger_generated.go deleted file mode 100644 index b122a6a91..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/types_swagger_generated.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by swagger-doc. DO NOT EDIT. - -package v1alpha1 - -func (DataVolume) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolume is an abstraction on top of PersistentVolumeClaims to allow easy population of those PersistentVolumeClaims with relation to VirtualMachines\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:resource:shortName=dv;dvs,categories=all\n+kubebuilder:printcolumn:name=\"Phase\",type=\"string\",JSONPath=\".status.phase\",description=\"The phase the data volume is in\"\n+kubebuilder:printcolumn:name=\"Progress\",type=\"string\",JSONPath=\".status.progress\",description=\"Transfer progress in percentage if known, N/A otherwise\"\n+kubebuilder:printcolumn:name=\"Restarts\",type=\"integer\",JSONPath=\".status.restartCount\",description=\"The number of times the transfer has been restarted.\"\n+kubebuilder:printcolumn:name=\"Age\",type=\"date\",JSONPath=\".metadata.creationTimestamp\"", - } -} - -func (DataVolumeSpec) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeSpec defines the DataVolume type specification", - "source": "Source is the src of the data for the requested DataVolume", - "pvc": "PVC is the PVC specification", - "storage": "Storage is the requested storage specification", - "priorityClassName": "PriorityClassName for Importer, Cloner and Uploader pod", - "contentType": "DataVolumeContentType options: \"kubevirt\", \"archive\"\n+kubebuilder:validation:Enum=\"kubevirt\";\"archive\"", - "checkpoints": "Checkpoints is a list of DataVolumeCheckpoints, representing stages in a multistage import.", - "finalCheckpoint": "FinalCheckpoint indicates whether the current DataVolumeCheckpoint is the final checkpoint.", - "preallocation": "Preallocation controls whether storage for DataVolumes should be allocated in advance.", - } -} - -func (StorageSpec) SwaggerDoc() map[string]string { - return map[string]string{ - "": "StorageSpec defines the Storage type specification", - "accessModes": "AccessModes contains the desired access modes the volume should have.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1\n+optional", - "selector": "A label query over volumes to consider for binding.\n+optional", - "resources": "Resources represents the minimum resources the volume should have.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources\n+optional", - "volumeName": "VolumeName is the binding reference to the PersistentVolume backing this claim.\n+optional", - "storageClassName": "Name of the StorageClass required by the claim.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1\n+optional", - "volumeMode": "volumeMode defines what type of volume is required by the claim.\nValue of Filesystem is implied when not included in claim spec.\n+optional", - "dataSource": "This field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) * An existing custom resource that implements data population (Alpha) In order to use custom resource types that implement data population, the AnyVolumeDataSource feature gate must be enabled. If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source.\n+optional", - } -} - -func (DataVolumeCheckpoint) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeCheckpoint defines a stage in a warm migration.", - "previous": "Previous is the identifier of the snapshot from the previous checkpoint.", - "current": "Current is the identifier of the snapshot created for this checkpoint.", - } -} - -func (DataVolumeSource) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeSource represents the source for our Data Volume, this can be HTTP, Imageio, S3, Registry or an existing PVC", - } -} - -func (DataVolumeSourcePVC) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeSourcePVC provides the parameters to create a Data Volume from an existing PVC", - "namespace": "The namespace of the source PVC", - "name": "The name of the source PVC", - } -} - -func (DataVolumeBlankImage) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeBlankImage provides the parameters to create a new raw blank image for the PVC", - } -} - -func (DataVolumeSourceUpload) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeSourceUpload provides the parameters to create a Data Volume by uploading the source", - } -} - -func (DataVolumeSourceS3) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeSourceS3 provides the parameters to create a Data Volume from an S3 source", - "url": "URL is the url of the S3 source", - "secretRef": "SecretRef provides the secret reference needed to access the S3 source", - "certConfigMap": "CertConfigMap is a configmap reference, containing a Certificate Authority(CA) public key, and a base64 encoded pem certificate\n+optional", - } -} - -func (DataVolumeSourceRegistry) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeSourceRegistry provides the parameters to create a Data Volume from an registry source", - "url": "URL is the url of the Docker registry source", - "secretRef": "SecretRef provides the secret reference needed to access the Registry source", - "certConfigMap": "CertConfigMap provides a reference to the Registry certs", - } -} - -func (DataVolumeSourceHTTP) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeSourceHTTP can be either an http or https endpoint, with an optional basic auth user name and password, and an optional configmap containing additional CAs", - "url": "URL is the URL of the http(s) endpoint", - "secretRef": "SecretRef A Secret reference, the secret should contain accessKeyId (user name) base64 encoded, and secretKey (password) also base64 encoded\n+optional", - "certConfigMap": "CertConfigMap is a configmap reference, containing a Certificate Authority(CA) public key, and a base64 encoded pem certificate\n+optional", - "extraHeaders": "ExtraHeaders is a list of strings containing extra headers to include with HTTP transfer requests\n+optional", - "secretExtraHeaders": "SecretExtraHeaders is a list of Secret references, each containing an extra HTTP header that may include sensitive information\n+optional", - } -} - -func (DataVolumeSourceImageIO) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeSourceImageIO provides the parameters to create a Data Volume from an imageio source", - "url": "URL is the URL of the ovirt-engine", - "diskId": "DiskID provides id of a disk to be imported", - "secretRef": "SecretRef provides the secret reference needed to access the ovirt-engine", - "certConfigMap": "CertConfigMap provides a reference to the CA cert", - } -} - -func (DataVolumeSourceVDDK) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeSourceVDDK provides the parameters to create a Data Volume from a Vmware source", - "url": "URL is the URL of the vCenter or ESXi host with the VM to migrate", - "uuid": "UUID is the UUID of the virtual machine that the backing file is attached to in vCenter/ESXi", - "backingFile": "BackingFile is the path to the virtual hard disk to migrate from vCenter/ESXi", - "thumbprint": "Thumbprint is the certificate thumbprint of the vCenter or ESXi host", - "secretRef": "SecretRef provides a reference to a secret containing the username and password needed to access the vCenter or ESXi host", - "initImageURL": "InitImageURL is an optional URL to an image containing an extracted VDDK library, overrides v2v-vmware config map", - } -} - -func (DataVolumeStatus) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeStatus contains the current status of the DataVolume", - "claimName": "ClaimName is the name of the underlying PVC used by the DataVolume.", - "phase": "Phase is the current phase of the data volume", - "restartCount": "RestartCount is the number of times the pod populating the DataVolume has restarted", - } -} - -func (DataVolumeList) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeList provides the needed parameters to do request a list of Data Volumes from the system\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object", - "items": "Items provides a list of DataVolumes", - } -} - -func (DataVolumeCondition) SwaggerDoc() map[string]string { - return map[string]string{ - "": "DataVolumeCondition represents the state of a data volume condition.", - } -} - -func (CDI) SwaggerDoc() map[string]string { - return map[string]string{ - "": "CDI is the CDI Operator CRD\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:resource:shortName=cdi;cdis,scope=Cluster\n+kubebuilder:printcolumn:name=\"Age\",type=\"date\",JSONPath=\".metadata.creationTimestamp\"\n+kubebuilder:printcolumn:name=\"Phase\",type=\"string\",JSONPath=\".status.phase\"", - "status": "+optional", - } -} - -func (CertConfig) SwaggerDoc() map[string]string { - return map[string]string{ - "": "CertConfig contains the tunables for TLS certificates", - "duration": "The requested 'duration' (i.e. lifetime) of the Certificate.", - "renewBefore": "The amount of time before the currently issued certificate's `notAfter`\ntime that we will begin to attempt to renew the certificate.", - } -} - -func (CDICertConfig) SwaggerDoc() map[string]string { - return map[string]string{ - "": "CDICertConfig has the CertConfigs for CDI", - "ca": "CA configuration\nCA certs are kept in the CA bundle as long as they are valid", - "server": "Server configuration\nCerts are rotated and discarded", - } -} - -func (CDISpec) SwaggerDoc() map[string]string { - return map[string]string{ - "": "CDISpec defines our specification for the CDI installation", - "imagePullPolicy": "+kubebuilder:validation:Enum=Always;IfNotPresent;Never\nPullPolicy describes a policy for if/when to pull a container image", - "uninstallStrategy": "+kubebuilder:validation:Enum=RemoveWorkloads;BlockUninstallIfWorkloadsExist\nCDIUninstallStrategy defines the state to leave CDI on uninstall", - "infra": "Rules on which nodes CDI infrastructure pods will be scheduled", - "workload": "Restrict on which nodes CDI workload pods will be scheduled", - "cloneStrategyOverride": "Clone strategy override: should we use a host-assisted copy even if snapshots are available?\n+kubebuilder:validation:Enum=\"copy\";\"snapshot\"", - "config": "CDIConfig at CDI level", - "certConfig": "certificate configuration", - } -} - -func (CDIStatus) SwaggerDoc() map[string]string { - return map[string]string{ - "": "CDIStatus defines the status of the installation", - } -} - -func (CDIList) SwaggerDoc() map[string]string { - return map[string]string{ - "": "CDIList provides the needed parameters to do request a list of CDIs from the system\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object", - "items": "Items provides a list of CDIs", - } -} - -func (CDIConfig) SwaggerDoc() map[string]string { - return map[string]string{ - "": "CDIConfig provides a user configuration for CDI\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:resource:scope=Cluster", - } -} - -func (FilesystemOverhead) SwaggerDoc() map[string]string { - return map[string]string{ - "": "FilesystemOverhead defines the reserved size for PVCs with VolumeMode: Filesystem", - "global": "Global is how much space of a Filesystem volume should be reserved for overhead. This value is used unless overridden by a more specific value (per storageClass)", - "storageClass": "StorageClass specifies how much space of a Filesystem volume should be reserved for safety. The keys are the storageClass and the values are the overhead. This value overrides the global value", - } -} - -func (CDIConfigSpec) SwaggerDoc() map[string]string { - return map[string]string{ - "": "CDIConfigSpec defines specification for user configuration", - "uploadProxyURLOverride": "Override the URL used when uploading to a DataVolume", - "importProxy": "ImportProxy contains importer pod proxy configuration.\n+optional", - "scratchSpaceStorageClass": "Override the storage class to used for scratch space during transfer operations. The scratch space storage class is determined in the following order: 1. value of scratchSpaceStorageClass, if that doesn't exist, use the default storage class, if there is no default storage class, use the storage class of the DataVolume, if no storage class specified, use no storage class for scratch space", - "podResourceRequirements": "ResourceRequirements describes the compute resource requirements.", - "featureGates": "FeatureGates are a list of specific enabled feature gates", - "filesystemOverhead": "FilesystemOverhead describes the space reserved for overhead when using Filesystem volumes. A value is between 0 and 1, if not defined it is 0.055 (5.5% overhead)", - "preallocation": "Preallocation controls whether storage for DataVolumes should be allocated in advance.", - "insecureRegistries": "InsecureRegistries is a list of TLS disabled registries", - } -} - -func (CDIConfigStatus) SwaggerDoc() map[string]string { - return map[string]string{ - "": "CDIConfigStatus provides the most recently observed status of the CDI Config resource", - "uploadProxyURL": "The calculated upload proxy URL", - "importProxy": "ImportProxy contains importer pod proxy configuration.\n+optional", - "scratchSpaceStorageClass": "The calculated storage class to be used for scratch space", - "defaultPodResourceRequirements": "ResourceRequirements describes the compute resource requirements.", - "filesystemOverhead": "FilesystemOverhead describes the space reserved for overhead when using Filesystem volumes. A percentage value is between 0 and 1", - "preallocation": "Preallocation controls whether storage for DataVolumes should be allocated in advance.", - } -} - -func (CDIConfigList) SwaggerDoc() map[string]string { - return map[string]string{ - "": "CDIConfigList provides the needed parameters to do request a list of CDIConfigs from the system\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object", - "items": "Items provides a list of CDIConfigs", - } -} - -func (ImportProxy) SwaggerDoc() map[string]string { - return map[string]string{ - "": "ImportProxy provides the information on how to configure the importer pod proxy.", - "HTTPProxy": "HTTPProxy is the URL http://:@: of the import proxy for HTTP requests. Empty means unset and will not result in the import pod env var.\n+optional", - "HTTPSProxy": "HTTPSProxy is the URL https://:@: of the import proxy for HTTPS requests. Empty means unset and will not result in the import pod env var.\n+optional", - "noProxy": "NoProxy is a comma-separated list of hostnames and/or CIDRs for which the proxy should not be used. Empty means unset and will not result in the import pod env var.\n+optional", - "trustedCAProxy": "TrustedCAProxy is the name of a ConfigMap in the cdi namespace that contains a user-provided trusted certificate authority (CA) bundle.\nThe TrustedCAProxy field is consumed by the import controller that is resposible for coping it to a config map named trusted-ca-proxy-bundle-cm in the cdi namespace.\nHere is an example of the ConfigMap (in yaml):\n\napiVersion: v1\nkind: ConfigMap\nmetadata:\n name: trusted-ca-proxy-bundle-cm\n namespace: cdi\ndata:\n ca.pem: |", - } -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/utils.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/utils.go deleted file mode 100644 index 9a7b6fa34..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/utils.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 2020 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// IsPopulated indicates if the persistent volume passed in has been fully populated. It follow the following logic -// 1. If the PVC is not owned by a DataVolume, return true, we assume someone else has properly populated the image -// 2. If the PVC is owned by a DataVolume, look up the DV and check the phase, if phase succeeded return true -// 3. If the PVC is owned by a DataVolume, look up the DV and check the phase, if phase !succeeded return false -func IsPopulated(pvc *corev1.PersistentVolumeClaim, getDvFunc func(name, namespace string) (*DataVolume, error)) (bool, error) { - pvcOwner := metav1.GetControllerOf(pvc) - if pvcOwner != nil && pvcOwner.Kind == "DataVolume" { - // Find the data volume: - dv, err := getDvFunc(pvcOwner.Name, pvc.Namespace) - if err != nil { - return false, err - } - if dv.Status.Phase != Succeeded { - return false, nil - } - } - return true, nil -} - -// IsWaitForFirstConsumerBeforePopulating indicates if the persistent volume passed in is in ClaimPending state and waiting for first consumer. -// It follow the following logic -// 1. If the PVC is not owned by a DataVolume, return false, we can not assume it will be populated -// 2. If the PVC is owned by a DataVolume, look up the DV and check the phase, if phase WaitForFirstConsumer return true -// 3. If the PVC is owned by a DataVolume, look up the DV and check the phase, if phase !WaitForFirstConsumer return false -func IsWaitForFirstConsumerBeforePopulating(pvc *corev1.PersistentVolumeClaim, getDvFunc func(name, namespace string) (*DataVolume, error)) (bool, error) { - pvcOwner := metav1.GetControllerOf(pvc) - if pvcOwner != nil && pvcOwner.Kind == "DataVolume" { - // Find the data volume: - dv, err := getDvFunc(pvcOwner.Name, pvc.Namespace) - if err != nil { - return false, err - } - if dv.Status.Phase == WaitForFirstConsumer { - return true, nil - } - } - return false, nil -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index eb0152d56..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,799 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CDI) DeepCopyInto(out *CDI) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDI. -func (in *CDI) DeepCopy() *CDI { - if in == nil { - return nil - } - out := new(CDI) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CDI) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CDICertConfig) DeepCopyInto(out *CDICertConfig) { - *out = *in - if in.CA != nil { - in, out := &in.CA, &out.CA - *out = new(CertConfig) - (*in).DeepCopyInto(*out) - } - if in.Server != nil { - in, out := &in.Server, &out.Server - *out = new(CertConfig) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDICertConfig. -func (in *CDICertConfig) DeepCopy() *CDICertConfig { - if in == nil { - return nil - } - out := new(CDICertConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CDIConfig) DeepCopyInto(out *CDIConfig) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIConfig. -func (in *CDIConfig) DeepCopy() *CDIConfig { - if in == nil { - return nil - } - out := new(CDIConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CDIConfig) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CDIConfigList) DeepCopyInto(out *CDIConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CDIConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIConfigList. -func (in *CDIConfigList) DeepCopy() *CDIConfigList { - if in == nil { - return nil - } - out := new(CDIConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CDIConfigList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CDIConfigSpec) DeepCopyInto(out *CDIConfigSpec) { - *out = *in - if in.UploadProxyURLOverride != nil { - in, out := &in.UploadProxyURLOverride, &out.UploadProxyURLOverride - *out = new(string) - **out = **in - } - if in.ImportProxy != nil { - in, out := &in.ImportProxy, &out.ImportProxy - *out = new(ImportProxy) - (*in).DeepCopyInto(*out) - } - if in.ScratchSpaceStorageClass != nil { - in, out := &in.ScratchSpaceStorageClass, &out.ScratchSpaceStorageClass - *out = new(string) - **out = **in - } - if in.PodResourceRequirements != nil { - in, out := &in.PodResourceRequirements, &out.PodResourceRequirements - *out = new(v1.ResourceRequirements) - (*in).DeepCopyInto(*out) - } - if in.FeatureGates != nil { - in, out := &in.FeatureGates, &out.FeatureGates - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.FilesystemOverhead != nil { - in, out := &in.FilesystemOverhead, &out.FilesystemOverhead - *out = new(FilesystemOverhead) - (*in).DeepCopyInto(*out) - } - if in.Preallocation != nil { - in, out := &in.Preallocation, &out.Preallocation - *out = new(bool) - **out = **in - } - if in.InsecureRegistries != nil { - in, out := &in.InsecureRegistries, &out.InsecureRegistries - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIConfigSpec. -func (in *CDIConfigSpec) DeepCopy() *CDIConfigSpec { - if in == nil { - return nil - } - out := new(CDIConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CDIConfigStatus) DeepCopyInto(out *CDIConfigStatus) { - *out = *in - if in.UploadProxyURL != nil { - in, out := &in.UploadProxyURL, &out.UploadProxyURL - *out = new(string) - **out = **in - } - if in.ImportProxy != nil { - in, out := &in.ImportProxy, &out.ImportProxy - *out = new(ImportProxy) - (*in).DeepCopyInto(*out) - } - if in.DefaultPodResourceRequirements != nil { - in, out := &in.DefaultPodResourceRequirements, &out.DefaultPodResourceRequirements - *out = new(v1.ResourceRequirements) - (*in).DeepCopyInto(*out) - } - if in.FilesystemOverhead != nil { - in, out := &in.FilesystemOverhead, &out.FilesystemOverhead - *out = new(FilesystemOverhead) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIConfigStatus. -func (in *CDIConfigStatus) DeepCopy() *CDIConfigStatus { - if in == nil { - return nil - } - out := new(CDIConfigStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CDIList) DeepCopyInto(out *CDIList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]CDI, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIList. -func (in *CDIList) DeepCopy() *CDIList { - if in == nil { - return nil - } - out := new(CDIList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *CDIList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CDISpec) DeepCopyInto(out *CDISpec) { - *out = *in - if in.UninstallStrategy != nil { - in, out := &in.UninstallStrategy, &out.UninstallStrategy - *out = new(CDIUninstallStrategy) - **out = **in - } - in.Infra.DeepCopyInto(&out.Infra) - in.Workloads.DeepCopyInto(&out.Workloads) - if in.CloneStrategyOverride != nil { - in, out := &in.CloneStrategyOverride, &out.CloneStrategyOverride - *out = new(CDICloneStrategy) - **out = **in - } - if in.Config != nil { - in, out := &in.Config, &out.Config - *out = new(CDIConfigSpec) - (*in).DeepCopyInto(*out) - } - if in.CertConfig != nil { - in, out := &in.CertConfig, &out.CertConfig - *out = new(CDICertConfig) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDISpec. -func (in *CDISpec) DeepCopy() *CDISpec { - if in == nil { - return nil - } - out := new(CDISpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CDIStatus) DeepCopyInto(out *CDIStatus) { - *out = *in - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIStatus. -func (in *CDIStatus) DeepCopy() *CDIStatus { - if in == nil { - return nil - } - out := new(CDIStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CertConfig) DeepCopyInto(out *CertConfig) { - *out = *in - if in.Duration != nil { - in, out := &in.Duration, &out.Duration - *out = new(metav1.Duration) - **out = **in - } - if in.RenewBefore != nil { - in, out := &in.RenewBefore, &out.RenewBefore - *out = new(metav1.Duration) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertConfig. -func (in *CertConfig) DeepCopy() *CertConfig { - if in == nil { - return nil - } - out := new(CertConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolume) DeepCopyInto(out *DataVolume) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolume. -func (in *DataVolume) DeepCopy() *DataVolume { - if in == nil { - return nil - } - out := new(DataVolume) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *DataVolume) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeBlankImage) DeepCopyInto(out *DataVolumeBlankImage) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeBlankImage. -func (in *DataVolumeBlankImage) DeepCopy() *DataVolumeBlankImage { - if in == nil { - return nil - } - out := new(DataVolumeBlankImage) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeCheckpoint) DeepCopyInto(out *DataVolumeCheckpoint) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeCheckpoint. -func (in *DataVolumeCheckpoint) DeepCopy() *DataVolumeCheckpoint { - if in == nil { - return nil - } - out := new(DataVolumeCheckpoint) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeCondition) DeepCopyInto(out *DataVolumeCondition) { - *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - in.LastHeartbeatTime.DeepCopyInto(&out.LastHeartbeatTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeCondition. -func (in *DataVolumeCondition) DeepCopy() *DataVolumeCondition { - if in == nil { - return nil - } - out := new(DataVolumeCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeList) DeepCopyInto(out *DataVolumeList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]DataVolume, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeList. -func (in *DataVolumeList) DeepCopy() *DataVolumeList { - if in == nil { - return nil - } - out := new(DataVolumeList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *DataVolumeList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeSource) DeepCopyInto(out *DataVolumeSource) { - *out = *in - if in.HTTP != nil { - in, out := &in.HTTP, &out.HTTP - *out = new(DataVolumeSourceHTTP) - (*in).DeepCopyInto(*out) - } - if in.S3 != nil { - in, out := &in.S3, &out.S3 - *out = new(DataVolumeSourceS3) - **out = **in - } - if in.Registry != nil { - in, out := &in.Registry, &out.Registry - *out = new(DataVolumeSourceRegistry) - **out = **in - } - if in.PVC != nil { - in, out := &in.PVC, &out.PVC - *out = new(DataVolumeSourcePVC) - **out = **in - } - if in.Upload != nil { - in, out := &in.Upload, &out.Upload - *out = new(DataVolumeSourceUpload) - **out = **in - } - if in.Blank != nil { - in, out := &in.Blank, &out.Blank - *out = new(DataVolumeBlankImage) - **out = **in - } - if in.Imageio != nil { - in, out := &in.Imageio, &out.Imageio - *out = new(DataVolumeSourceImageIO) - **out = **in - } - if in.VDDK != nil { - in, out := &in.VDDK, &out.VDDK - *out = new(DataVolumeSourceVDDK) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSource. -func (in *DataVolumeSource) DeepCopy() *DataVolumeSource { - if in == nil { - return nil - } - out := new(DataVolumeSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeSourceHTTP) DeepCopyInto(out *DataVolumeSourceHTTP) { - *out = *in - if in.ExtraHeaders != nil { - in, out := &in.ExtraHeaders, &out.ExtraHeaders - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.SecretExtraHeaders != nil { - in, out := &in.SecretExtraHeaders, &out.SecretExtraHeaders - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourceHTTP. -func (in *DataVolumeSourceHTTP) DeepCopy() *DataVolumeSourceHTTP { - if in == nil { - return nil - } - out := new(DataVolumeSourceHTTP) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeSourceImageIO) DeepCopyInto(out *DataVolumeSourceImageIO) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourceImageIO. -func (in *DataVolumeSourceImageIO) DeepCopy() *DataVolumeSourceImageIO { - if in == nil { - return nil - } - out := new(DataVolumeSourceImageIO) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeSourcePVC) DeepCopyInto(out *DataVolumeSourcePVC) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourcePVC. -func (in *DataVolumeSourcePVC) DeepCopy() *DataVolumeSourcePVC { - if in == nil { - return nil - } - out := new(DataVolumeSourcePVC) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeSourceRegistry) DeepCopyInto(out *DataVolumeSourceRegistry) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourceRegistry. -func (in *DataVolumeSourceRegistry) DeepCopy() *DataVolumeSourceRegistry { - if in == nil { - return nil - } - out := new(DataVolumeSourceRegistry) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeSourceS3) DeepCopyInto(out *DataVolumeSourceS3) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourceS3. -func (in *DataVolumeSourceS3) DeepCopy() *DataVolumeSourceS3 { - if in == nil { - return nil - } - out := new(DataVolumeSourceS3) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeSourceUpload) DeepCopyInto(out *DataVolumeSourceUpload) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourceUpload. -func (in *DataVolumeSourceUpload) DeepCopy() *DataVolumeSourceUpload { - if in == nil { - return nil - } - out := new(DataVolumeSourceUpload) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeSourceVDDK) DeepCopyInto(out *DataVolumeSourceVDDK) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourceVDDK. -func (in *DataVolumeSourceVDDK) DeepCopy() *DataVolumeSourceVDDK { - if in == nil { - return nil - } - out := new(DataVolumeSourceVDDK) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeSpec) DeepCopyInto(out *DataVolumeSpec) { - *out = *in - in.Source.DeepCopyInto(&out.Source) - if in.PVC != nil { - in, out := &in.PVC, &out.PVC - *out = new(v1.PersistentVolumeClaimSpec) - (*in).DeepCopyInto(*out) - } - if in.Storage != nil { - in, out := &in.Storage, &out.Storage - *out = new(StorageSpec) - (*in).DeepCopyInto(*out) - } - if in.Checkpoints != nil { - in, out := &in.Checkpoints, &out.Checkpoints - *out = make([]DataVolumeCheckpoint, len(*in)) - copy(*out, *in) - } - if in.Preallocation != nil { - in, out := &in.Preallocation, &out.Preallocation - *out = new(bool) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSpec. -func (in *DataVolumeSpec) DeepCopy() *DataVolumeSpec { - if in == nil { - return nil - } - out := new(DataVolumeSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataVolumeStatus) DeepCopyInto(out *DataVolumeStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]DataVolumeCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeStatus. -func (in *DataVolumeStatus) DeepCopy() *DataVolumeStatus { - if in == nil { - return nil - } - out := new(DataVolumeStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FilesystemOverhead) DeepCopyInto(out *FilesystemOverhead) { - *out = *in - if in.StorageClass != nil { - in, out := &in.StorageClass, &out.StorageClass - *out = make(map[string]Percent, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FilesystemOverhead. -func (in *FilesystemOverhead) DeepCopy() *FilesystemOverhead { - if in == nil { - return nil - } - out := new(FilesystemOverhead) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ImportProxy) DeepCopyInto(out *ImportProxy) { - *out = *in - if in.HTTPProxy != nil { - in, out := &in.HTTPProxy, &out.HTTPProxy - *out = new(string) - **out = **in - } - if in.HTTPSProxy != nil { - in, out := &in.HTTPSProxy, &out.HTTPSProxy - *out = new(string) - **out = **in - } - if in.NoProxy != nil { - in, out := &in.NoProxy, &out.NoProxy - *out = new(string) - **out = **in - } - if in.TrustedCAProxy != nil { - in, out := &in.TrustedCAProxy, &out.TrustedCAProxy - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportProxy. -func (in *ImportProxy) DeepCopy() *ImportProxy { - if in == nil { - return nil - } - out := new(ImportProxy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *StorageSpec) DeepCopyInto(out *StorageSpec) { - *out = *in - if in.AccessModes != nil { - in, out := &in.AccessModes, &out.AccessModes - *out = make([]v1.PersistentVolumeAccessMode, len(*in)) - copy(*out, *in) - } - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = new(metav1.LabelSelector) - (*in).DeepCopyInto(*out) - } - in.Resources.DeepCopyInto(&out.Resources) - if in.StorageClassName != nil { - in, out := &in.StorageClassName, &out.StorageClassName - *out = new(string) - **out = **in - } - if in.VolumeMode != nil { - in, out := &in.VolumeMode, &out.VolumeMode - *out = new(v1.PersistentVolumeMode) - **out = **in - } - if in.DataSource != nil { - in, out := &in.DataSource, &out.DataSource - *out = new(v1.TypedLocalObjectReference) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageSpec. -func (in *StorageSpec) DeepCopy() *StorageSpec { - if in == nil { - return nil - } - out := new(StorageSpec) - in.DeepCopyInto(out) - return out -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/doc.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/doc.go deleted file mode 100644 index 25dc8f125..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// +k8s:deepcopy-gen=package -// +k8s:openapi-gen=true - -// Package v1alpha1 is the v1alpha1 version of the API. -// +groupName=upload.cdi.kubevirt.io -package v1alpha1 diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/register.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/register.go deleted file mode 100644 index 50b1fe6fa..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/register.go +++ /dev/null @@ -1,39 +0,0 @@ -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - - "kubevirt.io/containerized-data-importer-api/pkg/apis/upload" -) - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: upload.GroupName, Version: "v1alpha1"} - -// Kind takes an unqualified kind and returns back a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - // SchemeBuilder tbd - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - // AddToScheme tbd - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &UploadTokenRequest{}, - &UploadTokenRequestList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/types.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/types.go deleted file mode 100644 index 6af8b65f3..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/types.go +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// UploadTokenRequest is the CR used to initiate a CDI upload -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type UploadTokenRequest struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec contains the parameters of the request - Spec UploadTokenRequestSpec `json:"spec"` - - // Status contains the status of the request - Status UploadTokenRequestStatus `json:"status,omitempty"` -} - -// UploadTokenRequestSpec defines the parameters of the token request -type UploadTokenRequestSpec struct { - // PvcName is the name of the PVC to upload to - PvcName string `json:"pvcName"` -} - -// UploadTokenRequestStatus stores the status of a token request -type UploadTokenRequestStatus struct { - // Token is a JWT token to be inserted in "Authentication Bearer header" - Token string `json:"token,omitempty"` -} - -// UploadTokenRequestList contains a list of UploadTokenRequests -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type UploadTokenRequestList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - - // Items contains a list of UploadTokenRequests - Items []UploadTokenRequest `json:"items"` -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/types_swagger_generated.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/types_swagger_generated.go deleted file mode 100644 index 8017a6edc..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/types_swagger_generated.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by swagger-doc. DO NOT EDIT. - -package v1alpha1 - -func (UploadTokenRequest) SwaggerDoc() map[string]string { - return map[string]string{ - "": "UploadTokenRequest is the CR used to initiate a CDI upload\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object", - "spec": "Spec contains the parameters of the request", - "status": "Status contains the status of the request", - } -} - -func (UploadTokenRequestSpec) SwaggerDoc() map[string]string { - return map[string]string{ - "": "UploadTokenRequestSpec defines the parameters of the token request", - "pvcName": "PvcName is the name of the PVC to upload to", - } -} - -func (UploadTokenRequestStatus) SwaggerDoc() map[string]string { - return map[string]string{ - "": "UploadTokenRequestStatus stores the status of a token request", - "token": "Token is a JWT token to be inserted in \"Authentication Bearer header\"", - } -} - -func (UploadTokenRequestList) SwaggerDoc() map[string]string { - return map[string]string{ - "": "UploadTokenRequestList contains a list of UploadTokenRequests\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object", - "items": "Items contains a list of UploadTokenRequests", - } -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/zz_generated.deepcopy.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index c78868aa3..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,119 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UploadTokenRequest) DeepCopyInto(out *UploadTokenRequest) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UploadTokenRequest. -func (in *UploadTokenRequest) DeepCopy() *UploadTokenRequest { - if in == nil { - return nil - } - out := new(UploadTokenRequest) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *UploadTokenRequest) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UploadTokenRequestList) DeepCopyInto(out *UploadTokenRequestList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]UploadTokenRequest, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UploadTokenRequestList. -func (in *UploadTokenRequestList) DeepCopy() *UploadTokenRequestList { - if in == nil { - return nil - } - out := new(UploadTokenRequestList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *UploadTokenRequestList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UploadTokenRequestSpec) DeepCopyInto(out *UploadTokenRequestSpec) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UploadTokenRequestSpec. -func (in *UploadTokenRequestSpec) DeepCopy() *UploadTokenRequestSpec { - if in == nil { - return nil - } - out := new(UploadTokenRequestSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *UploadTokenRequestStatus) DeepCopyInto(out *UploadTokenRequestStatus) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UploadTokenRequestStatus. -func (in *UploadTokenRequestStatus) DeepCopy() *UploadTokenRequestStatus { - if in == nil { - return nil - } - out := new(UploadTokenRequestStatus) - in.DeepCopyInto(out) - return out -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/LICENSE b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/LICENSE deleted file mode 100644 index 549d874d4..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2017 The KubeVirt Authors - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/BUILD.bazel b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/BUILD.bazel deleted file mode 100644 index bebd8a0d2..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/BUILD.bazel +++ /dev/null @@ -1,22 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = [ - "doc.go", - "register.go", - ], - importpath = "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme", - visibility = ["//visibility:public"], - deps = [ - "//staging/src/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1:go_default_library", - "//staging/src/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1:go_default_library", - "//staging/src/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1:go_default_library", - "//staging/src/kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1beta1:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library", - ], -) diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/doc.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/doc.go deleted file mode 100644 index eec0cb9d2..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/register.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/register.go deleted file mode 100644 index ee65cbd21..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package scheme - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - cdiv1alpha1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1" - cdiv1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" - uploadv1alpha1 "kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1" - uploadv1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1beta1" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - cdiv1alpha1.AddToScheme, - cdiv1beta1.AddToScheme, - uploadv1alpha1.AddToScheme, - uploadv1beta1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(Scheme)) -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/BUILD.bazel b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/BUILD.bazel deleted file mode 100644 index 8fafd9a2a..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/BUILD.bazel +++ /dev/null @@ -1,27 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = [ - "cdi.go", - "cdiconfig.go", - "core_client.go", - "dataimportcron.go", - "datasource.go", - "datavolume.go", - "doc.go", - "generated_expansion.go", - "objecttransfer.go", - "storageprofile.go", - ], - importpath = "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1", - visibility = ["//visibility:public"], - deps = [ - "//pkg/client/clientset/versioned/scheme:go_default_library", - "//staging/src/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/watch:go_default_library", - "//vendor/k8s.io/client-go/rest:go_default_library", - ], -) diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/cdi.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/cdi.go deleted file mode 100644 index 03984867e..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/cdi.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" - scheme "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme" -) - -// CDIsGetter has a method to return a CDIInterface. -// A group's client should implement this interface. -type CDIsGetter interface { - CDIs() CDIInterface -} - -// CDIInterface has methods to work with CDI resources. -type CDIInterface interface { - Create(ctx context.Context, cDI *v1beta1.CDI, opts v1.CreateOptions) (*v1beta1.CDI, error) - Update(ctx context.Context, cDI *v1beta1.CDI, opts v1.UpdateOptions) (*v1beta1.CDI, error) - UpdateStatus(ctx context.Context, cDI *v1beta1.CDI, opts v1.UpdateOptions) (*v1beta1.CDI, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.CDI, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.CDIList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.CDI, err error) - CDIExpansion -} - -// cDIs implements CDIInterface -type cDIs struct { - client rest.Interface -} - -// newCDIs returns a CDIs -func newCDIs(c *CdiV1beta1Client) *cDIs { - return &cDIs{ - client: c.RESTClient(), - } -} - -// Get takes name of the cDI, and returns the corresponding cDI object, and an error if there is any. -func (c *cDIs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.CDI, err error) { - result = &v1beta1.CDI{} - err = c.client.Get(). - Resource("cdis"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CDIs that match those selectors. -func (c *cDIs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.CDIList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.CDIList{} - err = c.client.Get(). - Resource("cdis"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cDIs. -func (c *cDIs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("cdis"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cDI and creates it. Returns the server's representation of the cDI, and an error, if there is any. -func (c *cDIs) Create(ctx context.Context, cDI *v1beta1.CDI, opts v1.CreateOptions) (result *v1beta1.CDI, err error) { - result = &v1beta1.CDI{} - err = c.client.Post(). - Resource("cdis"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cDI). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cDI and updates it. Returns the server's representation of the cDI, and an error, if there is any. -func (c *cDIs) Update(ctx context.Context, cDI *v1beta1.CDI, opts v1.UpdateOptions) (result *v1beta1.CDI, err error) { - result = &v1beta1.CDI{} - err = c.client.Put(). - Resource("cdis"). - Name(cDI.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cDI). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *cDIs) UpdateStatus(ctx context.Context, cDI *v1beta1.CDI, opts v1.UpdateOptions) (result *v1beta1.CDI, err error) { - result = &v1beta1.CDI{} - err = c.client.Put(). - Resource("cdis"). - Name(cDI.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cDI). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cDI and deletes it. Returns an error if one occurs. -func (c *cDIs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("cdis"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cDIs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("cdis"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cDI. -func (c *cDIs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.CDI, err error) { - result = &v1beta1.CDI{} - err = c.client.Patch(pt). - Resource("cdis"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/cdiconfig.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/cdiconfig.go deleted file mode 100644 index 086754add..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/cdiconfig.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" - scheme "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme" -) - -// CDIConfigsGetter has a method to return a CDIConfigInterface. -// A group's client should implement this interface. -type CDIConfigsGetter interface { - CDIConfigs() CDIConfigInterface -} - -// CDIConfigInterface has methods to work with CDIConfig resources. -type CDIConfigInterface interface { - Create(ctx context.Context, cDIConfig *v1beta1.CDIConfig, opts v1.CreateOptions) (*v1beta1.CDIConfig, error) - Update(ctx context.Context, cDIConfig *v1beta1.CDIConfig, opts v1.UpdateOptions) (*v1beta1.CDIConfig, error) - UpdateStatus(ctx context.Context, cDIConfig *v1beta1.CDIConfig, opts v1.UpdateOptions) (*v1beta1.CDIConfig, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.CDIConfig, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.CDIConfigList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.CDIConfig, err error) - CDIConfigExpansion -} - -// cDIConfigs implements CDIConfigInterface -type cDIConfigs struct { - client rest.Interface -} - -// newCDIConfigs returns a CDIConfigs -func newCDIConfigs(c *CdiV1beta1Client) *cDIConfigs { - return &cDIConfigs{ - client: c.RESTClient(), - } -} - -// Get takes name of the cDIConfig, and returns the corresponding cDIConfig object, and an error if there is any. -func (c *cDIConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.CDIConfig, err error) { - result = &v1beta1.CDIConfig{} - err = c.client.Get(). - Resource("cdiconfigs"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of CDIConfigs that match those selectors. -func (c *cDIConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.CDIConfigList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.CDIConfigList{} - err = c.client.Get(). - Resource("cdiconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested cDIConfigs. -func (c *cDIConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("cdiconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a cDIConfig and creates it. Returns the server's representation of the cDIConfig, and an error, if there is any. -func (c *cDIConfigs) Create(ctx context.Context, cDIConfig *v1beta1.CDIConfig, opts v1.CreateOptions) (result *v1beta1.CDIConfig, err error) { - result = &v1beta1.CDIConfig{} - err = c.client.Post(). - Resource("cdiconfigs"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cDIConfig). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a cDIConfig and updates it. Returns the server's representation of the cDIConfig, and an error, if there is any. -func (c *cDIConfigs) Update(ctx context.Context, cDIConfig *v1beta1.CDIConfig, opts v1.UpdateOptions) (result *v1beta1.CDIConfig, err error) { - result = &v1beta1.CDIConfig{} - err = c.client.Put(). - Resource("cdiconfigs"). - Name(cDIConfig.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cDIConfig). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *cDIConfigs) UpdateStatus(ctx context.Context, cDIConfig *v1beta1.CDIConfig, opts v1.UpdateOptions) (result *v1beta1.CDIConfig, err error) { - result = &v1beta1.CDIConfig{} - err = c.client.Put(). - Resource("cdiconfigs"). - Name(cDIConfig.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(cDIConfig). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the cDIConfig and deletes it. Returns an error if one occurs. -func (c *cDIConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("cdiconfigs"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *cDIConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("cdiconfigs"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched cDIConfig. -func (c *cDIConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.CDIConfig, err error) { - result = &v1beta1.CDIConfig{} - err = c.client.Patch(pt). - Resource("cdiconfigs"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/core_client.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/core_client.go deleted file mode 100644 index 340c75b94..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/core_client.go +++ /dev/null @@ -1,137 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "net/http" - - rest "k8s.io/client-go/rest" - v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" - "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme" -) - -type CdiV1beta1Interface interface { - RESTClient() rest.Interface - CDIsGetter - CDIConfigsGetter - DataImportCronsGetter - DataSourcesGetter - DataVolumesGetter - ObjectTransfersGetter - StorageProfilesGetter -} - -// CdiV1beta1Client is used to interact with features provided by the cdi.kubevirt.io group. -type CdiV1beta1Client struct { - restClient rest.Interface -} - -func (c *CdiV1beta1Client) CDIs() CDIInterface { - return newCDIs(c) -} - -func (c *CdiV1beta1Client) CDIConfigs() CDIConfigInterface { - return newCDIConfigs(c) -} - -func (c *CdiV1beta1Client) DataImportCrons(namespace string) DataImportCronInterface { - return newDataImportCrons(c, namespace) -} - -func (c *CdiV1beta1Client) DataSources(namespace string) DataSourceInterface { - return newDataSources(c, namespace) -} - -func (c *CdiV1beta1Client) DataVolumes(namespace string) DataVolumeInterface { - return newDataVolumes(c, namespace) -} - -func (c *CdiV1beta1Client) ObjectTransfers() ObjectTransferInterface { - return newObjectTransfers(c) -} - -func (c *CdiV1beta1Client) StorageProfiles() StorageProfileInterface { - return newStorageProfiles(c) -} - -// NewForConfig creates a new CdiV1beta1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*CdiV1beta1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - httpClient, err := rest.HTTPClientFor(&config) - if err != nil { - return nil, err - } - return NewForConfigAndClient(&config, httpClient) -} - -// NewForConfigAndClient creates a new CdiV1beta1Client for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CdiV1beta1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientForConfigAndClient(&config, h) - if err != nil { - return nil, err - } - return &CdiV1beta1Client{client}, nil -} - -// NewForConfigOrDie creates a new CdiV1beta1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *CdiV1beta1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new CdiV1beta1Client for the given RESTClient. -func New(c rest.Interface) *CdiV1beta1Client { - return &CdiV1beta1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1beta1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *CdiV1beta1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/dataimportcron.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/dataimportcron.go deleted file mode 100644 index 7c7a53bb4..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/dataimportcron.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" - scheme "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme" -) - -// DataImportCronsGetter has a method to return a DataImportCronInterface. -// A group's client should implement this interface. -type DataImportCronsGetter interface { - DataImportCrons(namespace string) DataImportCronInterface -} - -// DataImportCronInterface has methods to work with DataImportCron resources. -type DataImportCronInterface interface { - Create(ctx context.Context, dataImportCron *v1beta1.DataImportCron, opts v1.CreateOptions) (*v1beta1.DataImportCron, error) - Update(ctx context.Context, dataImportCron *v1beta1.DataImportCron, opts v1.UpdateOptions) (*v1beta1.DataImportCron, error) - UpdateStatus(ctx context.Context, dataImportCron *v1beta1.DataImportCron, opts v1.UpdateOptions) (*v1beta1.DataImportCron, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.DataImportCron, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DataImportCronList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DataImportCron, err error) - DataImportCronExpansion -} - -// dataImportCrons implements DataImportCronInterface -type dataImportCrons struct { - client rest.Interface - ns string -} - -// newDataImportCrons returns a DataImportCrons -func newDataImportCrons(c *CdiV1beta1Client, namespace string) *dataImportCrons { - return &dataImportCrons{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the dataImportCron, and returns the corresponding dataImportCron object, and an error if there is any. -func (c *dataImportCrons) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DataImportCron, err error) { - result = &v1beta1.DataImportCron{} - err = c.client.Get(). - Namespace(c.ns). - Resource("dataimportcrons"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DataImportCrons that match those selectors. -func (c *dataImportCrons) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DataImportCronList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.DataImportCronList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("dataimportcrons"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested dataImportCrons. -func (c *dataImportCrons) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("dataimportcrons"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a dataImportCron and creates it. Returns the server's representation of the dataImportCron, and an error, if there is any. -func (c *dataImportCrons) Create(ctx context.Context, dataImportCron *v1beta1.DataImportCron, opts v1.CreateOptions) (result *v1beta1.DataImportCron, err error) { - result = &v1beta1.DataImportCron{} - err = c.client.Post(). - Namespace(c.ns). - Resource("dataimportcrons"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataImportCron). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a dataImportCron and updates it. Returns the server's representation of the dataImportCron, and an error, if there is any. -func (c *dataImportCrons) Update(ctx context.Context, dataImportCron *v1beta1.DataImportCron, opts v1.UpdateOptions) (result *v1beta1.DataImportCron, err error) { - result = &v1beta1.DataImportCron{} - err = c.client.Put(). - Namespace(c.ns). - Resource("dataimportcrons"). - Name(dataImportCron.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataImportCron). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *dataImportCrons) UpdateStatus(ctx context.Context, dataImportCron *v1beta1.DataImportCron, opts v1.UpdateOptions) (result *v1beta1.DataImportCron, err error) { - result = &v1beta1.DataImportCron{} - err = c.client.Put(). - Namespace(c.ns). - Resource("dataimportcrons"). - Name(dataImportCron.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataImportCron). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the dataImportCron and deletes it. Returns an error if one occurs. -func (c *dataImportCrons) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("dataimportcrons"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *dataImportCrons) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("dataimportcrons"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched dataImportCron. -func (c *dataImportCrons) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DataImportCron, err error) { - result = &v1beta1.DataImportCron{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("dataimportcrons"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/datasource.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/datasource.go deleted file mode 100644 index cf9f6eac7..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/datasource.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" - scheme "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme" -) - -// DataSourcesGetter has a method to return a DataSourceInterface. -// A group's client should implement this interface. -type DataSourcesGetter interface { - DataSources(namespace string) DataSourceInterface -} - -// DataSourceInterface has methods to work with DataSource resources. -type DataSourceInterface interface { - Create(ctx context.Context, dataSource *v1beta1.DataSource, opts v1.CreateOptions) (*v1beta1.DataSource, error) - Update(ctx context.Context, dataSource *v1beta1.DataSource, opts v1.UpdateOptions) (*v1beta1.DataSource, error) - UpdateStatus(ctx context.Context, dataSource *v1beta1.DataSource, opts v1.UpdateOptions) (*v1beta1.DataSource, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.DataSource, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DataSourceList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DataSource, err error) - DataSourceExpansion -} - -// dataSources implements DataSourceInterface -type dataSources struct { - client rest.Interface - ns string -} - -// newDataSources returns a DataSources -func newDataSources(c *CdiV1beta1Client, namespace string) *dataSources { - return &dataSources{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the dataSource, and returns the corresponding dataSource object, and an error if there is any. -func (c *dataSources) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DataSource, err error) { - result = &v1beta1.DataSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("datasources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DataSources that match those selectors. -func (c *dataSources) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DataSourceList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.DataSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("datasources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested dataSources. -func (c *dataSources) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("datasources"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a dataSource and creates it. Returns the server's representation of the dataSource, and an error, if there is any. -func (c *dataSources) Create(ctx context.Context, dataSource *v1beta1.DataSource, opts v1.CreateOptions) (result *v1beta1.DataSource, err error) { - result = &v1beta1.DataSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("datasources"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataSource). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a dataSource and updates it. Returns the server's representation of the dataSource, and an error, if there is any. -func (c *dataSources) Update(ctx context.Context, dataSource *v1beta1.DataSource, opts v1.UpdateOptions) (result *v1beta1.DataSource, err error) { - result = &v1beta1.DataSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("datasources"). - Name(dataSource.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataSource). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *dataSources) UpdateStatus(ctx context.Context, dataSource *v1beta1.DataSource, opts v1.UpdateOptions) (result *v1beta1.DataSource, err error) { - result = &v1beta1.DataSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("datasources"). - Name(dataSource.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataSource). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the dataSource and deletes it. Returns an error if one occurs. -func (c *dataSources) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("datasources"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *dataSources) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("datasources"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched dataSource. -func (c *dataSources) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DataSource, err error) { - result = &v1beta1.DataSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("datasources"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/datavolume.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/datavolume.go deleted file mode 100644 index ac17e0c5a..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/datavolume.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" - scheme "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme" -) - -// DataVolumesGetter has a method to return a DataVolumeInterface. -// A group's client should implement this interface. -type DataVolumesGetter interface { - DataVolumes(namespace string) DataVolumeInterface -} - -// DataVolumeInterface has methods to work with DataVolume resources. -type DataVolumeInterface interface { - Create(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.CreateOptions) (*v1beta1.DataVolume, error) - Update(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.UpdateOptions) (*v1beta1.DataVolume, error) - UpdateStatus(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.UpdateOptions) (*v1beta1.DataVolume, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.DataVolume, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DataVolumeList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DataVolume, err error) - DataVolumeExpansion -} - -// dataVolumes implements DataVolumeInterface -type dataVolumes struct { - client rest.Interface - ns string -} - -// newDataVolumes returns a DataVolumes -func newDataVolumes(c *CdiV1beta1Client, namespace string) *dataVolumes { - return &dataVolumes{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the dataVolume, and returns the corresponding dataVolume object, and an error if there is any. -func (c *dataVolumes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DataVolume, err error) { - result = &v1beta1.DataVolume{} - err = c.client.Get(). - Namespace(c.ns). - Resource("datavolumes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DataVolumes that match those selectors. -func (c *dataVolumes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DataVolumeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.DataVolumeList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("datavolumes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested dataVolumes. -func (c *dataVolumes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("datavolumes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a dataVolume and creates it. Returns the server's representation of the dataVolume, and an error, if there is any. -func (c *dataVolumes) Create(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.CreateOptions) (result *v1beta1.DataVolume, err error) { - result = &v1beta1.DataVolume{} - err = c.client.Post(). - Namespace(c.ns). - Resource("datavolumes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataVolume). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a dataVolume and updates it. Returns the server's representation of the dataVolume, and an error, if there is any. -func (c *dataVolumes) Update(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.UpdateOptions) (result *v1beta1.DataVolume, err error) { - result = &v1beta1.DataVolume{} - err = c.client.Put(). - Namespace(c.ns). - Resource("datavolumes"). - Name(dataVolume.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataVolume). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *dataVolumes) UpdateStatus(ctx context.Context, dataVolume *v1beta1.DataVolume, opts v1.UpdateOptions) (result *v1beta1.DataVolume, err error) { - result = &v1beta1.DataVolume{} - err = c.client.Put(). - Namespace(c.ns). - Resource("datavolumes"). - Name(dataVolume.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(dataVolume). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the dataVolume and deletes it. Returns an error if one occurs. -func (c *dataVolumes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("datavolumes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *dataVolumes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("datavolumes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched dataVolume. -func (c *dataVolumes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DataVolume, err error) { - result = &v1beta1.DataVolume{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("datavolumes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/doc.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/doc.go deleted file mode 100644 index 8fe6c0874..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1beta1 diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/generated_expansion.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/generated_expansion.go deleted file mode 100644 index 96ef7764d..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/generated_expansion.go +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -type CDIExpansion interface{} - -type CDIConfigExpansion interface{} - -type DataImportCronExpansion interface{} - -type DataSourceExpansion interface{} - -type DataVolumeExpansion interface{} - -type ObjectTransferExpansion interface{} - -type StorageProfileExpansion interface{} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/objecttransfer.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/objecttransfer.go deleted file mode 100644 index a9d2cade1..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/objecttransfer.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" - scheme "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme" -) - -// ObjectTransfersGetter has a method to return a ObjectTransferInterface. -// A group's client should implement this interface. -type ObjectTransfersGetter interface { - ObjectTransfers() ObjectTransferInterface -} - -// ObjectTransferInterface has methods to work with ObjectTransfer resources. -type ObjectTransferInterface interface { - Create(ctx context.Context, objectTransfer *v1beta1.ObjectTransfer, opts v1.CreateOptions) (*v1beta1.ObjectTransfer, error) - Update(ctx context.Context, objectTransfer *v1beta1.ObjectTransfer, opts v1.UpdateOptions) (*v1beta1.ObjectTransfer, error) - UpdateStatus(ctx context.Context, objectTransfer *v1beta1.ObjectTransfer, opts v1.UpdateOptions) (*v1beta1.ObjectTransfer, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.ObjectTransfer, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ObjectTransferList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ObjectTransfer, err error) - ObjectTransferExpansion -} - -// objectTransfers implements ObjectTransferInterface -type objectTransfers struct { - client rest.Interface -} - -// newObjectTransfers returns a ObjectTransfers -func newObjectTransfers(c *CdiV1beta1Client) *objectTransfers { - return &objectTransfers{ - client: c.RESTClient(), - } -} - -// Get takes name of the objectTransfer, and returns the corresponding objectTransfer object, and an error if there is any. -func (c *objectTransfers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ObjectTransfer, err error) { - result = &v1beta1.ObjectTransfer{} - err = c.client.Get(). - Resource("objecttransfers"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ObjectTransfers that match those selectors. -func (c *objectTransfers) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ObjectTransferList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.ObjectTransferList{} - err = c.client.Get(). - Resource("objecttransfers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested objectTransfers. -func (c *objectTransfers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("objecttransfers"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a objectTransfer and creates it. Returns the server's representation of the objectTransfer, and an error, if there is any. -func (c *objectTransfers) Create(ctx context.Context, objectTransfer *v1beta1.ObjectTransfer, opts v1.CreateOptions) (result *v1beta1.ObjectTransfer, err error) { - result = &v1beta1.ObjectTransfer{} - err = c.client.Post(). - Resource("objecttransfers"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(objectTransfer). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a objectTransfer and updates it. Returns the server's representation of the objectTransfer, and an error, if there is any. -func (c *objectTransfers) Update(ctx context.Context, objectTransfer *v1beta1.ObjectTransfer, opts v1.UpdateOptions) (result *v1beta1.ObjectTransfer, err error) { - result = &v1beta1.ObjectTransfer{} - err = c.client.Put(). - Resource("objecttransfers"). - Name(objectTransfer.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(objectTransfer). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *objectTransfers) UpdateStatus(ctx context.Context, objectTransfer *v1beta1.ObjectTransfer, opts v1.UpdateOptions) (result *v1beta1.ObjectTransfer, err error) { - result = &v1beta1.ObjectTransfer{} - err = c.client.Put(). - Resource("objecttransfers"). - Name(objectTransfer.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(objectTransfer). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the objectTransfer and deletes it. Returns an error if one occurs. -func (c *objectTransfers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("objecttransfers"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *objectTransfers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("objecttransfers"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched objectTransfer. -func (c *objectTransfers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ObjectTransfer, err error) { - result = &v1beta1.ObjectTransfer{} - err = c.client.Patch(pt). - Resource("objecttransfers"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/storageprofile.go b/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/storageprofile.go deleted file mode 100644 index 8c68b54d2..000000000 --- a/modules/create-vm/vendor/kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1/storageprofile.go +++ /dev/null @@ -1,184 +0,0 @@ -/* -Copyright 2018 The CDI Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - v1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" - scheme "kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme" -) - -// StorageProfilesGetter has a method to return a StorageProfileInterface. -// A group's client should implement this interface. -type StorageProfilesGetter interface { - StorageProfiles() StorageProfileInterface -} - -// StorageProfileInterface has methods to work with StorageProfile resources. -type StorageProfileInterface interface { - Create(ctx context.Context, storageProfile *v1beta1.StorageProfile, opts v1.CreateOptions) (*v1beta1.StorageProfile, error) - Update(ctx context.Context, storageProfile *v1beta1.StorageProfile, opts v1.UpdateOptions) (*v1beta1.StorageProfile, error) - UpdateStatus(ctx context.Context, storageProfile *v1beta1.StorageProfile, opts v1.UpdateOptions) (*v1beta1.StorageProfile, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.StorageProfile, error) - List(ctx context.Context, opts v1.ListOptions) (*v1beta1.StorageProfileList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.StorageProfile, err error) - StorageProfileExpansion -} - -// storageProfiles implements StorageProfileInterface -type storageProfiles struct { - client rest.Interface -} - -// newStorageProfiles returns a StorageProfiles -func newStorageProfiles(c *CdiV1beta1Client) *storageProfiles { - return &storageProfiles{ - client: c.RESTClient(), - } -} - -// Get takes name of the storageProfile, and returns the corresponding storageProfile object, and an error if there is any. -func (c *storageProfiles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.StorageProfile, err error) { - result = &v1beta1.StorageProfile{} - err = c.client.Get(). - Resource("storageprofiles"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of StorageProfiles that match those selectors. -func (c *storageProfiles) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.StorageProfileList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.StorageProfileList{} - err = c.client.Get(). - Resource("storageprofiles"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested storageProfiles. -func (c *storageProfiles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("storageprofiles"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a storageProfile and creates it. Returns the server's representation of the storageProfile, and an error, if there is any. -func (c *storageProfiles) Create(ctx context.Context, storageProfile *v1beta1.StorageProfile, opts v1.CreateOptions) (result *v1beta1.StorageProfile, err error) { - result = &v1beta1.StorageProfile{} - err = c.client.Post(). - Resource("storageprofiles"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(storageProfile). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a storageProfile and updates it. Returns the server's representation of the storageProfile, and an error, if there is any. -func (c *storageProfiles) Update(ctx context.Context, storageProfile *v1beta1.StorageProfile, opts v1.UpdateOptions) (result *v1beta1.StorageProfile, err error) { - result = &v1beta1.StorageProfile{} - err = c.client.Put(). - Resource("storageprofiles"). - Name(storageProfile.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(storageProfile). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *storageProfiles) UpdateStatus(ctx context.Context, storageProfile *v1beta1.StorageProfile, opts v1.UpdateOptions) (result *v1beta1.StorageProfile, err error) { - result = &v1beta1.StorageProfile{} - err = c.client.Put(). - Resource("storageprofiles"). - Name(storageProfile.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(storageProfile). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the storageProfile and deletes it. Returns an error if one occurs. -func (c *storageProfiles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("storageprofiles"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *storageProfiles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("storageprofiles"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched storageProfile. -func (c *storageProfiles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.StorageProfile, err error) { - result = &v1beta1.StorageProfile{} - err = c.client.Patch(pt). - Resource("storageprofiles"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/modules/create-vm/vendor/modules.txt b/modules/create-vm/vendor/modules.txt index b884e199d..3cfbfe205 100644 --- a/modules/create-vm/vendor/modules.txt +++ b/modules/create-vm/vendor/modules.txt @@ -121,9 +121,6 @@ github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testobjects/templat github.com/mailru/easyjson/buffer github.com/mailru/easyjson/jlexer github.com/mailru/easyjson/jwriter -# github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a -## explicit -github.com/mattbaird/jsonpatch # github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd ## explicit github.com/modern-go/concurrent @@ -714,17 +711,11 @@ kubevirt.io/client-go/precond kubevirt.io/client-go/subresources kubevirt.io/client-go/util kubevirt.io/client-go/version -# kubevirt.io/containerized-data-importer v1.55.0 => kubevirt.io/containerized-data-importer v1.55.0 -## explicit; go 1.18 -kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/scheme -kubevirt.io/containerized-data-importer/pkg/client/clientset/versioned/typed/core/v1beta1 # kubevirt.io/containerized-data-importer-api v1.55.0 => kubevirt.io/containerized-data-importer-api v1.55.0 ## explicit; go 1.18 kubevirt.io/containerized-data-importer-api/pkg/apis/core -kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1alpha1 kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1 kubevirt.io/containerized-data-importer-api/pkg/apis/upload -kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1alpha1 kubevirt.io/containerized-data-importer-api/pkg/apis/upload/v1beta1 # kubevirt.io/controller-lifecycle-operator-sdk/api v0.0.0-20220329064328-f3cc58c6ed90 => kubevirt.io/controller-lifecycle-operator-sdk/api v0.0.0-20220329064328-f3cc58c6ed90 ## explicit; go 1.17 diff --git a/modules/execute-in-vm/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go b/modules/execute-in-vm/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go index 764694af2..c2f888998 100644 --- a/modules/execute-in-vm/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go +++ b/modules/execute-in-vm/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go @@ -1,9 +1,3 @@ package testconstants -const ( - Virtio = "virtio" - Scsi = "scsi" - Sata = "sata" -) - const NamespaceTestDefault = "default" diff --git a/modules/sharedtest/testconstants/constants.go b/modules/sharedtest/testconstants/constants.go index 764694af2..c2f888998 100644 --- a/modules/sharedtest/testconstants/constants.go +++ b/modules/sharedtest/testconstants/constants.go @@ -1,9 +1,3 @@ package testconstants -const ( - Virtio = "virtio" - Scsi = "scsi" - Sata = "sata" -) - const NamespaceTestDefault = "default" diff --git a/modules/tests/test/constants/create-vm.go b/modules/tests/test/constants/create-vm.go index 726cd74a9..be21b9e63 100644 --- a/modules/tests/test/constants/create-vm.go +++ b/modules/tests/test/constants/create-vm.go @@ -8,13 +8,6 @@ const CreateVMFromManifestTaskName = "create-vm-from-manifest" const CreateVMFromManifestServiceAccountName = "create-vm-from-manifest-task" const CreateVMFromManifestServiceAccountNameNamespaced = "create-vm-from-manifest-test" -type createVMParams struct { - DataVolumes string - OwnDataVolumes string - PersistentVolumeClaims string - OwnPersistentVolumeClaims string -} - type createVMFromManifestParams struct { Namespace string Manifest string @@ -30,13 +23,6 @@ type createVMFromTemplateParams struct { RunStrategy string } -var CreateVMParams = createVMParams{ - DataVolumes: "dataVolumes", - OwnDataVolumes: "ownDataVolumes", - PersistentVolumeClaims: "persistentVolumeClaims", - OwnPersistentVolumeClaims: "ownPersistentVolumeClaims", -} - var CreateVMFromManifestParams = createVMFromManifestParams{ Namespace: "namespace", Manifest: "manifest", diff --git a/modules/tests/test/create_vm_common_test.go b/modules/tests/test/create_vm_common_test.go deleted file mode 100644 index f0652c324..000000000 --- a/modules/tests/test/create_vm_common_test.go +++ /dev/null @@ -1,296 +0,0 @@ -package test - -import ( - "context" - "fmt" - - "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testobjects" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testobjects/datavolume" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testobjects/template" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/tests/test/constants" - . "github.com/kubevirt/kubevirt-tekton-tasks/modules/tests/test/constants" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/tests/test/dataobject" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/tests/test/framework" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/tests/test/runner" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/tests/test/testconfigs" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/tests/test/vm" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - corev1 "k8s.io/api/core/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - kubevirtv1 "kubevirt.io/api/core/v1" -) - -var _ = Describe("Create VM", func() { - f := framework.NewFramework() - BeforeEach(func() { - if f.TestOptions.SkipCreateVMFromManifestTests { - Skip("skipCreateVMFromManifestTests is set to true, skipping tests") - } - }) - - ownedDVTestCase := map[datavolume.TestDataVolumeAttachmentType]int{datavolume.OwnedDV: 1} - pvcTestCase := map[datavolume.TestDataVolumeAttachmentType]int{datavolume.PVC: 1} - ownedPVCTestCase := map[datavolume.TestDataVolumeAttachmentType]int{datavolume.OwnedPVC: 2} - dvTestCase := map[datavolume.TestDataVolumeAttachmentType]int{datavolume.DV: 2} - allTestCase := map[datavolume.TestDataVolumeAttachmentType]int{datavolume.OwnedDV: 2, datavolume.OwnedPVC: 1, datavolume.PVC: 1, datavolume.DV: 1} - - DescribeTable("VM with attached PVCs/DV is created successfully", func(createMode CreateVMMode, idx int, runConf map[datavolume.TestDataVolumeAttachmentType]int) { - mode := "template-mode" - - if createMode == CreateVMVMManifestMode { - mode = "manifest-mode" - } - var datavolumes []*datavolume.TestDataVolume - for attachmentType, count := range runConf { - for id := 0; id < count; id++ { - datavolumes = append(datavolumes, - datavolume.NewBlankDataVolume(fmt.Sprintf("attach-to-vm-%s-%v-%v", mode, attachmentType, id)).AttachAs(attachmentType), - ) - } - } - - var config *testconfigs.CreateVMTestConfig - - switch createMode { - case CreateVMVMManifestMode: - config = &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromManifestServiceAccountName, - ExpectedLogs: ExpectedSuccessfulVMCreation, - Timeout: Timeouts.SmallDVCreation, - }, - TaskData: testconfigs.CreateVMTaskData{ - CreateMode: createMode, - VM: testobjects.NewTestAlpineVM("create-vm-from-manifest-with-disk").Build(), - DataVolumesToCreate: datavolumes, - ExpectedAdditionalDiskBus: "virtio", - }, - } - case CreateVMTemplateMode: - expectedDiskBus := "virtio" - testTemplate := template.NewCirrosServerTinyTemplate() - switch idx % 4 { // try different disk buses for each test - case 0: - testTemplate.WithSataDiskValidations() - expectedDiskBus = "sata" - case 1: - testTemplate.WithSCSIDiskValidations() - expectedDiskBus = "scsi" - case 2: - testTemplate.WithVirtioDiskValidations() - } - config = &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromTemplateServiceAccountName, - ExpectedLogs: ExpectedSuccessfulVMCreation, - Timeout: Timeouts.SmallDVCreation, - LimitEnvScope: OKDEnvScope, - }, - TaskData: testconfigs.CreateVMTaskData{ - CreateMode: createMode, - Template: testTemplate.Build(), - TemplateParams: []string{ - template.TemplateParam(template.NameParam, E2ETestsRandomName("create-vm-from-template-with-disk")), - }, - DataVolumesToCreate: datavolumes, - ExpectedAdditionalDiskBus: expectedDiskBus, - }, - } - default: - panic("invalid create mode") - } - - f.TestSetup(config) - if template := config.TaskData.Template; template != nil { - template, err := f.TemplateClient.Templates(template.Namespace).Create(context.TODO(), template, v1.CreateOptions{}) - Expect(err).ShouldNot(HaveOccurred()) - f.ManageTemplates(template) - } - for _, dvWrapper := range config.TaskData.DataVolumesToCreate { - dataVolume, err := f.CdiClient.DataVolumes(dvWrapper.Data.Namespace).Create(context.TODO(), dvWrapper.Data, v1.CreateOptions{}) - Expect(err).ShouldNot(HaveOccurred()) - f.ManageDataVolumes(dataVolume) - config.TaskData.SetDVorPVC(dataVolume.Name, dvWrapper.AttachmentType) - } - - for _, dv := range config.TaskData.DataVolumesToCreate { - // wait for each DV to finish import, otherwise test will fail, because of not finished import of DV - err := dataobject.WaitForSuccessfulDataVolume(f.KubevirtClient, dv.Data.Namespace, dv.Data.Name, constants.Timeouts.SmallDVCreation.Duration) - Expect(err).ShouldNot(HaveOccurred()) - } - - expectedVM := config.TaskData.GetExpectedVMStubMeta() - f.ManageVMs(expectedVM) - - runner.NewTaskRunRunner(f, config.GetTaskRun()). - CreateTaskRun(). - ExpectSuccess(). - ExpectLogs(config.GetAllExpectedLogs()...). - ExpectResults(map[string]string{ - CreateVMResults.Name: expectedVM.Name, - CreateVMResults.Namespace: expectedVM.Namespace, - }) - - vm, err := vm.WaitForVM(f.KubevirtClient, expectedVM.Namespace, expectedVM.Name, - "", config.GetTaskRunTimeout(), false) - Expect(err).ShouldNot(HaveOccurred()) - // check all disks are present - Expect(vm.Spec.Template.Spec.Volumes).To(ConsistOf(expectedVM.Spec.Template.Spec.Volumes)) - Expect(vm.Spec.Template.Spec.Domain.Devices.Disks).To(ConsistOf(expectedVM.Spec.Template.Spec.Domain.Devices.Disks)) - }, - Entry("owned-dv=1", CreateVMTemplateMode, 0, ownedDVTestCase), - Entry("pvc=1", CreateVMTemplateMode, 1, pvcTestCase), - Entry("owned-pvc=2", CreateVMTemplateMode, 2, ownedPVCTestCase), - Entry("dv=2", CreateVMTemplateMode, 3, dvTestCase), - Entry("owned-dv=2,owned-pvc=1,pvc=1,dv=1", CreateVMTemplateMode, 4, allTestCase), - Entry("owned-dv=1", CreateVMVMManifestMode, 0, ownedDVTestCase), - Entry("pvc=1", CreateVMVMManifestMode, 1, pvcTestCase), - Entry("owned-pvc=2", CreateVMVMManifestMode, 2, ownedPVCTestCase), - Entry("dv=2", CreateVMVMManifestMode, 3, dvTestCase), - Entry("owned-dv=2,owned-pvc=1,pvc=1,dv=1", CreateVMVMManifestMode, 4, allTestCase), - ) - DescribeTable("VM with attached PVCs/DVs and existing disks/volumes is created successfully", func(createMode CreateVMMode) { - mode := "template-mode" - - if createMode == CreateVMVMManifestMode { - mode = "manifest-mode" - } - - datavolumes := []*datavolume.TestDataVolume{ - datavolume.NewBlankDataVolume("attach-to-vm-with-disk-name-1-" + mode).AttachWithDiskName("disk1").AttachAs(datavolume.OwnedPVC), - datavolume.NewBlankDataVolume("attach-to-vm-with-disk-name-2-" + mode).AttachWithDiskName("disk2").AttachAs(datavolume.OwnedDV), - datavolume.NewBlankDataVolume("attach-to-vm-with-disk-name-3-" + mode).AttachWithDiskName("disk3").AttachAs(datavolume.OwnedDV), - } - - vmDisk1 := kubevirtv1.Disk{ - Name: datavolumes[0].DiskName, - DiskDevice: kubevirtv1.DiskDevice{ - CDRom: &kubevirtv1.CDRomTarget{Bus: "sata"}, - }, - } - vmDisk2 := kubevirtv1.Disk{ - Name: datavolumes[1].DiskName, - DiskDevice: kubevirtv1.DiskDevice{ - Disk: &kubevirtv1.DiskTarget{Bus: "virtio"}, - }, - } - - // disk disk3 should be created by the task - - // volume disk1 should be created by the task - - vmVolume2 := kubevirtv1.Volume{ - Name: datavolumes[1].DiskName, - // wrong source - should overwrite - VolumeSource: kubevirtv1.VolumeSource{ - PersistentVolumeClaim: &kubevirtv1.PersistentVolumeClaimVolumeSource{ - PersistentVolumeClaimVolumeSource: corev1.PersistentVolumeClaimVolumeSource{ - ClaimName: "other", - }, - }, - }, - } - vmVolume3 := kubevirtv1.Volume{ - Name: datavolumes[2].DiskName, - // no source - should complete - } - - var config *testconfigs.CreateVMTestConfig - - switch createMode { - case CreateVMVMManifestMode: - config = &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromManifestServiceAccountName, - ExpectedLogs: ExpectedSuccessfulVMCreation, - Timeout: Timeouts.SmallDVCreation, - }, - TaskData: testconfigs.CreateVMTaskData{ - CreateMode: createMode, - VM: testobjects.NewTestAlpineVM("create-vm-from-manifest-with-existing-disk"). - // to be compatible with the template flow - WithCloudConfig( - testobjects.CloudConfig{ - Password: "alpine", - }, - ). - WithDisk(vmDisk1). - WithDisk(vmDisk2). - WithVolume(vmVolume2). - WithVolume(vmVolume3). - Build(), - DataVolumesToCreate: datavolumes, - ExpectedAdditionalDiskBus: "virtio", - }, - } - case CreateVMTemplateMode: - config = &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromTemplateServiceAccountName, - ExpectedLogs: ExpectedSuccessfulVMCreation, - Timeout: Timeouts.SmallDVCreation, - LimitEnvScope: OKDEnvScope, - }, - TaskData: testconfigs.CreateVMTaskData{ - CreateMode: createMode, - Template: template.NewCirrosServerTinyTemplate(). - WithDisk(vmDisk1). - WithDisk(vmDisk2). - WithVolume(vmVolume2). - WithVolume(vmVolume3). - Build(), - TemplateParams: []string{ - template.TemplateParam(template.NameParam, E2ETestsRandomName("create-vm-from-template-with-existing-disk")), - }, - DataVolumesToCreate: datavolumes, - ExpectedAdditionalDiskBus: "virtio", - }, - } - default: - panic("invalid create mode") - } - f.TestSetup(config) - for _, dvWrapper := range config.TaskData.DataVolumesToCreate { - dataVolume, err := f.CdiClient.DataVolumes(dvWrapper.Data.Namespace).Create(context.TODO(), dvWrapper.Data, v1.CreateOptions{}) - Expect(err).ShouldNot(HaveOccurred()) - f.ManageDataVolumes(dataVolume) - config.TaskData.SetDVorPVC(fmt.Sprintf("%v:%v", dvWrapper.DiskName, dataVolume.Name), dvWrapper.AttachmentType) - } - - if template := config.TaskData.Template; template != nil { - template, err := f.TemplateClient.Templates(template.Namespace).Create(context.TODO(), template, v1.CreateOptions{}) - Expect(err).ShouldNot(HaveOccurred()) - f.ManageTemplates(template) - } - - for _, dv := range config.TaskData.DataVolumesToCreate { - // wait for each DV to finish import, otherwise test will fail, because of not finished import of DV - err := dataobject.WaitForSuccessfulDataVolume(f.KubevirtClient, dv.Data.Namespace, dv.Data.Name, constants.Timeouts.SmallDVCreation.Duration) - Expect(err).ShouldNot(HaveOccurred()) - } - - expectedVM := config.TaskData.GetExpectedVMStubMeta() - f.ManageVMs(expectedVM) - - runner.NewTaskRunRunner(f, config.GetTaskRun()). - CreateTaskRun(). - ExpectSuccess(). - ExpectLogs(config.GetAllExpectedLogs()...). - ExpectResults(map[string]string{ - CreateVMResults.Name: expectedVM.Name, - CreateVMResults.Namespace: expectedVM.Namespace, - }) - - vm, err := vm.WaitForVM(f.KubevirtClient, expectedVM.Namespace, expectedVM.Name, - "", config.GetTaskRunTimeout(), false) - Expect(err).ShouldNot(HaveOccurred()) - // check all disks are present - Expect(vm.Spec.Template.Spec.Volumes).To(ConsistOf(expectedVM.Spec.Template.Spec.Volumes)) - Expect(vm.Spec.Template.Spec.Domain.Devices.Disks).To(ConsistOf(expectedVM.Spec.Template.Spec.Domain.Devices.Disks)) - Expect(vm.Spec.Template.Spec.Domain.Devices.Disks[2].CDRom.Bus).To(Equal(kubevirtv1.DiskBusSATA)) - }, - Entry(string(CreateVMTemplateMode), CreateVMTemplateMode), - Entry(string(CreateVMVMManifestMode), CreateVMVMManifestMode), - ) -}) diff --git a/modules/tests/test/create_vm_from_manifest_test.go b/modules/tests/test/create_vm_from_manifest_test.go index 764a34731..295967f24 100644 --- a/modules/tests/test/create_vm_from_manifest_test.go +++ b/modules/tests/test/create_vm_from_manifest_test.go @@ -65,46 +65,6 @@ var _ = Describe("Create VM from manifest", func() { VMManifest: "invalid manifest", }, }), - Entry("non existent dv", &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromManifestServiceAccountName, - ExpectedLogs: "persistentvolumeclaims \"non-existent-dv\" not found", - }, - TaskData: testconfigs.CreateVMTaskData{ - VM: testobjects.NewTestAlpineVM("vm-with-non-existent-dv").Build(), - DataVolumes: []string{"non-existent-dv"}, - }, - }), - Entry("non existent owned dv", &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromManifestServiceAccountName, - ExpectedLogs: "persistentvolumeclaims \"non-existent-own-dv\" not found", - }, - TaskData: testconfigs.CreateVMTaskData{ - VM: testobjects.NewTestAlpineVM("vm-with-non-existent-owned-dv").Build(), - OwnDataVolumes: []string{"non-existent-own-dv"}, - }, - }), - Entry("non existent pvc", &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromManifestServiceAccountName, - ExpectedLogs: "persistentvolumeclaims \"non-existent-pvc\" not found", - }, - TaskData: testconfigs.CreateVMTaskData{ - VM: testobjects.NewTestAlpineVM("vm-with-non-existent-pvc").Build(), - PersistentVolumeClaims: []string{"non-existent-pvc"}, - }, - }), - Entry("non existent owned pvcs", &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromManifestServiceAccountName, - ExpectedLogs: "persistentvolumeclaims \"non-existent-own-pvc\" not found\npersistentvolumeclaims \"non-existent-own-pvc-2\" not found", - }, - TaskData: testconfigs.CreateVMTaskData{ - VM: testobjects.NewTestAlpineVM("vm-with-non-existent-owned-pvcs").Build(), - OwnPersistentVolumeClaims: []string{"non-existent-own-pvc", "non-existent-own-pvc-2"}, - }, - }), Entry("create vm with non matching disk fails", &testconfigs.CreateVMTestConfig{ TaskRunTestConfig: testconfigs.TaskRunTestConfig{ ServiceAccount: CreateVMFromManifestServiceAccountName, diff --git a/modules/tests/test/create_vm_from_template_test.go b/modules/tests/test/create_vm_from_template_test.go index 90284ec57..c4083ed08 100644 --- a/modules/tests/test/create_vm_from_template_test.go +++ b/modules/tests/test/create_vm_from_template_test.go @@ -3,7 +3,6 @@ package test import ( "context" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testobjects/datavolume" testtemplate "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testobjects/template" . "github.com/kubevirt/kubevirt-tekton-tasks/modules/tests/test/constants" "github.com/kubevirt/kubevirt-tekton-tasks/modules/tests/test/framework" @@ -14,7 +13,6 @@ import ( . "github.com/onsi/gomega" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" kubevirtv1 "kubevirt.io/api/core/v1" - cdiv1beta12 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" ) var _ = Describe("Create VM from template", func() { @@ -112,58 +110,6 @@ var _ = Describe("Create VM from template", func() { }, }, }), - Entry("non existent dv", &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromTemplateServiceAccountName, - ExpectedLogs: "persistentvolumeclaims \"non-existent-dv\" not found", - }, - TaskData: testconfigs.CreateVMTaskData{ - Template: testtemplate.NewCirrosServerTinyTemplate().Build(), - TemplateParams: []string{ - testtemplate.TemplateParam(testtemplate.NameParam, E2ETestsRandomName("vm-with-non-existent-dv")), - }, - DataVolumes: []string{"non-existent-dv"}, - }, - }), - Entry("non existent owned dv", &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromTemplateServiceAccountName, - ExpectedLogs: "persistentvolumeclaims \"non-existent-own-dv\" not found", - }, - TaskData: testconfigs.CreateVMTaskData{ - Template: testtemplate.NewCirrosServerTinyTemplate().Build(), - TemplateParams: []string{ - testtemplate.TemplateParam(testtemplate.NameParam, E2ETestsRandomName("vm-with-non-existent-owned-dv")), - }, - OwnDataVolumes: []string{"non-existent-own-dv"}, - }, - }), - Entry("non existent pvc", &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromTemplateServiceAccountName, - ExpectedLogs: "persistentvolumeclaims \"non-existent-pvc\" not found", - }, - TaskData: testconfigs.CreateVMTaskData{ - Template: testtemplate.NewCirrosServerTinyTemplate().Build(), - TemplateParams: []string{ - testtemplate.TemplateParam(testtemplate.NameParam, E2ETestsRandomName("vm-with-non-existent-pvc")), - }, - PersistentVolumeClaims: []string{"non-existent-pvc"}, - }, - }), - Entry("non existent owned pvcs", &testconfigs.CreateVMTestConfig{ - TaskRunTestConfig: testconfigs.TaskRunTestConfig{ - ServiceAccount: CreateVMFromTemplateServiceAccountName, - ExpectedLogs: "persistentvolumeclaims \"non-existent-own-pvc\" not found\npersistentvolumeclaims \"non-existent-own-pvc-2\" not found", - }, - TaskData: testconfigs.CreateVMTaskData{ - Template: testtemplate.NewCirrosServerTinyTemplate().Build(), - TemplateParams: []string{ - testtemplate.TemplateParam(testtemplate.NameParam, E2ETestsRandomName("vm-with-non-existent-owned-pvcs")), - }, - OwnPersistentVolumeClaims: []string{"non-existent-own-pvc", "non-existent-own-pvc-2"}, - }, - }), Entry("create vm with non matching disk fails", &testconfigs.CreateVMTestConfig{ TaskRunTestConfig: testconfigs.TaskRunTestConfig{ ServiceAccount: CreateVMFromTemplateServiceAccountName, @@ -329,43 +275,11 @@ var _ = Describe("Create VM from template", func() { }, IsCommonTemplate: true, VMTargetNamespace: DeployTargetNS, - DataVolumesToCreate: []*datavolume.TestDataVolume{ - datavolume.NewBlankDataVolume("common-templates-src-dv"), - }, }, } f.TestSetup(config) expectedVM := config.TaskData.GetExpectedVMStubMeta() - f.ManageVMs(expectedVM) - - for _, dvWrapper := range config.TaskData.DataVolumesToCreate { - dataVolume, err := f.CdiClient.DataVolumes(dvWrapper.Data.Namespace).Create(context.TODO(), dvWrapper.Data, v1.CreateOptions{}) - Expect(err).ShouldNot(HaveOccurred()) - f.ManageDataVolumes(dataVolume) - - datasource := cdiv1beta12.DataSource{ - ObjectMeta: v1.ObjectMeta{ - Name: dvWrapper.Data.Name, - Namespace: dvWrapper.Data.Namespace, - }, - Spec: cdiv1beta12.DataSourceSpec{ - Source: cdiv1beta12.DataSourceSource{ - PVC: &cdiv1beta12.DataVolumeSourcePVC{ - Name: dvWrapper.Data.Name, - Namespace: dvWrapper.Data.Namespace, - }, - }, - }, - } - ds, err := f.CdiClient.DataSources(dvWrapper.Data.Namespace).Create(context.TODO(), &datasource, v1.CreateOptions{}) - Expect(err).ShouldNot(HaveOccurred()) - f.ManageDataSources(ds) - - config.TaskData.TemplateParams = append(config.TaskData.TemplateParams, testtemplate.TemplateParam(SpacesSmall+testtemplate.DataVolumeNameParam, dataVolume.Name)) - config.TaskData.TemplateParams = append(config.TaskData.TemplateParams, testtemplate.TemplateParam(SpacesSmall+testtemplate.DataVolumeNamespaceParam, dataVolume.Namespace)) - } - runner.NewTaskRunRunner(f, config.GetTaskRun()). CreateTaskRun(). ExpectSuccess(). @@ -425,25 +339,15 @@ var _ = Describe("Create VM from template", func() { Expect(vm.Spec.Template.Spec).Should(Equal(expectedVM.Spec.Template.Spec)) // check VM labels Expect(vm.Labels).Should(Equal(map[string]string{ - "app": vmName, - "flavor.template.kubevirt.io/tiny": "true", - "os.template.kubevirt.io/centos7.0": "true", - "workload.template.kubevirt.io/server": "true", - "vm.kubevirt.io/template": template.Name, - "vm.kubevirt.io/template.namespace": template.Namespace, - "vm.kubevirt.io/template.revision": "147", - "vm.kubevirt.io/template.version": "0.3.2", + "app": vmName, + "vm.kubevirt.io/template": "centos-server-tiny", + "vm.kubevirt.io/template.revision": "147", + "vm.kubevirt.io/template.version": "0.3.2", })) - // check os annotation - Expect(vm.Annotations["name.os.template.kubevirt.io/centos7.0"]).Should(Equal("CentOS 7.0 or higher")) // check VMI labels Expect(vm.Spec.Template.ObjectMeta.Labels).Should(Equal(map[string]string{ - "flavor.template.kubevirt.io/tiny": "true", - "os.template.kubevirt.io/centos7.0": "true", - "workload.template.kubevirt.io/server": "true", - "kubevirt.io/domain": vmName, - "kubevirt.io/size": "tiny", - "vm.kubevirt.io/name": vmName, + "kubevirt.io/domain": vmName, + "kubevirt.io/size": "tiny", })) }) diff --git a/modules/tests/test/testconfigs/vm-test-config.go b/modules/tests/test/testconfigs/vm-test-config.go index d3f3dc930..8a2affe3c 100644 --- a/modules/tests/test/testconfigs/vm-test-config.go +++ b/modules/tests/test/testconfigs/vm-test-config.go @@ -4,14 +4,12 @@ import ( "strings" "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testobjects" - "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testobjects/datavolume" template2 "github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testobjects/template" . "github.com/kubevirt/kubevirt-tekton-tasks/modules/tests/test/constants" "github.com/kubevirt/kubevirt-tekton-tasks/modules/tests/test/framework/testoptions" "github.com/onsi/ginkgo/v2" v1 "github.com/openshift/api/template/v1" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kubevirtv1 "kubevirt.io/api/core/v1" "sigs.k8s.io/yaml" @@ -27,8 +25,6 @@ type CreateVMTaskData struct { VMTargetNamespace TargetNamespace VMManifestTargetNamespace TargetNamespace - DataVolumesToCreate []*datavolume.TestDataVolume - DataSourcesToCreate []*datavolume.TestDataVolume IsCommonTemplate bool UseDefaultTemplateNamespacesInTaskParams bool UseDefaultVMNamespacesInTaskParams bool @@ -44,14 +40,9 @@ type CreateVMTaskData struct { // this is set if VM is not nil VMManifest string - TemplateParams []string - VMNamespace string - DataVolumes []string - DataSources []string - OwnDataVolumes []string - PersistentVolumeClaims []string - OwnPersistentVolumeClaims []string - Virtctl string + TemplateParams []string + VMNamespace string + Virtctl string } func (c *CreateVMTaskData) GetTemplateParam(key string) string { @@ -65,8 +56,6 @@ func (c *CreateVMTaskData) GetTemplateParam(key string) string { } func (c *CreateVMTaskData) GetExpectedVMStubMeta() *kubevirtv1.VirtualMachine { - var finalDisks []kubevirtv1.Disk - var finalVolumes []kubevirtv1.Volume var vmName, vmNamespace string var vm *kubevirtv1.VirtualMachine @@ -90,117 +79,12 @@ func (c *CreateVMTaskData) GetExpectedVMStubMeta() *kubevirtv1.VirtualMachine { vmName = c.GetTemplateParam(template2.NameParam) vmNamespace = c.VMNamespace } - if vm != nil { - finalDisks = append(finalDisks, vm.Spec.Template.Spec.Domain.Devices.Disks...) - finalVolumes = append(finalVolumes, vm.Spec.Template.Spec.Volumes...) - } - - findDisk := func(name string) *kubevirtv1.Disk { - for i := 0; i < len(finalDisks); i++ { - if finalDisks[i].Name == name { - return &finalDisks[i] - } - } - return nil - } - - findVolume := func(name string) *kubevirtv1.Volume { - for i := 0; i < len(finalVolumes); i++ { - if finalVolumes[i].Name == name { - return &finalVolumes[i] - } - } - return nil - } - - for _, dataVolume := range c.DataVolumesToCreate { - name := dataVolume.Data.Name - - if dataVolume.DiskName == "" || findDisk(dataVolume.DiskName) == nil { - disk := kubevirtv1.Disk{ - Name: name, - DiskDevice: kubevirtv1.DiskDevice{ - Disk: &kubevirtv1.DiskTarget{Bus: kubevirtv1.DiskBus(c.ExpectedAdditionalDiskBus)}, - }, - } - if dataVolume.DiskName != "" { - disk.Name = dataVolume.DiskName - } - - finalDisks = append(finalDisks, disk) - } - - if originalVolume := findVolume(dataVolume.DiskName); dataVolume.DiskName != "" && originalVolume != nil { - switch dataVolume.AttachmentType { - case datavolume.DV, datavolume.OwnedDV: - originalVolume.VolumeSource = kubevirtv1.VolumeSource{ - DataVolume: &kubevirtv1.DataVolumeSource{Name: name}, - } - case datavolume.PVC, datavolume.OwnedPVC: - originalVolume.VolumeSource = kubevirtv1.VolumeSource{ - PersistentVolumeClaim: &kubevirtv1.PersistentVolumeClaimVolumeSource{ - PersistentVolumeClaimVolumeSource: corev1.PersistentVolumeClaimVolumeSource{ - ClaimName: name, - }, - }, - } - } - } else { - volume := kubevirtv1.Volume{ - Name: name, - } - - if dataVolume.DiskName != "" { - volume.Name = dataVolume.DiskName - } - - switch dataVolume.AttachmentType { - case datavolume.DV, datavolume.OwnedDV: - volume.DataVolume = &kubevirtv1.DataVolumeSource{ - Name: name, - } - case datavolume.PVC, datavolume.OwnedPVC: - volume.PersistentVolumeClaim = &kubevirtv1.PersistentVolumeClaimVolumeSource{ - PersistentVolumeClaimVolumeSource: corev1.PersistentVolumeClaimVolumeSource{ - ClaimName: name, - }, - } - } - - finalVolumes = append(finalVolumes, volume) - } - } return &kubevirtv1.VirtualMachine{ ObjectMeta: metav1.ObjectMeta{ Name: vmName, Namespace: vmNamespace, }, - Spec: kubevirtv1.VirtualMachineSpec{ - Template: &kubevirtv1.VirtualMachineInstanceTemplateSpec{ - Spec: kubevirtv1.VirtualMachineInstanceSpec{ - Volumes: finalVolumes, - Domain: kubevirtv1.DomainSpec{ - Devices: kubevirtv1.Devices{ - Disks: finalDisks, - }, - }, - }, - }, - }, - } -} - -func (c *CreateVMTaskData) SetDVorPVC(name string, attachmentType datavolume.TestDataVolumeAttachmentType) { - switch attachmentType { - case datavolume.DV: - c.DataVolumes = append(c.DataVolumes, name) - case datavolume.OwnedDV: - c.OwnDataVolumes = append(c.OwnDataVolumes, name) - case datavolume.PVC: - c.PersistentVolumeClaims = append(c.PersistentVolumeClaims, name) - case datavolume.OwnedPVC: - c.OwnPersistentVolumeClaims = append(c.OwnPersistentVolumeClaims, name) } } @@ -222,18 +106,6 @@ func (c *CreateVMTestConfig) Init(options *testoptions.TestOptions) { default: panic("unknown VM create mode") } - - for _, dataVolume := range c.TaskData.DataVolumesToCreate { - dataVolume.Data.Name = E2ETestsRandomName(dataVolume.Data.Name) - dataVolume.Data.Namespace = c.TaskData.VMNamespace - if options.StorageClass != "" { - dataVolume.Data.Spec.PVC.StorageClassName = &options.StorageClass - } - } - - if c.TaskData.ExpectedAdditionalDiskBus == "" { - c.TaskData.ExpectedAdditionalDiskBus = "virtio" - } } func (c *CreateVMTestConfig) initCreateVMManifest(options *testoptions.TestOptions) { @@ -307,46 +179,6 @@ func (c *CreateVMTestConfig) GetTaskRun() *v1beta1.TaskRun { }, } - if len(c.TaskData.DataVolumes) > 0 { - params = append(params, v1beta1.Param{ - Name: CreateVMParams.DataVolumes, - Value: v1beta1.ArrayOrString{ - Type: v1beta1.ParamTypeArray, - ArrayVal: c.TaskData.DataVolumes, - }, - }) - } - - if len(c.TaskData.OwnDataVolumes) > 0 { - params = append(params, v1beta1.Param{ - Name: CreateVMParams.OwnDataVolumes, - Value: v1beta1.ArrayOrString{ - Type: v1beta1.ParamTypeArray, - ArrayVal: c.TaskData.OwnDataVolumes, - }, - }) - } - - if len(c.TaskData.PersistentVolumeClaims) > 0 { - params = append(params, v1beta1.Param{ - Name: CreateVMParams.PersistentVolumeClaims, - Value: v1beta1.ArrayOrString{ - Type: v1beta1.ParamTypeArray, - ArrayVal: c.TaskData.PersistentVolumeClaims, - }, - }) - } - - if len(c.TaskData.OwnPersistentVolumeClaims) > 0 { - params = append(params, v1beta1.Param{ - Name: CreateVMParams.OwnPersistentVolumeClaims, - Value: v1beta1.ArrayOrString{ - Type: v1beta1.ParamTypeArray, - ArrayVal: c.TaskData.OwnPersistentVolumeClaims, - }, - }) - } - var vmNamespace string if !c.TaskData.UseDefaultVMNamespacesInTaskParams { vmNamespace = c.TaskData.VMNamespace diff --git a/modules/tests/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go b/modules/tests/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go index 764694af2..c2f888998 100644 --- a/modules/tests/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go +++ b/modules/tests/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go @@ -1,9 +1,3 @@ package testconstants -const ( - Virtio = "virtio" - Scsi = "scsi" - Sata = "sata" -) - const NamespaceTestDefault = "default" diff --git a/modules/wait-for-vmi-status/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go b/modules/wait-for-vmi-status/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go index 764694af2..c2f888998 100644 --- a/modules/wait-for-vmi-status/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go +++ b/modules/wait-for-vmi-status/vendor/github.com/kubevirt/kubevirt-tekton-tasks/modules/sharedtest/testconstants/constants.go @@ -1,9 +1,3 @@ package testconstants -const ( - Virtio = "virtio" - Scsi = "scsi" - Sata = "sata" -) - const NamespaceTestDefault = "default" diff --git a/tasks/create-vm-from-manifest/README.md b/tasks/create-vm-from-manifest/README.md index 697e8f74e..a902cc129 100644 --- a/tasks/create-vm-from-manifest/README.md +++ b/tasks/create-vm-from-manifest/README.md @@ -14,10 +14,6 @@ Please see [RBAC permissions for running the tasks](../../docs/tasks-rbac-permis - **namespace**: Namespace where to create the VM. (defaults to manifest namespace or active namespace) - **startVM**: Set to true or false to start / not start vm after creation. In case of runStrategy is set to Always, startVM flag is ignored. - **runStrategy**: Set runStrategy to VM. If runStrategy is set, vm.spec.running attribute is set to nil. -- **dataVolumes**: Add DVs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. `["rootdisk:my-dv", "my-dv2"]` -- **ownDataVolumes**: Add DVs to VM Volumes and add VM to DV ownerReferences. These DataVolumes will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. `["rootdisk:my-dv", "my-dv2"]` -- **persistentVolumeClaims**: Add PVCs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. `["rootdisk:my-pvc", "my-pvc2"]` -- **ownPersistentVolumeClaims**: Add PVCs to VM Volumes and add VM to PVC ownerReferences. These PVCs will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. `["rootdisk:my-pvc", "my-pvc2"]` ### Results diff --git a/tasks/create-vm-from-manifest/manifests/create-vm-from-manifest.yaml b/tasks/create-vm-from-manifest/manifests/create-vm-from-manifest.yaml index 443748a3e..310ed0e04 100644 --- a/tasks/create-vm-from-manifest/manifests/create-vm-from-manifest.yaml +++ b/tasks/create-vm-from-manifest/manifests/create-vm-from-manifest.yaml @@ -43,22 +43,6 @@ spec: description: Set runStrategy to VM. If runStrategy is set, vm.spec.running attribute is set to nil. default: "" type: string - - name: dataVolumes - description: Add DVs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: ownDataVolumes - description: Add DVs to VM Volumes and add VM to DV ownerReferences. These DataVolumes will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: persistentVolumeClaims - description: Add PVCs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array - - name: ownPersistentVolumeClaims - description: Add PVCs to VM Volumes and add VM to PVC ownerReferences. These PVCs will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array results: - name: name description: The name of a VM that was created. @@ -71,14 +55,6 @@ spec: - create-vm args: - "--output=yaml" - - '--dvs' - - $(params.dataVolumes) - - '--own-dvs' - - $(params.ownDataVolumes) - - '--pvcs' - - $(params.persistentVolumeClaims) - - '--own-pvcs' - - $(params.ownPersistentVolumeClaims) env: - name: VM_MANIFEST value: $(params.manifest) diff --git a/tasks/create-vm-from-template/README.md b/tasks/create-vm-from-template/README.md index 2e314b113..6e3b825b7 100644 --- a/tasks/create-vm-from-template/README.md +++ b/tasks/create-vm-from-template/README.md @@ -19,10 +19,6 @@ Please see [RBAC permissions for running the tasks](../../docs/tasks-rbac-permis - **vmNamespace**: Namespace where to create the VM. (defaults to active namespace) - **startVM**: Set to true or false to start / not start vm after creation. In case of runStrategy is set to Always, startVM flag is ignored. - **runStrategy**: Set runStrategy to VM. If runStrategy is set, vm.spec.running attribute is set to nil. -- **dataVolumes**: Add DVs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. `["rootdisk:my-dv", "my-dv2"]` -- **ownDataVolumes**: Add DVs to VM Volumes and add VM to DV ownerReferences. These DataVolumes will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. `["rootdisk:my-dv", "my-dv2"]` -- **persistentVolumeClaims**: Add PVCs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. `["rootdisk:my-pvc", "my-pvc2"]` -- **ownPersistentVolumeClaims**: Add PVCs to VM Volumes and add VM to PVC ownerReferences. These PVCs will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. `["rootdisk:my-pvc", "my-pvc2"]` ### Results diff --git a/tasks/create-vm-from-template/manifests/create-vm-from-template.yaml b/tasks/create-vm-from-template/manifests/create-vm-from-template.yaml index 8d3878f5b..a5b75f7ca 100644 --- a/tasks/create-vm-from-template/manifests/create-vm-from-template.yaml +++ b/tasks/create-vm-from-template/manifests/create-vm-from-template.yaml @@ -49,22 +49,6 @@ spec: description: Set runStrategy to VM. If runStrategy is set, vm.spec.running attribute is set to nil. default: "" type: string - - name: dataVolumes - description: Add DVs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: ownDataVolumes - description: Add DVs to VM Volumes and add VM to DV ownerReferences. These DataVolumes will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: persistentVolumeClaims - description: Add PVCs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array - - name: ownPersistentVolumeClaims - description: Add PVCs to VM Volumes and add VM to PVC ownerReferences. These PVCs will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array results: - name: name description: The name of a VM that was created. @@ -77,14 +61,6 @@ spec: - create-vm args: - "--output=yaml" - - '--dvs' - - $(params.dataVolumes) - - '--own-dvs' - - $(params.ownDataVolumes) - - '--pvcs' - - $(params.persistentVolumeClaims) - - '--own-pvcs' - - $(params.ownPersistentVolumeClaims) - '--template-params' - $(params.templateParams) env: diff --git a/templates/create-vm-from-manifest/manifests/create-vm.yaml b/templates/create-vm-from-manifest/manifests/create-vm.yaml index 3d4127bce..8af9ceb65 100644 --- a/templates/create-vm-from-manifest/manifests/create-vm.yaml +++ b/templates/create-vm-from-manifest/manifests/create-vm.yaml @@ -71,22 +71,6 @@ spec: description: Set runStrategy to VM. If runStrategy is set, vm.spec.running attribute is set to nil. default: "" type: string - - name: dataVolumes - description: Add DVs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: ownDataVolumes - description: Add DVs to VM Volumes and add VM to DV ownerReferences. These DataVolumes will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:DV_NAME format. Eg. ["rootdisk:my-dv", "my-dv2"] - default: [] - type: array - - name: persistentVolumeClaims - description: Add PVCs to VM Volumes. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array - - name: ownPersistentVolumeClaims - description: Add PVCs to VM Volumes and add VM to PVC ownerReferences. These PVCs will be deleted once the created VM gets deleted. Replaces a particular volume if in VOLUME_NAME:PVC_NAME format. Eg. ["rootdisk:my-pvc", "my-pvc2"] - default: [] - type: array results: - name: name description: The name of a VM that was created. @@ -99,14 +83,6 @@ spec: - create-vm args: - "--output=yaml" - - '--dvs' - - $(params.dataVolumes) - - '--own-dvs' - - $(params.ownDataVolumes) - - '--pvcs' - - $(params.persistentVolumeClaims) - - '--own-pvcs' - - $(params.ownPersistentVolumeClaims) {% if task_name == "create-vm-from-template" %} - '--template-params' - $(params.templateParams) From db74f963e5db500fe823df7de33d0f7a066479cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20=C5=A0imon?= Date: Wed, 17 May 2023 10:24:39 +0200 Subject: [PATCH 2/2] feat: add ssp operator deployment in e2e tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds ssp operator, which is needed due to deployment of datasource in kubevirt-os-images namespace Signed-off-by: Karel Šimon --- automation/e2e-deploy-resources.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/automation/e2e-deploy-resources.sh b/automation/e2e-deploy-resources.sh index 123152910..ee16912e0 100755 --- a/automation/e2e-deploy-resources.sh +++ b/automation/e2e-deploy-resources.sh @@ -15,6 +15,9 @@ CDI_VERSION=$(curl -s https://api.github.com/repos/kubevirt/containerized-data-i TEKTON_VERSION=$(curl -s https://api.github.com/repos/tektoncd/operator/releases | \ jq '.[] | select(.prerelease==false) | .tag_name' | sort -V | tail -n1 | tr -d '"') +SSP_OPERATOR_VERSION=$(curl -s https://api.github.com/repos/kubevirt/ssp-operator/releases | \ + jq '.[] | select(.prerelease==false) | .tag_name' | sort -V | tail -n1 | tr -d '"') + if kubectl get templates > /dev/null 2>&1; then # okd COMMON_TEMPLATES_VERSION=$(curl -s https://api.github.com/repos/kubevirt/common-templates/releases | \ @@ -39,6 +42,9 @@ kubectl apply -f "https://github.com/kubevirt/containerized-data-importer/releas kubectl apply -f "https://github.com/kubevirt/containerized-data-importer/releases/download/${CDI_VERSION}/cdi-cr.yaml" +# Deploy SSP +kubectl apply -f "https://github.com/kubevirt/ssp-operator/releases/download/${SSP_OPERATOR_VERSION}/ssp-operator.yaml" + # wait for tekton pipelines kubectl rollout status -n openshift-operators deployment/openshift-pipelines-operator --timeout 10m @@ -62,3 +68,19 @@ kubectl wait -n openshift-pipelines deployment tekton-pipelines-webhook --for co # Wait for kubevirt to be available kubectl rollout status -n cdi deployment/cdi-operator --timeout 10m kubectl wait -n kubevirt kv kubevirt --for condition=Available --timeout 10m +kubectl wait -n kubevirt deployment ssp-operator --for condition=Available --timeout 10m + +kubectl create -f - <