{"id":15339196,"url":"https://github.com/frankyang0529/vm-import-controller","last_synced_at":"2025-10-10T15:31:50.094Z","repository":{"id":200446845,"uuid":"705521742","full_name":"FrankYang0529/vm-import-controller","owner":"FrankYang0529","description":null,"archived":false,"fork":true,"pushed_at":"2025-08-22T06:23:17.000Z","size":16350,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-22T08:27:42.397Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"harvester/vm-import-controller","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FrankYang0529.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-16T07:16:35.000Z","updated_at":"2025-08-22T04:11:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/FrankYang0529/vm-import-controller","commit_stats":null,"previous_names":["frankyang0529/vm-import-controller"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FrankYang0529/vm-import-controller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrankYang0529%2Fvm-import-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrankYang0529%2Fvm-import-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrankYang0529%2Fvm-import-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrankYang0529%2Fvm-import-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FrankYang0529","download_url":"https://codeload.github.com/FrankYang0529/vm-import-controller/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrankYang0529%2Fvm-import-controller/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004574,"owners_count":26083736,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T10:28:45.637Z","updated_at":"2025-10-10T15:31:49.620Z","avatar_url":"https://github.com/FrankYang0529.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vm-import-controller\n\nvm-import-controller is an addon to help migrate VM workloads from other source clusters to an existing Harvester cluster.\n\nCurrently the following source providers will be supported:\n* vmware\n* openstack\n\n## API\nThe vm-import-controller introduces two CRD's\n\n### Sources\nsources allows users to define valid source clusters.\n\nFor example:\n\n```yaml\napiVersion: migration.harvesterhci.io/v1beta1\nkind: VmwareSource\nmetadata:\n  name: vcsim\n  namespace: default\nspec:\n  endpoint: \"https://vscim/sdk\"\n  dc: \"DCO\"\n  credentials:\n    name: vsphere-credentials\n    namespace: default\n```\n\nThe secret contains the credentials for the vcenter endpoint:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata: \n  name: vsphere-credentials\n  namespace: default\nstringData:\n  \"username\": \"user\"\n  \"password\": \"password\"\n```\n\nAs part of the reconcile process, the controller will login to the vcenter and verify the `dc` specified in the source spec is valid.\n\nOnce this check is passed, the source is marked ready, and can be used for vm migrations\n\n```shell\n$ kubectl get vmwaresource.migration \nNAME      STATUS\nvcsim   clusterReady\n```\n\nFor openstack based source clusters a sample definition is as follows:\n\n```yaml\napiVersion: migration.harvesterhci.io/v1beta1\nkind: OpenstackSource\nmetadata:\n  name: devstack\n  namespace: default\nspec:\n  endpoint: \"https://devstack/identity\"\n  region: \"RegionOne\"\n  credentials:\n    name: devstack-credentials\n    namespace: default\n```\n\nThe secret contains the credentials for the vcenter endpoint:\n\n```yaml\napiVersion: v1\nkind: Secret\nmetadata: \n  name: devstack-credentials\n  namespace: default\nstringData:\n  \"username\": \"user\"\n  \"password\": \"password\"\n  \"project_name\": \"admin\"\n  \"domain_name\": \"default\"\n  \"ca_cert\": \"pem-encoded-ca-cert\"\n```\n\nOpenstack source reconcile process, attempts to list VM's in the project, and marks the source as ready\n\n```shell\n$ kubectl get openstacksource.migration\nNAME       STATUS\ndevstack   clusterReady\n```\n\n### VirtualMachimeImport\nThe VirtualMachineImport crd provides a way for users to define the source VM and mapping to the actual source cluster to perform the VM export-import from.\n\nA sample VirtualMachineImport looks as follows:\n\n```yaml\napiVersion: migration.harvesterhci.io/v1beta1\nkind: VirtualMachineImport\nmetadata:\n  name: alpine-export-test\n  namespace: default\nspec: \n  virtualMachineName: \"alpine-export-test\"\n  networkMapping:\n  - sourceNetwork: \"dvSwitch 1\"\n    destinationNetwork: \"default/vlan1\"\n  - sourceNetwork: \"dvSwitch 2\"\n    destinationNetwork: \"default/vlan2\"\n  sourceCluster: \n    name: vcsim\n    namespace: default\n    kind: VmwareSource\n    apiVersion: migration.harvesterhci.io/v1beta1\n```\n\nThis will trigger the controller to export the VM named \"alpine-export-test\" on the vmware source vcsim to be exported, processed and recreated into the harvester cluster\n\nThis can take a while based on the size of the virtual machine, but users should see `VirtualMachineImages` created for each disk in the defined virtual machine.\n\nThe list of items in `networkMapping` will define how the source network interfaces are mapped into the Harvester Networks.\n\nIf a match is not found, then each unmatched network inteface is attached to the default `managementNetwork`\n\nOnce the virtual machine has been imported successfully the object will reflect the status\n\n```shell\n$ kubectl get virtualmachineimport.migration\nNAME                    STATUS\nalpine-export-test      virtualMachineRunning\nopenstack-cirros-test   virtualMachineRunning\n\n```\n\nSimilarly, users can define a VirtualMachineImport for Openstack source as well:\n\n```yaml\napiVersion: migration.harvesterhci.io/v1beta1\nkind: VirtualMachineImport\nmetadata:\n  name: openstack-demo\n  namespace: default\nspec: \n  virtualMachineName: \"openstack-demo\" #Name or UUID for instance\n  networkMapping:\n  - sourceNetwork: \"shared\"\n    destinationNetwork: \"default/vlan1\"\n  - sourceNetwork: \"public\"\n    destinationNetwork: \"default/vlan2\"\n  sourceCluster: \n    name: devstack\n    namespace: default\n    kind: OpenstackSource\n    apiVersion: migration.harvesterhci.io/v1beta1\n```\n\n*NOTE:* Openstack allows users to have multiple instances with the same name. In such a scenario the users are advised to use the Instance ID. The reconcile logic tries to perform a lookup from name to ID when a name is used.\n\n\n## Testing\nCurrently basic integration tests are available under `tests/integration`\n\nHowever a lot of these tests need access to a working Harvester, Openstack and Vmware cluster.\n\nThe integration tests can be setup by using the following environment variables to point the tests to a working environment to perform the actual vm migration tests\n\n```shell\nexport GOVC_PASSWORD=\"vsphere-password\"\nexport GOVC_USERNAME=\"vsphere-username\"\nexport GOVC_URL=\"https://vcenter/sdk\"\nexport GOVC_DATACENTER=\"vsphere-datacenter\"\n#The controller exposes the converted disks via a http endpoint and leverages the download capability of longhorn backing images\n# the SVC address needs to be the address of node where integration tests are running and should be reachable from harvester cluster\nexport SVC_ADDRESS=\"address for node\" \nexport VM_NAME=\"vmware-export-test-vm-name\"\nexport USE_EXISTING_CLUSTER=true\nexport OS_AUTH_URL=\"openstack/identity\" #Keystone endpoint\nexport OS_PROJECT_NAME=\"openstack-project-name\"\nexport OS_USER_DOMAIN_NAME=\"openstack-user-domain\"\nexport OS_USERNAME=\"openstack-username\"\nexport OS_PASSWORD=\"openstack-password\"\nexport OS_VM_NAME=\"openstack-export-test-vm-name\"\nexport OS_REGION_NAME=\"openstack-region\"\nexport KUBECONFIG=\"kubeconfig-for-harvester-cluster\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrankyang0529%2Fvm-import-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrankyang0529%2Fvm-import-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrankyang0529%2Fvm-import-controller/lists"}