From d3455d0539f69d5d8763121099cff4d3f6926466 Mon Sep 17 00:00:00 2001 From: Shelly Kagan Date: Mon, 15 Jan 2024 14:00:15 +0200 Subject: [PATCH 1/5] Add PartnerComp label This label can be used to run tests with focus on tests we consider neccessary to test partner compatibility with kubevirt. To run the tests: make TEST_ARGS="--test-args=-ginkgo.label-filter=PartnerComp" test-functional Signed-off-by: Shelly Kagan --- tests/resource_filtering_test.go | 2 +- tests/vm_backup_test.go | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/resource_filtering_test.go b/tests/resource_filtering_test.go index f2ab7c7b..ef15891e 100644 --- a/tests/resource_filtering_test.go +++ b/tests/resource_filtering_test.go @@ -1086,7 +1086,7 @@ var _ = Describe("Resource includes", func() { Context("[smoke] Standalone VMI", func() { // This test tries to backup on all namespaces, on some clusters it always fails // need to be improved - It("[test_id:10204]Selecting standalone VMI+DV+PVC+Pod: All objects should be restored", func() { + It("[test_id:10204]Selecting standalone VMI+DV+PVC+Pod: All objects should be restored", Label("PartnerComp"), func() { By(fmt.Sprintf("Creating DataVolume %s", dvName)) err := f.CreateDataVolumeWithGuestAgentImage() Expect(err).ToNot(HaveOccurred()) diff --git a/tests/vm_backup_test.go b/tests/vm_backup_test.go index 0b0de6c1..9c8b77d3 100644 --- a/tests/vm_backup_test.go +++ b/tests/vm_backup_test.go @@ -59,7 +59,7 @@ var _ = Describe("[smoke] VM Backup", func() { cancelFunc() }) - It("[test_id:10267]Stopped VM should be restored", func() { + It("[test_id:10267]Stopped VM should be restored", Label("PartnerComp"), func() { By(fmt.Sprintf("Creating DataVolume %s", dvName)) err := f.CreateBlankDataVolume() Expect(err).ToNot(HaveOccurred()) @@ -201,7 +201,7 @@ var _ = Describe("[smoke] VM Backup", func() { }) Context("VM and VMI object graph backup", func() { - It("[test_id:10270]with instancetype and preference", func() { + It("[test_id:10270]with instancetype and preference", Label("PartnerComp"), func() { By("Create instancetype and preference") err := f.CreateInstancetype() Expect(err).ToNot(HaveOccurred()) @@ -266,7 +266,7 @@ var _ = Describe("[smoke] VM Backup", func() { Expect(err).ToNot(HaveOccurred()) }) - It("[test_id:10271]with configmap, secret and serviceaccount", func() { + It("[test_id:10271]with configmap, secret and serviceaccount", Label("PartnerComp"), func() { By("Creating configmap and secret") err := f.CreateConfigMap() Expect(err).ToNot(HaveOccurred()) @@ -322,7 +322,7 @@ var _ = Describe("[smoke] VM Backup", func() { Expect(err).ToNot(HaveOccurred()) }) - It("[test_id:10272]with access credentials", func() { + It("[test_id:10272]with access credentials", Label("PartnerComp"), func() { By("Creating access credentials") err := f.CreateAccessCredentialsSecret() Expect(err).ToNot(HaveOccurred()) @@ -361,10 +361,14 @@ var _ = Describe("[smoke] VM Backup", func() { Expect(err).ToNot(HaveOccurred()) By("Verifying VM") err = framework.WaitForVirtualMachineStatus(f.KvClient, f.Namespace.Name, vm.Name, kvv1.VirtualMachineStatusRunning) + if err != nil { + fmt.Println("SLEEEEEEEEPPP") + time.Sleep(time.Minute * 1000) + } Expect(err).ToNot(HaveOccurred()) }) - It("[test_id:10273]VM with standalone PVC", func() { + It("[test_id:10273]VM with standalone PVC", Label("PartnerComp"), func() { By(fmt.Sprintf("Creating DataVolume %s to create PVC", dvForPVCName)) err := f.CreatePVCUsingDataVolume() Expect(err).ToNot(HaveOccurred()) @@ -424,7 +428,7 @@ var _ = Describe("[smoke] VM Backup", func() { Expect(err).ToNot(HaveOccurred()) }) - It("[test_id:10275]VM with hotplug disk", func() { + It("[test_id:10275]VM with hotplug disk", Label("PartnerComp"), func() { By("Starting a VM") err := f.CreateVMForHotplug() Expect(err).ToNot(HaveOccurred()) From b10a34975ece8aee3b8826f124505c62cfe78926 Mon Sep 17 00:00:00 2001 From: Shelly Kagan Date: Thu, 18 Jan 2024 16:35:45 +0200 Subject: [PATCH 2/5] Adjust tests to have configurable storageclass yamls This change allows the user to set env variable KVP_STORAGE_CLASS with the desired storage class one wants the tests applying yamls to run with. Adjust some tests to pass when using wffc SC Signed-off-by: Shelly Kagan --- tests/framework/framework.go | 2 +- tests/framework/kubectl.go | 17 +++++++++++++++++ tests/framework/manifests_utils.go | 16 ++++++++-------- tests/manifests/blank_datavolume.yaml | 1 + .../{dv-for-pvc.yaml => dv_for_pvc.yaml} | 6 ++++-- ...mage.yaml => dv_with_guest_agent_image.yaml} | 4 +++- tests/manifests/vm_for_hotplug.yaml | 2 +- tests/manifests/vm_with_access_credentials.yaml | 2 +- .../vm_with_different_volume_types.yaml | 2 +- tests/manifests/vm_with_dv_and_dvtemplate.yaml | 2 +- .../vm_with_instancetype_and_preference.yaml | 2 +- tests/vm_backup_test.go | 3 +++ 12 files changed, 42 insertions(+), 17 deletions(-) rename tests/manifests/{dv-for-pvc.yaml => dv_for_pvc.yaml} (69%) rename tests/manifests/{dv-with-guest-agent-image.yaml => dv_with_guest_agent_image.yaml} (73%) diff --git a/tests/framework/framework.go b/tests/framework/framework.go index e5f4bf20..181d6545 100644 --- a/tests/framework/framework.go +++ b/tests/framework/framework.go @@ -113,7 +113,7 @@ func getStorageClassFromEnv() string { return "" } - fmt.Fprintf(os.Stderr, "StorageClass Name [%s]\n", storageClass) + fmt.Fprintf(ginkgo.GinkgoWriter, "StorageClass Name [%s]\n", storageClass) return storageClass } diff --git a/tests/framework/kubectl.go b/tests/framework/kubectl.go index 464e3ec6..48faec16 100644 --- a/tests/framework/kubectl.go +++ b/tests/framework/kubectl.go @@ -28,3 +28,20 @@ func (f *Framework) CreateKubectlCommand(args ...string) *exec.Cmd { return cmd } + +// RunKubectlCreateYamlCommand replaces storageclassname placeholder with configured tests storageClass +// in a given yaml, creates it and returns err +func (f *Framework) RunKubectlCreateYamlCommand(yamlPath string) error { + kubeconfig := f.KubeConfig + path := f.KubectlPath + storageClass := f.StorageClass + + cmdString := fmt.Sprintf("cat %s | sed 's/{{KVP_STORAGE_CLASS}}/%s/g' | %s create -n %s -f -", yamlPath, storageClass, path, f.Namespace.Name) + cmd := exec.Command("bash", "-c", cmdString) + kubeconfEnv := fmt.Sprintf("KUBECONFIG=%s", kubeconfig) + cmd.Env = append(os.Environ(), kubeconfEnv) + outBytes, err := cmd.CombinedOutput() + fmt.Fprintf(GinkgoWriter, "INFO: Output from kubectl: %s\n", string(outBytes)) + + return err +} diff --git a/tests/framework/manifests_utils.go b/tests/framework/manifests_utils.go index 1405d65e..ad260126 100644 --- a/tests/framework/manifests_utils.go +++ b/tests/framework/manifests_utils.go @@ -26,37 +26,37 @@ func (f *Framework) CreateAccessCredentialsSecret() error { } func (f *Framework) CreateBlankDataVolume() error { - err := f.RunKubectlCommand("create", "-f", "manifests/blank_datavolume.yaml", "-n", f.Namespace.Name) + err := f.RunKubectlCreateYamlCommand("manifests/blank_datavolume.yaml") return err } func (f *Framework) CreateDataVolumeWithGuestAgentImage() error { - err := f.RunKubectlCommand("create", "-f", "manifests/dv-with-guest-agent-image.yaml", "-n", f.Namespace.Name) + err := f.RunKubectlCreateYamlCommand("manifests/dv_with_guest_agent_image.yaml") return err } func (f *Framework) CreatePVCUsingDataVolume() error { - err := f.RunKubectlCommand("create", "-f", "manifests/dv-for-pvc.yaml", "-n", f.Namespace.Name) + err := f.RunKubectlCreateYamlCommand("manifests/dv_for_pvc.yaml") return err } func (f *Framework) CreateVMWithInstancetypeAndPreference() error { - err := f.RunKubectlCommand("create", "-f", "manifests/vm_with_instancetype_and_preference.yaml", "-n", f.Namespace.Name) + err := f.RunKubectlCreateYamlCommand("manifests/vm_with_instancetype_and_preference.yaml") return err } func (f *Framework) CreateVMWithDifferentVolumes() error { - err := f.RunKubectlCommand("create", "-f", "manifests/vm_with_different_volume_types.yaml", "-n", f.Namespace.Name) + err := f.RunKubectlCreateYamlCommand("manifests/vm_with_different_volume_types.yaml") return err } func (f *Framework) CreateVMWithAccessCredentials() error { - err := f.RunKubectlCommand("create", "-f", "manifests/vm_with_access_credentials.yaml", "-n", f.Namespace.Name) + err := f.RunKubectlCreateYamlCommand("manifests/vm_with_access_credentials.yaml") return err } func (f *Framework) CreateVMWithDVAndDVTemplate() error { - err := f.RunKubectlCommand("create", "-f", "manifests/vm_with_dv_and_dvtemplate.yaml", "-n", f.Namespace.Name) + err := f.RunKubectlCreateYamlCommand("manifests/vm_with_dv_and_dvtemplate.yaml") return err } @@ -66,7 +66,7 @@ func (f *Framework) CreateVMWithPVC() error { } func (f *Framework) CreateVMForHotplug() error { - err := f.RunKubectlCommand("create", "-f", "manifests/vm_for_hotplug.yaml", "-n", f.Namespace.Name) + err := f.RunKubectlCreateYamlCommand("manifests/vm_for_hotplug.yaml") return err } diff --git a/tests/manifests/blank_datavolume.yaml b/tests/manifests/blank_datavolume.yaml index 8bf3ea44..6239f5cf 100644 --- a/tests/manifests/blank_datavolume.yaml +++ b/tests/manifests/blank_datavolume.yaml @@ -11,5 +11,6 @@ spec: resources: requests: storage: 100Mi + storageClassName: {{KVP_STORAGE_CLASS}} source: blank: {} diff --git a/tests/manifests/dv-for-pvc.yaml b/tests/manifests/dv_for_pvc.yaml similarity index 69% rename from tests/manifests/dv-for-pvc.yaml rename to tests/manifests/dv_for_pvc.yaml index e72ae864..da2437ea 100644 --- a/tests/manifests/dv-for-pvc.yaml +++ b/tests/manifests/dv_for_pvc.yaml @@ -2,6 +2,8 @@ apiVersion: cdi.kubevirt.io/v1beta1 kind: DataVolume metadata: name: test-pvc + annotations: + cdi.kubevirt.io/storage.bind.immediate.requested: "true" spec: pvc: accessModes: @@ -9,8 +11,8 @@ spec: volumeMode: Block resources: requests: - storage: 1Gi - storageClassName: rook-ceph-block + storage: 6Gi + storageClassName: {{KVP_STORAGE_CLASS}} source: registry: pullMethod: node diff --git a/tests/manifests/dv-with-guest-agent-image.yaml b/tests/manifests/dv_with_guest_agent_image.yaml similarity index 73% rename from tests/manifests/dv-with-guest-agent-image.yaml rename to tests/manifests/dv_with_guest_agent_image.yaml index cbc32bf6..180d9f46 100644 --- a/tests/manifests/dv-with-guest-agent-image.yaml +++ b/tests/manifests/dv_with_guest_agent_image.yaml @@ -2,6 +2,8 @@ apiVersion: cdi.kubevirt.io/v1beta1 kind: DataVolume metadata: name: test-dv + annotations: + cdi.kubevirt.io/storage.bind.immediate.requested: "true" spec: pvc: accessModes: @@ -10,7 +12,7 @@ spec: resources: requests: storage: 1Gi - storageClassName: rook-ceph-block + storageClassName: {{KVP_STORAGE_CLASS}} source: registry: pullMethod: node diff --git a/tests/manifests/vm_for_hotplug.yaml b/tests/manifests/vm_for_hotplug.yaml index 6bec08b4..c45feec2 100644 --- a/tests/manifests/vm_for_hotplug.yaml +++ b/tests/manifests/vm_for_hotplug.yaml @@ -16,7 +16,7 @@ spec: resources: requests: storage: 1Gi - storageClassName: rook-ceph-block + storageClassName: {{KVP_STORAGE_CLASS}} source: registry: pullMethod: node diff --git a/tests/manifests/vm_with_access_credentials.yaml b/tests/manifests/vm_with_access_credentials.yaml index 5ab895a3..f37aa8af 100644 --- a/tests/manifests/vm_with_access_credentials.yaml +++ b/tests/manifests/vm_with_access_credentials.yaml @@ -16,7 +16,7 @@ spec: resources: requests: storage: 5Gi - storageClassName: rook-ceph-block + storageClassName: {{KVP_STORAGE_CLASS}} source: registry: pullMethod: node diff --git a/tests/manifests/vm_with_different_volume_types.yaml b/tests/manifests/vm_with_different_volume_types.yaml index 538ffe43..70c7777c 100644 --- a/tests/manifests/vm_with_different_volume_types.yaml +++ b/tests/manifests/vm_with_different_volume_types.yaml @@ -16,7 +16,7 @@ spec: resources: requests: storage: 1Gi - storageClassName: rook-ceph-block + storageClassName: {{KVP_STORAGE_CLASS}} source: registry: pullMethod: node diff --git a/tests/manifests/vm_with_dv_and_dvtemplate.yaml b/tests/manifests/vm_with_dv_and_dvtemplate.yaml index 1453bf1a..54aba700 100644 --- a/tests/manifests/vm_with_dv_and_dvtemplate.yaml +++ b/tests/manifests/vm_with_dv_and_dvtemplate.yaml @@ -14,7 +14,7 @@ spec: resources: requests: storage: 1Gi - storageClassName: rook-ceph-block + storageClassName: {{KVP_STORAGE_CLASS}} source: registry: pullMethod: node diff --git a/tests/manifests/vm_with_instancetype_and_preference.yaml b/tests/manifests/vm_with_instancetype_and_preference.yaml index 5892f5e8..8a01d4b3 100644 --- a/tests/manifests/vm_with_instancetype_and_preference.yaml +++ b/tests/manifests/vm_with_instancetype_and_preference.yaml @@ -22,7 +22,7 @@ spec: resources: requests: storage: 1Gi - storageClassName: rook-ceph-block + storageClassName: {{KVP_STORAGE_CLASS}} source: registry: pullMethod: node diff --git a/tests/vm_backup_test.go b/tests/vm_backup_test.go index 9c8b77d3..09b2c57f 100644 --- a/tests/vm_backup_test.go +++ b/tests/vm_backup_test.go @@ -422,6 +422,9 @@ var _ = Describe("[smoke] VM Backup", func() { By("Verifying VM") err = framework.WaitForVirtualMachineStatus(f.KvClient, f.Namespace.Name, vm.Name, kvv1.VirtualMachineStatusStopped) Expect(err).ToNot(HaveOccurred()) + err = framework.StartVirtualMachine(f.KvClient, f.Namespace.Name, vm.Name) + Expect(err).ToNot(HaveOccurred()) + err = framework.WaitForVirtualMachineStatus(f.KvClient, f.Namespace.Name, vm.Name, kvv1.VirtualMachineStatusRunning) By("Checking PVC exists") err = framework.WaitForPVCPhase(f.K8sClient, f.Namespace.Name, dvForPVCName, v1.ClaimBound) From 72616a91823352317e6de6c5587f94b9fc0a7ac9 Mon Sep 17 00:00:00 2001 From: Shelly Kagan Date: Tue, 30 Jan 2024 17:40:16 +0200 Subject: [PATCH 3/5] Fix racy test The test wants to catch the dv in state importing but if the import is fast we can miss it. Insted we can check that a file that existed no longer exists after the backup. Signed-off-by: Shelly Kagan --- tests/resource_filtering_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/resource_filtering_test.go b/tests/resource_filtering_test.go index ef15891e..3f75c647 100644 --- a/tests/resource_filtering_test.go +++ b/tests/resource_filtering_test.go @@ -2891,12 +2891,16 @@ var _ = Describe("Resource excludes", func() { vmIncluded, err := framework.CreateVirtualMachineFromDefinition(f.KvClient, f.Namespace.Name, vmSpec) Expect(err).ToNot(HaveOccurred()) framework.EventuallyDVWith(f.KvClient, f.Namespace.Name, vmSpec.Spec.DataVolumeTemplates[0].Name, 180, HaveSucceeded()) + volumeName := vmSpec.Spec.DataVolumeTemplates[0].Name + By("Writing to PVC filesystem") + writerPod := runPodAndWaitSucceeded(f.KvClient, f.Namespace.Name, writerPod(volumeName)) + deletePod(f.KvClient, f.Namespace.Name, writerPod.Name) By("Adding exclude labels") if !framework.IsDataVolumeGC(f.KvClient) { - addExcludeLabelToDV(vmSpec.Spec.DataVolumeTemplates[0].Name) + addExcludeLabelToDV(volumeName) } - addExcludeLabelToPVC(vmSpec.Spec.DataVolumeTemplates[0].Name) + addExcludeLabelToPVC(volumeName) By("Creating backup") err = framework.CreateBackupForNamespace(timeout, backupName, f.Namespace.Name, snapshotLocation, f.BackupNamespace, true) @@ -2917,11 +2921,12 @@ var _ = Describe("Resource excludes", func() { err = framework.WaitForRestorePhase(timeout, restoreName, f.BackupNamespace, velerov1api.RestorePhaseCompleted) Expect(err).ToNot(HaveOccurred()) - By("Checking DataVolume re-imports content") - framework.EventuallyDVWith(f.KvClient, f.Namespace.Name, vmSpec.Spec.DataVolumeTemplates[0].Name, 180, BeInPhase(cdiv1.ImportScheduled)) - By("Checking DataVolume import succeeds") - framework.EventuallyDVWith(f.KvClient, f.Namespace.Name, vmSpec.Spec.DataVolumeTemplates[0].Name, 180, HaveSucceeded()) + framework.EventuallyDVWith(f.KvClient, f.Namespace.Name, volumeName, 180, HaveSucceeded()) + + By("Verifying DataVolume has re-imported - file should not exists") + readerPod := runPodAndWaitSucceeded(f.KvClient, f.Namespace.Name, verifyNoFile(volumeName)) + deletePod(f.KvClient, f.Namespace.Name, readerPod.Name) By("Verifying included VM exists") err = framework.WaitForVirtualMachineStatus(f.KvClient, f.Namespace.Name, vmIncluded.Name, kvv1.VirtualMachineStatusStopped, kvv1.VirtualMachineStatusRunning) From 71c67b4ea7918955eee34ee8e9b2dd92784909d1 Mon Sep 17 00:00:00 2001 From: Shelly Kagan Date: Tue, 30 Jan 2024 17:45:00 +0200 Subject: [PATCH 4/5] Ignore velero files in gitignore, delete existing Signed-off-by: Shelly Kagan --- .gitignore | 3 +- velero-v1.8.1-linux-amd64/LICENSE | 201 ------------------ velero-v1.8.1-linux-amd64/examples/README.md | 11 - .../examples/minio/00-minio-deployment.yaml | 113 ---------- .../examples/nginx-app/README.md | 15 -- .../examples/nginx-app/base.yaml | 59 ----- .../examples/nginx-app/with-pv.yaml | 102 --------- 7 files changed, 2 insertions(+), 502 deletions(-) delete mode 100644 velero-v1.8.1-linux-amd64/LICENSE delete mode 100644 velero-v1.8.1-linux-amd64/examples/README.md delete mode 100644 velero-v1.8.1-linux-amd64/examples/minio/00-minio-deployment.yaml delete mode 100644 velero-v1.8.1-linux-amd64/examples/nginx-app/README.md delete mode 100644 velero-v1.8.1-linux-amd64/examples/nginx-app/base.yaml delete mode 100644 velero-v1.8.1-linux-amd64/examples/nginx-app/with-pv.yaml diff --git a/.gitignore b/.gitignore index 708ec1b6..c92be1de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ _output kubevirt-velero-plugin +velero* .go .idea -_ci-configs \ No newline at end of file +_ci-configs diff --git a/velero-v1.8.1-linux-amd64/LICENSE b/velero-v1.8.1-linux-amd64/LICENSE deleted file mode 100644 index 5e0fd33c..00000000 --- a/velero-v1.8.1-linux-amd64/LICENSE +++ /dev/null @@ -1,201 +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/velero-v1.8.1-linux-amd64/examples/README.md b/velero-v1.8.1-linux-amd64/examples/README.md deleted file mode 100644 index 337fb72f..00000000 --- a/velero-v1.8.1-linux-amd64/examples/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Examples - -This directory contains sample YAML config files that can be used for exploring Velero. - -* `minio/`: Used in the [Quickstart][0] to set up [Minio][1], a local S3-compatible object storage service. It provides a convenient way to test Velero without tying you to a specific cloud provider. - -* `nginx-app/`: A sample nginx app that can be used to test backups and restores. - - -[0]: https://velero.io/docs/main/contributions/minio/ -[1]: https://github.com/minio/minio diff --git a/velero-v1.8.1-linux-amd64/examples/minio/00-minio-deployment.yaml b/velero-v1.8.1-linux-amd64/examples/minio/00-minio-deployment.yaml deleted file mode 100644 index e736c914..00000000 --- a/velero-v1.8.1-linux-amd64/examples/minio/00-minio-deployment.yaml +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright 2017 the Velero contributors. -# -# 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. - ---- -apiVersion: v1 -kind: Namespace -metadata: - name: velero - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - namespace: velero - name: minio - labels: - component: minio -spec: - strategy: - type: Recreate - selector: - matchLabels: - component: minio - template: - metadata: - labels: - component: minio - spec: - volumes: - - name: storage - emptyDir: {} - - name: config - emptyDir: {} - containers: - - name: minio - image: minio/minio:latest - imagePullPolicy: IfNotPresent - args: - - server - - /storage - - --config-dir=/config - env: - - name: MINIO_ACCESS_KEY - value: "minio" - - name: MINIO_SECRET_KEY - value: "minio123" - ports: - - containerPort: 9000 - volumeMounts: - - name: storage - mountPath: "/storage" - - name: config - mountPath: "/config" - ---- -apiVersion: v1 -kind: Service -metadata: - namespace: velero - name: minio - labels: - component: minio -spec: - # ClusterIP is recommended for production environments. - # Change to NodePort if needed per documentation, - # but only if you run Minio in a test/trial environment, for example with Minikube. - type: ClusterIP - ports: - - port: 9000 - targetPort: 9000 - protocol: TCP - selector: - component: minio - ---- -apiVersion: batch/v1 -kind: Job -metadata: - namespace: velero - name: minio-setup - labels: - component: minio -spec: - template: - metadata: - name: minio-setup - spec: - restartPolicy: OnFailure - volumes: - - name: config - emptyDir: {} - containers: - - name: mc - image: minio/mc:latest - imagePullPolicy: IfNotPresent - command: - - /bin/sh - - -c - - "mc --config-dir=/config config host add velero http://minio:9000 minio minio123 && mc --config-dir=/config mb -p velero/velero" - volumeMounts: - - name: config - mountPath: "/config" diff --git a/velero-v1.8.1-linux-amd64/examples/nginx-app/README.md b/velero-v1.8.1-linux-amd64/examples/nginx-app/README.md deleted file mode 100644 index 76cec37e..00000000 --- a/velero-v1.8.1-linux-amd64/examples/nginx-app/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Files - -This directory contains manifests for two versions of a sample Nginx app under the `nginx-example` namespace. - -## `base.yaml` - -This is the most basic version of the Nginx app, which can be used to test Velero's backup and restore functionality. - -*This can be deployed as is.* - -## `with-pv.yaml` - -This sets up an Nginx app that logs to a persistent volume, so that Velero's PV snapshotting functionality can also be tested. - -*This requires you to first replace the placeholder value ``.* diff --git a/velero-v1.8.1-linux-amd64/examples/nginx-app/base.yaml b/velero-v1.8.1-linux-amd64/examples/nginx-app/base.yaml deleted file mode 100644 index b33ad373..00000000 --- a/velero-v1.8.1-linux-amd64/examples/nginx-app/base.yaml +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2017 the Velero contributors. -# -# 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. - ---- -apiVersion: v1 -kind: Namespace -metadata: - name: nginx-example - labels: - app: nginx - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nginx-deployment - namespace: nginx-example -spec: - replicas: 2 - selector: - matchLabels: - app: nginx - template: - metadata: - labels: - app: nginx - spec: - containers: - - image: nginx:1.17.6 - name: nginx - ports: - - containerPort: 80 - ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: nginx - name: my-nginx - namespace: nginx-example -spec: - ports: - - port: 80 - targetPort: 80 - selector: - app: nginx - type: LoadBalancer diff --git a/velero-v1.8.1-linux-amd64/examples/nginx-app/with-pv.yaml b/velero-v1.8.1-linux-amd64/examples/nginx-app/with-pv.yaml deleted file mode 100644 index 313a80a7..00000000 --- a/velero-v1.8.1-linux-amd64/examples/nginx-app/with-pv.yaml +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright 2017 the Velero contributors. -# -# 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. - ---- -apiVersion: v1 -kind: Namespace -metadata: - name: nginx-example - labels: - app: nginx - ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: nginx-logs - namespace: nginx-example - labels: - app: nginx -spec: - # Optional: - # storageClassName: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 50Mi - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nginx-deployment - namespace: nginx-example -spec: - replicas: 1 - selector: - matchLabels: - app: nginx - template: - metadata: - labels: - app: nginx - annotations: - pre.hook.backup.velero.io/container: fsfreeze - pre.hook.backup.velero.io/command: '["/sbin/fsfreeze", "--freeze", "/var/log/nginx"]' - post.hook.backup.velero.io/container: fsfreeze - post.hook.backup.velero.io/command: '["/sbin/fsfreeze", "--unfreeze", "/var/log/nginx"]' - spec: - volumes: - - name: nginx-logs - persistentVolumeClaim: - claimName: nginx-logs - containers: - - image: nginx:1.17.6 - name: nginx - ports: - - containerPort: 80 - volumeMounts: - - mountPath: "/var/log/nginx" - name: nginx-logs - readOnly: false - - image: ubuntu:bionic - name: fsfreeze - securityContext: - privileged: true - volumeMounts: - - mountPath: "/var/log/nginx" - name: nginx-logs - readOnly: false - command: - - "/bin/bash" - - "-c" - - "sleep infinity" - - ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: nginx - name: my-nginx - namespace: nginx-example -spec: - ports: - - port: 80 - targetPort: 80 - selector: - app: nginx - type: LoadBalancer From 4fa6d8bd588e84086cd3a090313e5d45ebfb7996 Mon Sep 17 00:00:00 2001 From: Shelly Kagan Date: Tue, 30 Jan 2024 17:45:31 +0200 Subject: [PATCH 5/5] Update kubevirtci due to a bug in last version Signed-off-by: Shelly Kagan --- cluster-up/README.md | 20 +++- .../{k8s-1.25 => k8s-1.29}/provider.sh | 0 cluster-up/cluster/kind-1.23/README.md | 45 --------- cluster-up/cluster/kind-1.23/provider.sh | 51 ---------- .../{kind-1.27 => kind-1.28}/README.md | 0 .../{kind-1.27 => kind-1.28}/provider.sh | 6 +- cluster-up/cluster/kind/common.sh | 15 ++- cluster-up/cluster/local/README.md | 98 ------------------- cluster-up/cluster/local/provider.sh | 56 ----------- cluster-up/hack/common.sh | 4 +- 10 files changed, 38 insertions(+), 257 deletions(-) rename cluster-up/cluster/{k8s-1.25 => k8s-1.29}/provider.sh (100%) delete mode 100644 cluster-up/cluster/kind-1.23/README.md delete mode 100755 cluster-up/cluster/kind-1.23/provider.sh rename cluster-up/cluster/{kind-1.27 => kind-1.28}/README.md (100%) rename cluster-up/cluster/{kind-1.27 => kind-1.28}/provider.sh (89%) delete mode 100644 cluster-up/cluster/local/README.md delete mode 100644 cluster-up/cluster/local/provider.sh diff --git a/cluster-up/README.md b/cluster-up/README.md index 8fdcad66..a5c20347 100644 --- a/cluster-up/README.md +++ b/cluster-up/README.md @@ -1,4 +1,22 @@ -# How to use cluster-up +# cluster-up + +## Prerequisites: podman or docker + +cluster-up requires that either podman or docker be installed on the host. + +If podman is being used, it is also necessary to enable podman socket with: + +``` +sudo systemctl enable podman.socket +sudo systemctl start podman.socket +``` + +for more information see: + +https://github.com/kubevirt/kubevirtci/blob/main/PODMAN.md + + +## How to use cluster-up This directory provides a wrapper around gocli. It can be vendored into other git repos and integrated to provide in the kubevirt well-known cluster commands diff --git a/cluster-up/cluster/k8s-1.25/provider.sh b/cluster-up/cluster/k8s-1.29/provider.sh similarity index 100% rename from cluster-up/cluster/k8s-1.25/provider.sh rename to cluster-up/cluster/k8s-1.29/provider.sh diff --git a/cluster-up/cluster/kind-1.23/README.md b/cluster-up/cluster/kind-1.23/README.md deleted file mode 100644 index 05c97eab..00000000 --- a/cluster-up/cluster/kind-1.23/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# K8S 1.23.3 with mdev support in a Kind cluster - -Provides a pre-deployed k8s cluster with version 1.23.3 that runs using [kind](https://github.com/kubernetes-sigs/kind) The cluster is completely ephemeral and is recreated on every cluster restart. -The KubeVirt containers are built on the local machine and are then pushed to a registry which is exposed at -`localhost:5000`. - -## Bringing the cluster up - -The following needs to be executed as root. - -```bash -export KUBEVIRT_PROVIDER=kind-1.23 -make cluster-up -``` - -The cluster can be accessed as usual: - -```bash -$ cluster-up/kubectl.sh get nodes -NAME STATUS ROLES AGE VERSION -kind-1.23-control-plane Ready master 6m14s v1.23.3 -``` - -## Bringing the cluster down - -```bash -make cluster-down -``` - -This destroys the whole cluster. - -## Setting a custom kind version - -In order to use a custom kind image / kind version, -export KIND_NODE_IMAGE, KIND_VERSION, KUBECTL_PATH before running cluster-up. -For example in order to use kind 0.9.0 (which is based on k8s-1.19.1) use: -```bash -export KIND_NODE_IMAGE="kindest/node:v1.19.1@sha256:98cf5288864662e37115e362b23e4369c8c4a408f99cbc06e58ac30ddc721600" -export KIND_VERSION="0.9.0" -export KUBECTL_PATH="/usr/bin/kubectl" -``` -This allows users to test or use custom images / different kind versions before making them official. -See https://github.com/kubernetes-sigs/kind/releases for details about node images according to the kind version. - -- In order to use `make cluster-down` please make sure the right `CLUSTER_NAME` is exported. diff --git a/cluster-up/cluster/kind-1.23/provider.sh b/cluster-up/cluster/kind-1.23/provider.sh deleted file mode 100755 index 137f677b..00000000 --- a/cluster-up/cluster/kind-1.23/provider.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -set -e - -DEFAULT_CLUSTER_NAME="kind-1.23" -DEFAULT_HOST_PORT=5000 -ALTERNATE_HOST_PORT=5001 -export CLUSTER_NAME=${CLUSTER_NAME:-$DEFAULT_CLUSTER_NAME} - -if [ $CLUSTER_NAME == $DEFAULT_CLUSTER_NAME ]; then - export HOST_PORT=$DEFAULT_HOST_PORT -else - export HOST_PORT=$ALTERNATE_HOST_PORT -fi - -function set_kind_params() { - export KIND_VERSION="${KIND_VERSION:-0.12.0}" - export KIND_NODE_IMAGE="${KIND_NODE_IMAGE:-quay.io/kubevirtci/kindest-node:v1.23.4}" - export KUBECTL_PATH="${KUBECTL_PATH:-/bin/kubectl}" -} - -function configure_registry_proxy() { - [ "$CI" != "true" ] && return - - echo "Configuring cluster nodes to work with CI mirror-proxy..." - - local -r ci_proxy_hostname="docker-mirror-proxy.kubevirt-prow.svc" - local -r kind_binary_path="${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/.kind" - local -r configure_registry_proxy_script="${KUBEVIRTCI_PATH}/cluster/kind/configure-registry-proxy.sh" - - KIND_BIN="$kind_binary_path" PROXY_HOSTNAME="$ci_proxy_hostname" $configure_registry_proxy_script -} - -function up() { - cp $KIND_MANIFESTS_DIR/kind.yaml ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml - _add_kubeadm_cpu_manager_config_patch - _add_extra_mounts - export CONFIG_WORKER_CPU_MANAGER=true - kind_up - - configure_registry_proxy - - # remove the rancher.io kind default storageClass - _kubectl delete sc standard - - echo "$KUBEVIRT_PROVIDER cluster '$CLUSTER_NAME' is ready" -} - -set_kind_params - -source ${KUBEVIRTCI_PATH}/cluster/kind/common.sh diff --git a/cluster-up/cluster/kind-1.27/README.md b/cluster-up/cluster/kind-1.28/README.md similarity index 100% rename from cluster-up/cluster/kind-1.27/README.md rename to cluster-up/cluster/kind-1.28/README.md diff --git a/cluster-up/cluster/kind-1.27/provider.sh b/cluster-up/cluster/kind-1.28/provider.sh similarity index 89% rename from cluster-up/cluster/kind-1.27/provider.sh rename to cluster-up/cluster/kind-1.28/provider.sh index 6dd01f5e..69008abc 100755 --- a/cluster-up/cluster/kind-1.27/provider.sh +++ b/cluster-up/cluster/kind-1.28/provider.sh @@ -2,7 +2,7 @@ set -e -DEFAULT_CLUSTER_NAME="kind-1.27" +DEFAULT_CLUSTER_NAME="kind-1.28" DEFAULT_HOST_PORT=5000 ALTERNATE_HOST_PORT=5001 export CLUSTER_NAME=${CLUSTER_NAME:-$DEFAULT_CLUSTER_NAME} @@ -14,8 +14,8 @@ else fi function set_kind_params() { - export KIND_VERSION="${KIND_VERSION:-0.19.0}" - export KIND_NODE_IMAGE="${KIND_NODE_IMAGE:-kindest/node:v1.27.1@sha256:b7d12ed662b873bd8510879c1846e87c7e676a79fefc93e17b2a52989d3ff42b}" + export KIND_VERSION="${KIND_VERSION:-0.20.0}" + export KIND_NODE_IMAGE="${KIND_NODE_IMAGE:-kindest/node:v1.28.0@sha256:b7a4cad12c197af3ba43202d3efe03246b3f0793f162afb40a33c923952d5b31}" export KUBECTL_PATH="${KUBECTL_PATH:-/usr/bin/kubectl}" } diff --git a/cluster-up/cluster/kind/common.sh b/cluster-up/cluster/kind/common.sh index 7003ba2f..2ec48605 100755 --- a/cluster-up/cluster/kind/common.sh +++ b/cluster-up/cluster/kind/common.sh @@ -8,6 +8,9 @@ function detect_cri() { export CRI_BIN=${CRI_BIN:-$(detect_cri)} CONFIG_WORKER_CPU_MANAGER=${CONFIG_WORKER_CPU_MANAGER:-false} +# only setup ipFamily when the environmental variable is not empty +# avaliable value: ipv4, ipv6, dual +IPFAMILY=${IPFAMILY} # check CPU arch PLATFORM=$(uname -m) @@ -286,10 +289,20 @@ EOF fi } +function _setup_ipfamily() { + if [ $IPFAMILY != "" ]; then + cat <> ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml +networking: + ipFamily: $IPFAMILY +EOF + echo "KIND cluster ip family has been set to $IPFAMILY" + fi +} + function _prepare_kind_config() { _add_workers _add_kubeadm_config_patches - + _setup_ipfamily echo "Final KIND config:" cat ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml } diff --git a/cluster-up/cluster/local/README.md b/cluster-up/cluster/local/README.md deleted file mode 100644 index 6b897254..00000000 --- a/cluster-up/cluster/local/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# Local Kubernetes Provider - -This provider allows developing against bleeding-edge Kubernetes code. The -k8s sources will be compiled and a single-node cluster will be started. - -## Environment preparation - -Since the `local` provider deploys the cluster on the host and not inside -virtual machines, you may need to adjust some settings on the node. - -Specifically, you may need to make sure that your firewall of choice doesn't -block connectivity between cluster IP and service pods. If you experience -connectivity issues, consider tweaking or disabling your firewall. Also, make -sure forwarding is enabled on the host: - -```bash -$ systemctl disable firewalld --now -$ iptables -P FORWARD ACCEPT -$ sysctl net.ipv4.conf.all.forwarding=1 -``` - -## Bringing the cluster up - -First get the k8s sources: - -```bash -go get -u -d k8s.io/kubernetes -``` - -Then compile and start the cluster: - -```bash -export KUBEVIRT_PROVIDER=local -make cluster-up -``` - -The cluster can be accessed as usual: - -```bash -$ cluster/kubectl.sh get nodes -NAME STATUS ROLES AGE VERSION -kubdev Ready 5m20s v1.12.0-beta.2 -``` - -Note: you may need to cherry-pick -[acdb1b0e9855ab671f2972f10605d20cad26284b](https://github.com/kubernetes/kubernetes/commit/acdb1b0e9855ab671f2972f10605d20cad26284b) -if it's not present in your kubernetes tree yet. - -## CNI - -By default, local provider deploys cluster with no CNI support. To make CNI -work, you should set the following variables before spinning up cluster: - -```bash -$ export NET_PLUGIN=cni -$ export CNI_CONF_DIR=/etc/cni/net.d/ -$ export CNI_BIN_DIR=/opt/cni/bin/ -``` - -Depending on your CNI of choice (for example, Flannel), you may also need to -add the following arguments to controller-manager inside -`hack/local-cluster-up.sh`: - -```bash -$ git diff -diff --git a/hack/local-up-cluster.sh b/hack/local-up-cluster.sh -index bcf988b..9911eed 100755 ---- a/hack/local-up-cluster.sh -+++ b/hack/local-up-cluster.sh -@@ -639,6 +639,8 @@ function start_controller_manager { - --use-service-account-credentials \ - --controllers="${KUBE_CONTROLLERS}" \ - --leader-elect=false \ - --cert-dir="$CERT_DIR" \ -+ --allocate-node-cidrs=true --cluster-cidr=10.244.0.0/16 \ - --master="https://${API_HOST}:${API_SECURE_PORT}" >"${CTLRMGR_LOG}" 2>&1 & - CTLRMGR_PID=$! - } -``` - -Also, you will need to install [reference CNI plugins](https://github.com/containernetworking/plugins): - -```bash -$ go get -u -d github.com/containernetworking/plugins/ -$ cd $GOPATH/src/github.com/containernetworking/plugins/ -$ ./build.sh -$ sudo mkdir -p /opt/cni/bin/ -$ sudo cp bin/* /opt/cni/bin/ -``` - -In some cases (for example, Multus), your CNI plugin may also require presence -of `/etc/kubernetes/kubelet.conf` file. In this case, you should create a -symlink pointing to the right location: - -```bash -$ sudo mkdir /etc/kubernetes -$ sudo ln -s $GOPATH/src/kubevirt.io/kubevirt/cluster/local/certs/kubelet.kubeconfig /etc/kubernetes/kubelet.conf -``` diff --git a/cluster-up/cluster/local/provider.sh b/cluster-up/cluster/local/provider.sh deleted file mode 100644 index af10d52f..00000000 --- a/cluster-up/cluster/local/provider.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -function _cert_dir() { - echo $GOPATH/src/kubevirt.io/kubevirt/cluster/local/certs -} - -function _main_ip() { - ip -o -4 a | tr -s ' ' | cut -d' ' -f 2,4 | - grep -v -e '^lo[0-9:]*' | head -1 | - cut -d' ' -f 2 | cut -d'/' -f1 -} - -function up() { - # Make sure that local config is correct - prepare_config - - go get -d k8s.io/kubernetes - - export API_HOST_IP=$(_main_ip) - export KUBELET_HOST=$(_main_ip) - export HOSTNAME_OVERRIDE=kubdev - export ALLOW_PRIVILEGED=1 - export ALLOW_SECURITY_CONTEXT=1 - export KUBE_DNS_DOMAIN="cluster.local" - export KUBE_DNS_SERVER_IP="10.0.0.10" - export KUBE_ENABLE_CLUSTER_DNS=true - export CERT_DIR=$(_cert_dir) - ( - cd $GOPATH/src/k8s.io/kubernetes - ./hack/local-up-cluster.sh - ) -} - -function prepare_config() { - PROVIDER_CONFIG_FILE_PATH="${BASE_PATH}/$KUBEVIRT_PROVIDER/config-provider-$KUBEVIRT_PROVIDER.sh" - cat > "$PROVIDER_CONFIG_FILE_PATH" <