Skip to content

feat: add ISO support in supervisor builder#501

Merged
tenthirtyam merged 1 commit intovmware:mainfrom
dilyar85:feat/iso-support
May 23, 2025
Merged

feat: add ISO support in supervisor builder#501
tenthirtyam merged 1 commit intovmware:mainfrom
dilyar85:feat/iso-support

Conversation

@dilyar85
Copy link
Copy Markdown
Member

@dilyar85 dilyar85 commented Dec 18, 2024

Description

This PR introduces ISO-based VM deployment support to the vsphere-supervisor builder using the latest v1alpha3 VM Operator APIs. It enables users to:

  • Import an ISO image from a URL.
  • Deploy a VM by mounting the ISO via CD-ROM and attaching a boot disk via PVC.
  • Access the VM's web console through the VirtualMachineWebConsoleRequest CRD for guest OS installation.

For a complete e2e workflow, refer to the Packer builder logs in the testing section below.

Testing

  • Add unit tests for the new ISO VM deployment workflow.
  • Update existing unit tests to reflect the latest v1alpha3 APIs.
  • Verify e2e workflow against an internal testbed with v1alpha3 APIs enabled:
$ packer build -var-file test.json examples/builder/vsphere-supervisor/general-template-with-image-import.pkr.hcl
vsphere-supervisor.vm: output will be in this color.

==> vsphere-supervisor.vm: Creating temporary RSA SSH key for instance...
    vsphere-supervisor.vm: Connecting to Supervisor cluster...
    vsphere-supervisor.vm: Successfully connected to Supervisor cluster
    vsphere-supervisor.vm: Validating VM publish location...
    vsphere-supervisor.vm: VM publish location is valid
    vsphere-supervisor.vm: Validating image import request...
    vsphere-supervisor.vm: Image import configs are valid.
    vsphere-supervisor.vm: Importing the source image from https://packages.<sensitive>.com/photon/3.0/Rev3/iso/Update1/photon-minimal-3.0-913b49438.iso to cl-cd0a143e4b47ced54.
    vsphere-supervisor.vm: Creating ContentLibraryItemImportRequest object packer-vsphere-supervisor-import-req-840f5 in namespace sdiliyaer-test.
    vsphere-supervisor.vm: Successfully created the ContentLibraryItemImportRequest object packer-vsphere-supervisor-import-req-840f5.
    vsphere-supervisor.vm: Waiting for the image import request to complete...
    vsphere-supervisor.vm: Successfully imported the image as a content library item &{"imageregistry.<sensitive>.com/v1alpha1" "ContentLibraryItem" "clitem-8c6d327150e9e9fe3"}.
    vsphere-supervisor.vm: Finished importing the image from https://packages.<sensitive>.com/photon/3.0/Rev3/iso/Update1/photon-minimal-3.0-913b49438.iso to cl-cd0a143e4b47ced54.
    vsphere-supervisor.vm: Creating source objects with name "source-lf9fz" in namespace "sdiliyaer-test"
    vsphere-supervisor.vm: Checking source VM image "vmi-8c6d327150e9e9fe3"
    vsphere-supervisor.vm: Found namespace scoped VM image of type "ISO"
    vsphere-supervisor.vm: Deploying VM from ISO
    vsphere-supervisor.vm: Creating a PVC object for ISO VM boot disk
    vsphere-supervisor.vm: Creating a VM object with PVC and CD-ROM attached
    vsphere-supervisor.vm: Creating a VirtualMachineService object for network connection
    vsphere-supervisor.vm: Finished creating all required source objects
    vsphere-supervisor.vm: Waiting for the source VM to be ready...
    vsphere-supervisor.vm: Use the following network configuration to install the guest OS
    vsphere-supervisor.vm: {
    vsphere-supervisor.vm:     "interfaces": [
    vsphere-supervisor.vm:         {
    vsphere-supervisor.vm:             "name": "eth0",
    vsphere-supervisor.vm:             "ip": {
    vsphere-supervisor.vm:                 "addresses": [
    vsphere-supervisor.vm:                     "192.168.128.5/16"
    vsphere-supervisor.vm:                 ],
    vsphere-supervisor.vm:                 "gateway4": "192.168.1.1"
    vsphere-supervisor.vm:             }
    vsphere-supervisor.vm:         }
    vsphere-supervisor.vm:     ],
    vsphere-supervisor.vm:     "dns": {
    vsphere-supervisor.vm:         "hostName": "source-lf9fz",
    vsphere-supervisor.vm:         "nameservers": [
    vsphere-supervisor.vm:             "192.19.189.10"
    vsphere-supervisor.vm:         ]
    vsphere-supervisor.vm:     }
    vsphere-supervisor.vm: }
    vsphere-supervisor.vm: Generating a web console URL for VM guest OS access...
    vsphere-supervisor.vm: https://192.168.130.1/vm/web-console?host=10.192.76.116&namespace=sdiliyaer-test&port=443&ticket=ee4c92eba9c540f64251788991af33f0&uuid=609c61df-515a-4699-a655-3dd0e7c507b0
    vsphere-supervisor.vm: Use the above URL to complete the guest OS installation.
    vsphere-supervisor.vm: Successfully obtained the source VM IP: 192.168.128.5
    vsphere-supervisor.vm: Getting source VM ingress IP from the VMService object
    vsphere-supervisor.vm: Successfully retrieved the source VM ingress IP: 192.168.130.3
    vsphere-supervisor.vm: Source VM is now ready in Supervisor cluster
==> vsphere-supervisor.vm: Using SSH communicator to connect: 192.168.130.3
==> vsphere-supervisor.vm: Waiting for SSH to become available...
==> vsphere-supervisor.vm: Connected to SSH!
==> vsphere-supervisor.vm: Provisioning with shell script: /var/folders/nf/cndlm4ts2bd9jz3dd667jfb80000gr/T/packer-shell1681540137
    vsphere-supervisor.vm: Publishing the source VM to "cl-cd0a143e4b47ced54"
    vsphere-supervisor.vm: Creating a VirtualMachinePublishRequest object
    vsphere-supervisor.vm: Successfully created the VirtualMachinePublishRequest object
    vsphere-supervisor.vm: Waiting for the VM publish request to complete...
    vsphere-supervisor.vm: Successfully published the VM to image "vmi-65ec97448e3761458"
    vsphere-supervisor.vm: Finished publishing the source VM
    vsphere-supervisor.vm: Skip cleaning up the VirtualMachinePublishRequest object as specified in config
    vsphere-supervisor.vm: Skip cleaning up the source objects as specified in config
    vsphere-supervisor.vm: Deleting the ContentLibraryItemImportRequest object packer-vsphere-supervisor-import-req-840f5 in namespace sdiliyaer-test.
    vsphere-supervisor.vm: Successfully deleted the ContentLibraryItemImportRequest object packer-vsphere-supervisor-import-req-840f5 in namespace sdiliyaer-test.
    vsphere-supervisor.vm: Build 'vsphere-supervisor' finished successfully.
Build 'vsphere-supervisor.vm' finished after 16 minutes 4 seconds.

==> Wait completed after 16 minutes 4 seconds

==> Builds finished but no artifacts were created.

@tenthirtyam tenthirtyam added the enhancement Enhancement label Dec 18, 2024
@tenthirtyam tenthirtyam added this to the Backlog milestone Dec 18, 2024
@dilyar85 dilyar85 force-pushed the feat/iso-support branch 2 times, most recently from 5cec440 to c03ef56 Compare December 19, 2024 00:32
@dilyar85 dilyar85 marked this pull request as ready for review December 19, 2024 00:34
@dilyar85 dilyar85 requested a review from a team as a code owner December 19, 2024 00:34
Copy link
Copy Markdown
Contributor

@ericvmw ericvmw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the change!

@tenthirtyam tenthirtyam added the builder/vsphere-supervisor Builder: vsphere-supervisor label Jan 6, 2025
@tenthirtyam tenthirtyam modified the milestones: Backlog, v1.5.0 Jan 6, 2025
tenthirtyam
tenthirtyam previously approved these changes Jan 6, 2025
Copy link
Copy Markdown
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dilyar85,

Thanks for the PR, I've just finished my review pass, overall LGTM, I lack a bit of context on some of the changes here, so the feedback I left is mostly some documentation questions/comments, nothing major.

I'll let you address those, and will come back for another pass once this is done, but I'm pre-approving this PR now so it's not a blocker later on.

Edit: I forgot about the breaking change I spotted a while back, before leaving on vacation, apologies. The possibly breaking change is more of a concern here, if this is necessary, I won't block the PR per se, but we should consider making the release a major one to account for this break.

@tenthirtyam tenthirtyam added the breaking-change Breaking Change label Feb 15, 2025
@dilyar85 dilyar85 force-pushed the feat/iso-support branch 2 times, most recently from a91f30a to 9e5cd0b Compare February 21, 2025 17:17
@tenthirtyam
Copy link
Copy Markdown
Collaborator

@lbajolet-hashicorp - Thoughts on staging this one into a 2.0.0?

Copy link
Copy Markdown
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dilyar85,

Apologies for the long wait between my reviews; looking through the code, it seems good to me, if we are aware that there's a breaking change, and we release this change as a major version, there's no reason for me to request changes, especially if this is an expected change and the upstream dependency/API don't support the old way of describing things.

Overall, LGTM!

@tenthirtyam
Copy link
Copy Markdown
Collaborator

@dilyar85 - I've rebased this one and review for the v2.0.0 release.

There are a couple dependencies items and one other breaking change that I'd like use to get in for that release so stay tuned over our DMs.

@tenthirtyam tenthirtyam requested a review from kp2099 May 22, 2025 18:33
@dilyar85 dilyar85 force-pushed the feat/iso-support branch from 912c8c8 to 710d08c Compare May 22, 2025 18:55
@tenthirtyam tenthirtyam merged commit 1db2658 into vmware:main May 23, 2025
14 checks passed
tenthirtyam added a commit that referenced this pull request Jun 5, 2025
Updates to v2.0.0-dev.

Ref: #501

Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
tenthirtyam added a commit that referenced this pull request Jun 5, 2025
Updates to v2.0.0-dev.

Ref: #501

Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
@github-actions
Copy link
Copy Markdown

I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

breaking-change Breaking Change builder/vsphere-supervisor Builder: vsphere-supervisor enhancement Enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants